Skip to content

CPU 5. Helper Methods

Phillip Allen Lane edited this page Nov 27, 2023 · 1 revision

There are a set of helper methods which are primarily used for setting or getting information from the runtime. Here's a list of those methods:

DotMP Function Behavior
DotMP.Parallel.GetNumProcs() returns the number of logical threads on the system
DotMP.Parallel.GetNumThreads() returns the number of active threads in the current region
DotMP.Parallel.SetNumThreads() sets the number of threads for the next parallel region to use
DotMP.Parallel.GetThreadNum() gets the ID of the current thread
DotMP.Parallel.GetMaxThreads() gets the maximum number of threads the runtime may use in the next region
DotMP.Parallel.InParallel() returns true if called from within a parallel region, otherwise false
DotMP.Parallel.SetDynamic() tells the runtime to choose the number of threads, can disable by calling SetNumThreads()
DotMP.Parallel.GetDynamic() returns true if the runtime can choose the number of threads
DotMP.Parallel.GetWTime() returns the number of seconds since the Unix epoch as a double
DotMP.Parallel.GetSchedule() gets the current schedule of the parallel for loop
DotMP.Parallel.GetChunkSize() gets the current chunk size of the parallel for loop