OMP_WAIT_POLICY. STMicroelectronics PGI
تبلیغات
تبلیغات
OpenMP Environment Variables to a higher value, for example using set_omp_num_threads(), cause the number of processes or threads to be set at the value of
OMP_THREAD_LIMIT
rather than the value specified in the function call.
OMP_WAIT_POLICY
OMP_WAIT_POLICY
sets the behavior of idle threads - specifically, whether they spin or sleep when idle. The values are ACTIVE and PASSIVE, with ACTIVE the default. The behavior defined by
OMP_WAIT_POLICY
is also shared by threads created by auto-parallelization.
• Threads are considered idle when waiting at a barrier, when waiting to enter a critical region, or when unemployed between parallel regions.
• Threads waiting for critical sections always busy wait (ACTIVE).
• Barriers always busy wait (ACTIVE), with calls to sched_yield
determined by the environment variable
MP_SPIN
, described in “MP_SPIN,” on page 137
.
• Unemployed threads during a serial region can either busy wait using the barrier (ACTIVE) or politely wait using a mutex (PASSIVE). This choice is set by
OMP_WAIT_POLICY
, so the default is ACTIVE.
When ACTIVE is set, idle threads consume 100% of their CPU allotment spinning in a busy loop waiting to restart in a parallel region. This mechanism allows for very quick entry into parallel regions, a condition which is good for programs that enter and leave parallel regions frequently.
When PASSIVE is set, idle threads wait on a mutex in the operating system and consume no CPU time until being restarted. Passive idle is best when a program has long periods of serial activity or when the program runs on a multi-user machine or otherwise shares CPU resources.
316
Chapter 18. PGI Accelerator
Compilers Reference
describes the programming model that uses a collection of compiler directives to specify regions of code in Fortran and C programs that can be offloaded from a
host
CPU to an attached
accelerator
. The method described provides a model for accelerator programming that is portable across operating systems and various types of host CPUs and accelerators.
PGI provides a set of Fortran and C accelerator compilers and tools for 64-bit x86-compatible processor-based workstations and servers with an attached NVIDIA CUDA-enabled GPU or Tesla card.
Note
The PGI Accelerator compilers require a separate license key in addition to a normal PGI Workstation,
Server, or CDK license.
This chapter contains detailed descriptions of each of the PGI Accelerator directives and C pragmas that PGI
supports. In addition, the section “PGI Accelerator Directive Clauses,” on page 323
contains information about the clauses associated with these directives and pragmas.
PGI Accelerator Directives
This section provides detailed descriptions of the Fortran and C directives used to delineate accelerator regions and to augment information available to the compiler for scheduling of loops and classification of data.
• In C, PGI Accelerator directives are specified using the #pragma mechanism provided by the standard.
• In Fortran, PGI Accelerator directives are specified using special comments that are identified by a unique sentinel.
This syntax enables compilers to ignore accelerator directives if support is disabled or not provided.
PGI currently supports these types of accelerator directives:
• An “Accelerator Compute Region Directive”
defines information about the region of a program. These directives are either an accelerator compute region directive, that defines the region of a program to be compiled for execution on the accelerator device, or an accelerator data region directive that
317
دانلود
تبلیغات