forked from jamesgao/ipython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
123 lines (100 loc) · 4.18 KB
/
__init__.py
File metadata and controls
123 lines (100 loc) · 4.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# encoding: utf-8
"""Default kernel configuration."""
__docformat__ = "restructuredtext en"
#-------------------------------------------------------------------------------
# Copyright (C) 2008 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Imports
#-------------------------------------------------------------------------------
from os.path import join as pjoin
from IPython.external.configobj import ConfigObj
from IPython.config.api import ConfigObjManager
from IPython.genutils import get_ipython_dir, get_security_dir
default_kernel_config = ConfigObj()
security_dir = get_security_dir()
#-------------------------------------------------------------------------------
# Engine Configuration
#-------------------------------------------------------------------------------
engine_config = dict(
logfile = '', # Empty means log to stdout
furl_file = pjoin(security_dir, 'ipcontroller-engine.furl')
)
#-------------------------------------------------------------------------------
# MPI Configuration
#-------------------------------------------------------------------------------
mpi_config = dict(
mpi4py = """from mpi4py import MPI as mpi
mpi.size = mpi.COMM_WORLD.Get_size()
mpi.rank = mpi.COMM_WORLD.Get_rank()
""",
pytrilinos = """from PyTrilinos import Epetra
class SimpleStruct:
pass
mpi = SimpleStruct()
mpi.rank = 0
mpi.size = 0
""",
default = ''
)
#-------------------------------------------------------------------------------
# Controller Configuration
#-------------------------------------------------------------------------------
controller_config = dict(
logfile = '', # Empty means log to stdout
import_statement = '',
engine_tub = dict(
ip = '', # Empty string means all interfaces
port = 0, # 0 means pick a port for me
location = '', # Empty string means try to set automatically
secure = True,
cert_file = pjoin(security_dir, 'ipcontroller-engine.pem'),
),
engine_fc_interface = 'IPython.kernel.enginefc.IFCControllerBase',
engine_furl_file = pjoin(security_dir, 'ipcontroller-engine.furl'),
controller_interfaces = dict(
# multiengine = dict(
# controller_interface = 'IPython.kernel.multiengine.IMultiEngine',
# fc_interface = 'IPython.kernel.multienginefc.IFCMultiEngine',
# furl_file = 'ipcontroller-mec.furl'
# ),
task = dict(
controller_interface = 'IPython.kernel.task.ITaskController',
fc_interface = 'IPython.kernel.taskfc.IFCTaskController',
furl_file = pjoin(security_dir, 'ipcontroller-tc.furl')
),
multiengine = dict(
controller_interface = 'IPython.kernel.multiengine.IMultiEngine',
fc_interface = 'IPython.kernel.multienginefc.IFCSynchronousMultiEngine',
furl_file = pjoin(security_dir, 'ipcontroller-mec.furl')
)
),
client_tub = dict(
ip = '', # Empty string means all interfaces
port = 0, # 0 means pick a port for me
location = '', # Empty string means try to set automatically
secure = True,
cert_file = pjoin(security_dir, 'ipcontroller-client.pem')
)
)
#-------------------------------------------------------------------------------
# Client Configuration
#-------------------------------------------------------------------------------
client_config = dict(
client_interfaces = dict(
task = dict(
furl_file = pjoin(security_dir, 'ipcontroller-tc.furl')
),
multiengine = dict(
furl_file = pjoin(security_dir, 'ipcontroller-mec.furl')
)
)
)
default_kernel_config['engine'] = engine_config
default_kernel_config['mpi'] = mpi_config
default_kernel_config['controller'] = controller_config
default_kernel_config['client'] = client_config
config_manager = ConfigObjManager(default_kernel_config, 'IPython.kernel.ini')