parquet_set_random_threads Subroutine

public subroutine parquet_set_random_threads(n)

Sets the cap on how many threads one bulk pf_random_permutation/pf_random_subset call may use internally.

Read per call, so it takes effect immediately. 0 restores automatic behaviour (as many threads as OpenMP offers). The value is a cap and never a request: it can only lower the automatic answer, it never overrides the rule that an unqualified bulk call inside an OpenMP parallel region runs serially, and an explicit threads= is still honoured everywhere.

Threading a permutation changes how fast it is built and never what it contains. pf_random_perm_at(seed, m, k) is a pure function of its coordinates, so every element is computed independently of every other -- the 1-thread and 64-thread outputs were verified bit-identical. That is a stronger guarantee than most threading knobs can offer, and it is why this one is admissible as a setting at all.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n

thread cap, or 0 for automatic; must be >= 0.


Source Code

    subroutine parquet_set_random_threads(n)
        integer, intent(in) :: n !! thread cap, or 0 for automatic; must be >= 0.

        if (n < 0) error stop "parquet_set_random_threads: n must be >= 0 (0 means automatic)"
        cfg_random_threads = n
    end subroutine parquet_set_random_threads