Skip to content

Commit

Permalink
Set default value of OMP_NUM_THREADS to zero (and not None)
Browse files Browse the repository at this point in the history
The `DUCC0_NUM_THREADS` env. variable is converted to `long int` within
`ducc` (https://gitlab.mpcdf.mpg.de/mtr/ducc/-/blob/ducc0/src/ducc0/infra/threading.cc#L135) and
passing the string "None" is actually "well" converted to zero (so to leave `ducc` finds and
optimizes the number of threads) but it raises a kind of logic error (`Invalid argument`) since
"None" is not an integer. On laptop where `OMP_NUM_THREADS` is not necessary set, all goes well with
GNU C compiler (so no error) but the `clang` compiler (on mac for instance) is stricter and raises
an error.
  • Loading branch information
xgarrido committed Oct 5, 2023
1 parent cc571df commit 23de4f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pixell/curvedsky.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# This must be done before importing ducc0 for the first time. Doing this
# limits wasted memory from ducc allocating too big a thread pool. For computes
# with many cores, this can save GBs of memory.
utils.setenv("DUCC0_NUM_THREADS", utils.getenv("OMP_NUM_THREADS"), keep=True)
utils.setenv("DUCC0_NUM_THREADS", utils.getenv("OMP_NUM_THREADS", 0), keep=True)
import ducc0

class ShapeError(Exception): pass
Expand Down

0 comments on commit 23de4f9

Please sign in to comment.