Skip to content

Missing nthreads arguments and its inconsistent defaults #544

Description

@anand-avinash

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions