Parallel
distribute(simulation_fn, spaces, n_cores=None, shuffle=False)
Distribute a function over a list of parameters in parallel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
simulation_fn |
Callable
|
function to be distributed |
required |
spaces |
list[list[float]]
|
list of lists of parameters |
required |
n_cores |
int
|
number of cores to use. |
None
|
Returns:
Type | Description |
---|---|
tuple index (int): Index of the parameters in the spaces list, multiple dims. simulation_fn output (any): The output of the simulation function. index - index of the parameters in the spaces list, multiple dims. |
Source code in cmtj/utils/parallel.py
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 |
|
parallel_vsd_sb_model(simulation_fn, frequencies, Hvecs, layers, J1=None, J2=None, iDMI=None, n_cores=None)
Parallelise the VSD SB model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
simulation_fn |
Callable
|
function to be distributed. This function must take a tuple of arguments, where the first argument is the frequency, then Hvectors, the list of layers and finally the list of J1 and J2 values. |
required |
frequencies |
list[float]
|
list of frequencies |
required |
Hvecs |
list[list[float]]
|
list of Hvectors in cartesian coordinates |
required |
layers |
list[LayerDynamic]
|
list of layers |
required |
J1 |
list[float]
|
list of J1 values |
None
|
J2 |
list[float]
|
list of J2 values |
None
|
n_cores |
int
|
number of cores to use. |
None
|
Returns:
Type | Description |
---|---|
list of simulation_fn outputs for each frequency |
Source code in cmtj/utils/parallel.py
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 |
|