At some places in the code, the argument for nthreads in relevant ducc functions are still missing. While it is quickly fixable, I noticed that its default values are set inconsistently. At some places the default is set with nthreads: int | None = None usually followed by a call nthreads = resolve_nthreads(nthreads), while at others the default is set with nthreads: int = 0. Also in resolve_threads(), when nthreads is None, it returns 0. With 0 default, ducc would use all available hardware threads. With multiple MPI processes, this may lead to thread contention and may affect the performance.
As for consistency in setting the defaults,I was curious what could be the correct way to resolve this. One would be to use consistent defaults in all cases, followed by the resolve_nthreads() call. Another solution would be to make nthreads a global variable in litebird_sim (much like MPI_COMM_WORLD) and use it consistently without having to call resolve_nthreads() every time nthreads is needed.
Please let me know what you think.
At some places in the code, the argument for
nthreadsin relevantduccfunctions are still missing. While it is quickly fixable, I noticed that its default values are set inconsistently. At some places the default is set withnthreads: int | None = Noneusually followed by a callnthreads = resolve_nthreads(nthreads), while at others the default is set withnthreads: int = 0. Also inresolve_threads(), whennthreadsisNone, it returns0. With0default,duccwould use all available hardware threads. With multiple MPI processes, this may lead to thread contention and may affect the performance.As for consistency in setting the defaults,I was curious what could be the correct way to resolve this. One would be to use consistent defaults in all cases, followed by the
resolve_nthreads()call. Another solution would be to makenthreadsa global variable inlitebird_sim(much likeMPI_COMM_WORLD) and use it consistently without having to callresolve_nthreads()every timenthreadsis needed.Please let me know what you think.