4 threads as default. Reasonable for modern computers
hardcoded + and as shell variable
This commit is contained in:
parent
f89f07e5cf
commit
00bc6a9031
|
@ -55,7 +55,8 @@ if [ ! -z "$PS1" ]; then
|
|||
|| echo " ~~> "$(canonicalPath "$PETSC_DIR")
|
||||
fi
|
||||
[ "x$PETSC_ARCH" != "x" ] && echo "PETSc architecture $PETSC_ARCH"
|
||||
[ "x$OMP_NUM_THREADS" != "x" ] && echo "Multithreading OMP_NUM_THREADS=$OMP_NUM_THREADS"
|
||||
[ "x$OMP_NUM_THREADS" == "x" ] && export OMP_NUM_THREADS=4
|
||||
echo "Multithreading OMP_NUM_THREADS=$OMP_NUM_THREADS"
|
||||
echo -n "heap size "
|
||||
[[ "$(ulimit -d)" == "unlimited" ]] \
|
||||
&& echo "unlimited" \
|
||||
|
|
|
@ -45,7 +45,8 @@ if [ ! -z "$PS1" ]; then
|
|||
|| echo " ~~> "$(canonicalPath "$PETSC_DIR")
|
||||
fi
|
||||
[[ "x$PETSC_ARCH" != "x" ]] && echo "PETSc architecture $PETSC_ARCH"
|
||||
[[ "x$OMP_NUM_THREADS" != "x" ]] && echo "Multithreading OMP_NUM_THREADS=$OMP_NUM_THREADS"
|
||||
[[ "x$OMP_NUM_THREADS" == "x" ]] && export OMP_NUM_THREADS=4
|
||||
echo "Multithreading OMP_NUM_THREADS=$OMP_NUM_THREADS"
|
||||
echo -n "heap size "
|
||||
[[ "$(ulimit -d)" == "unlimited" ]] \
|
||||
&& echo "unlimited" \
|
||||
|
|
|
@ -392,7 +392,7 @@ class Grid:
|
|||
seeds_p = seeds
|
||||
coords = grid_filters.coordinates0_point(cells,size).reshape(-1,3)
|
||||
|
||||
pool = mp.Pool(int(os.environ.get('OMP_NUM_THREADS',1)))
|
||||
pool = mp.Pool(int(os.environ.get('OMP_NUM_THREADS',4)))
|
||||
result = pool.map_async(partial(Grid._find_closest_seed,seeds_p,weights_p), [coord for coord in coords])
|
||||
pool.close()
|
||||
pool.join()
|
||||
|
@ -437,7 +437,7 @@ class Grid:
|
|||
"""
|
||||
coords = grid_filters.coordinates0_point(cells,size).reshape(-1,3)
|
||||
KDTree = spatial.cKDTree(seeds,boxsize=size) if periodic else spatial.cKDTree(seeds)
|
||||
devNull,material_ = KDTree.query(coords)
|
||||
devNull,material_ = KDTree.query(coords, workers = int(os.environ.get('OMP_NUM_THREADS',4)))
|
||||
|
||||
return Grid(material = (material_ if material is None else material[material_]).reshape(cells),
|
||||
size = size,
|
||||
|
|
|
@ -1179,7 +1179,7 @@ class Result:
|
|||
|
||||
"""
|
||||
chunk_size = 1024**2//8
|
||||
pool = mp.Pool(int(os.environ.get('OMP_NUM_THREADS',1)))
|
||||
pool = mp.Pool(int(os.environ.get('OMP_NUM_THREADS',4)))
|
||||
lock = mp.Manager().Lock()
|
||||
|
||||
groups = []
|
||||
|
|
Loading…
Reference in New Issue