Repository navigation
Expand file tree
/
Copy pathREADME.charm4py
More file actions
42 lines (33 loc) · 2.05 KB
/
Copy pathREADME.charm4py
File metadata and controls
42 lines (33 loc) · 2.05 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
Building Charm++ shared library for Charm4py
============================================
- Build libcharm using the 'charm4py' build target.
For example, on a regular Linux machine:
./build charm4py reconverse-linux-x86_64 -j8 --with-production
The target builds Charm++ as a shared library (libcharm) and defines
CMK_LIBCHARM_SHARED=1 in conv-autoconfig.h. A binding such as charm4py
loads the library at run time and drives it through the CkDyn layer
(src/ck-core/ckdyn.h; developer documentation in doc/internals/ckdyn.md,
user documentation in doc/ckdyn/manual.rst).
On macOS, use the version reconverse-darwin-arm8.
NOTE: Reconverse builds always run in SMP mode, with the PEs as threads of
one process. In the most common Python implementation (CPython), multiple
threads cannot run Python code concurrently due to the Global Interpreter
Lock (GIL).
Adding modules (e.g. load balancers) to libcharm
------------------------------------------------
There are modules like tracing and load balancers that the Charm++ runtime expects
to be registered by code that charmc generates when it links an executable
(moduleinit<pid>.C): CkRegisterMainModule, _registerExternalModules and
_createTraces. A shared libcharm has no such executable, so:
- init.C defines a weak _createTraces (with the projections and summary
traces in a CMK_LIBCHARM_SHARED build with tracing enabled);
- init.C registers TreeLB and the traces itself in a CMK_LIBCHARM_SHARED
build (the section of _initCharm under #if CMK_LIBCHARM_SHARED); a module
added to libcharm needs its _register call added there, and the module's
library needs to be added to the target_link_libraries lines of the
'charm' library in the charm4py section of CMakeLists.txt;
- in place of CkRegisterMainModule, the binding registers its classes through
the CkDyn hook table (CkDynInit before CkDynStart).
The older charm4py 1.x interface (the "Ext API": ReadOnlyExt, MainchareExt,
GroupExt, ArrayElemExt, the Ck*Ext functions and the register*ExtCallback
family) has been removed; CkDyn replaces it.