Python: module ensembleSharedObj
create a Python object shared across an EnsembleSimulation
Method of sharing python objects across between processes associated with
ensembleSimulation.EnsembleSimulations.
Classes |
| |
- builtins.object
-
- Random
- SharedObj
class Random(builtins.object) |
|
an ensemble-safe Random object- the same result from random is
distributed throughout the ensembleSimulation.EnsembleSimulation |
|
Methods defined here:
- __init__(s)
- Initialize self. See help(type(self)) for accurate signature.
Data descriptors defined here:
- __dict__
dictionary for instance variables (if defined)
- __weakref__
list of weak references to the object (if defined)
|
class SharedObj(builtins.object) |
|
SharedObj(ens=0, obj=0)
a Python object shared across ensemble simulation members.
The shared object must be picklable- meaning it should be a Python type.
Strange memory errors will occur if non-picklable objects are shared.
SWIG objects do not seem to be pickable. |
|
Methods defined here:
- __del__(s)
- __init__(s, ens=0, obj=0)
- arguments:
ens - optional EnsembleSimulation object.
obj - optional initial value for variable.
- barrierGet(s)
- return the non-shared value of the shared object w/ barrier.
Must be called when all threads are active.
- get(s)
- return the value of the shared object.
- set(s, obj)
- set the value of the shared object
Data descriptors defined here:
- __dict__
dictionary for instance variables (if defined)
- __weakref__
list of weak references to the object (if defined)
| |
Functions |
| |
- collect(esim, val)
- Return a list of size esim.size(), containing each value val from
each process of an ensembleSimulation.EnsembleSimulation.
val must be picklable.
- getpid()
- Return the current process id.
- unlink(path, *, dir_fd=None)
- Remove a file (same as remove()).
If dir_fd is not None, it should be a file descriptor open to a directory,
and path should be relative; path will then be relative to that directory.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
|