|
5 | 5 | import dask |
6 | 6 | from dask.distributed import Client, progress |
7 | 7 |
|
8 | | -##### Functions |
9 | | -# ============================================================================= |
10 | | -# KERNEL FOR PARALLEL COMPUTING |
11 | | -# ============================================================================= |
12 | | -def parallel_client(cpu_params=dict(tpw=2,nw=4,ml=7.5)): |
13 | | - """ |
14 | | - Create client kernel for parallel computing |
15 | | - ==================================================== |
16 | | - INPUT: |
17 | | - -> cpu_params: dict containing floats with keys |
18 | | - -> tpw: threads_per_worker |
19 | | - -> nw: n_workers |
20 | | - -> ml: memory_limit per worker [GB] |
21 | | - OUTPUT: |
22 | | - -> client: configuration of parallel computing |
23 | | - ==================================================== |
24 | | - """ |
25 | | - |
26 | | - client = Client(threads_per_worker=cpu_params['tpw'], |
27 | | - n_workers=cpu_params['nw'], |
28 | | - memory_limit=str(cpu_params['ml'])+'GB') |
29 | | - return client |
30 | | -#============================================================================= |
31 | | - |
| 8 | +##### User functions |
32 | 9 | #============================================================================= |
33 | 10 | # NEAREST DISTANCE |
34 | 11 | #============================================================================= |
@@ -156,3 +133,30 @@ def timefilter(prop,filtdays=60): |
156 | 133 |
|
157 | 134 | return m_prop,p_prop |
158 | 135 | #============================================================================= |
| 136 | + |
| 137 | +##### Functions for relative imports |
| 138 | +# ============================================================================= |
| 139 | +# KERNEL FOR PARALLEL COMPUTING |
| 140 | +# ============================================================================= |
| 141 | +def _parallel_client(cpu_params=dict(tpw=2,nw=4,ml=7.5)): |
| 142 | + """ |
| 143 | + Create client kernel for parallel computing |
| 144 | + ==================================================== |
| 145 | + INPUT: |
| 146 | + -> cpu_params: dict containing floats with keys |
| 147 | + -> tpw: threads_per_worker |
| 148 | + -> nw: n_workers |
| 149 | + -> ml: memory_limit per worker [GB] |
| 150 | + OUTPUT: |
| 151 | + -> client: configuration of parallel computing |
| 152 | + ==================================================== |
| 153 | + """ |
| 154 | + |
| 155 | + client = Client(threads_per_worker=cpu_params['tpw'], |
| 156 | + n_workers=cpu_params['nw'], |
| 157 | + memory_limit=str(cpu_params['ml'])+'GB') |
| 158 | + return client |
| 159 | +#============================================================================= |
| 160 | + |
| 161 | + |
| 162 | + |
0 commit comments