pf_sort_threads Interface

interface
public module function pf_sort_threads() result(n)

Arguments

None

Return Value integer

threads an automatic sort would use; 1 means serial.

Description

Resolves how many threads a sort should use. This is the only place the auto rule lives, and the only place in this module carrying OpenMP plumbing at all -- the same arrangement parquet_tables_parallel.f90 keeps for the table layer, and worth more here, since the alternative is that plumbing repeated in 65 generated bodies. How many threads an AUTOMATIC sort -- one where threads= is absent -- would use right now: omp_get_max_threads() when the caller is not inside an OpenMP parallel region, and 1 when they are, because a nested region is the caller's business.

Public because the read-time parquet_open_reader(..., sort_by=) has to ask the same question from a different module, and one implementation of this rule is worth more than a private copy in each -- two copies drifting would mean a raw-array sort and a read-time sort silently disagreeing about when to thread. Useful in its own right for reporting or logging what an automatic sort is about to do.