parquet_set_sort_threads Subroutine

public subroutine parquet_set_sort_threads(n)

Sets the default thread count for every sort that does not pass threads= explicitly -- pf_sort/pf_argsort and friends, a read-time parquet_open_reader(..., sort_by=), and parquet_table%sort_by, which all share one engine and must share one default.

Read per sort call, so it takes effect immediately. 0 restores automatic behaviour (as many threads as OpenMP offers). A setting caps the automatic answer; it never overrides the rule that an unqualified sort inside an OpenMP parallel region runs serially -- eight threads each asking for eight more is slower than not threading at all, and a caller who set this said nothing about nesting. An explicit threads= is still honoured everywhere, including there.

Arguments

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

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


Source Code

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

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