Skip to content

Commit 900dbed

Browse files
committed
add openmp env vars
1 parent 5e76998 commit 900dbed

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

env/openmp_env

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
# make sure to use only cores. if something is heavy parralelizable probably is also heavy on cpu
3+
export OMP_PLACES=cores
4+
export OMP_PROC_BIND=true
5+
6+
NRCORES=$(lscpu -J -e | python3 -c 'import sys,json; j=json.loads(sys.stdin.read()); core_list = [ i["core"] for i in j["cpus"] ]; cset = set(core_list); print(len(cset));' 2>/dev/null)
7+
[[ -z ${NRCORES} ]] && NRCORES="8"
8+
9+
export OMP_NUM_THREADS=${NRCORES}
10+

0 commit comments

Comments
 (0)