24.05.2014 Views

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

num<br />

the maximum number of threads that can be used if dynamic adjustment<br />

of the number of threads is enabled. If dynamic adjustment of the number<br />

of threads is not enabled, the value of OMP_NUM_THREADS is the exact<br />

number of threads that can be used. It must be a positive, scalar integer.<br />

The default number of threads that a program uses when it runs is the number of<br />

online processors on the machine.<br />

If you specify the number of threads with both the PARTHDS suboption of the<br />

<strong>XL</strong>SMPOPTS environment variable and the OMP_NUM_THREADS environment<br />

variable, the OMP_NUM_THREADS environment variable takes precedence. The<br />

omp_set_num_threads subroutine takes precedence over the<br />

OMP_NUM_THREADS environment variable.<br />

The following example shows how you can set the OMP_NUM_THREADS<br />

environment variable:<br />

export OMP_NUM_THREADS=16<br />

OMP_SCHEDULE Environment Variable<br />

The OMP_SCHEDULE environment variable applies to PARALLEL DO and<br />

work-sharing DO directives that have a schedule type of RUNTIME. The syntax is<br />

as follows:<br />

►► OMP_SCHEDULE= sched_type<br />

, chunk_size<br />

►◄<br />

sched_type<br />

is either DYNAMIC, GUIDED, or STATIC.<br />

chunk_size<br />

is a positive, scalar integer that represents the chunk size.<br />

This environment variable is ignored <strong>for</strong> PARALLEL DO and work-sharing DO<br />

directives that have a schedule type other than RUNTIME.<br />

If you have not specified a schedule type either at compile time (through a<br />

directive) or at run time (through the OMP_SCHEDULE environment variable or<br />

the SCHEDULE option of the <strong>XL</strong>SMPOPTS environment variable), the default<br />

schedule type is STATIC, and the default chunk size is set to the following <strong>for</strong> the<br />

first N - 1 threads:<br />

chunk_size = ceiling(Iters/N)<br />

It is set to the following <strong>for</strong> the Nth thread, where N is the total number of threads<br />

and Iters is the total number of iterations in the DO loop:<br />

chunk_size = Iters - ((N - 1) * ceiling(Iters/N))<br />

If you specify both the SCHEDULE option of the <strong>XL</strong>SMPOPTS environment<br />

variable and the OMP_SCHEDULE environment variable, the OMP_SCHEDULE<br />

environment variable takes precedence.<br />

The following examples show how you can set the OMP_SCHEDULE<br />

environment variable:<br />

export OMP_SCHEDULE="GUIDED,4"<br />

export OMP_SCHEDULE="DYNAMIC"<br />

Editing, Compiling, Linking, and Running <strong>XL</strong> <strong>Fortran</strong> Programs 65

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!