4 threads as default. Reasonable for modern computers

hardcoded + and as shell variable
This commit is contained in:
Martin Diehl 2021-04-28 20:26:25 +02:00
parent f89f07e5cf
commit 00bc6a9031
4 changed files with 7 additions and 5 deletions

3
env/DAMASK.sh vendored
View File

@ -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" \

3
env/DAMASK.zsh vendored
View File

@ -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" \

View File

@ -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,

View File

@ -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 = []