Download as a PDF
Transcript
Logical IDs are consecutive integers that start with 0. If the number of virtual processors available in the system is n, then their logical IDs are 0, 1, ..., n-1. Note: The thread binding with sunw_mp_procbind currently does not care about binding in operating system e.g. by taskset. This may lead to unexpected behavior or errors if using both ways to bind the threads simultaneously. 6.1.4.2 Automatic Scoping The Oracle compiler offers a highly interesting feature, which is not part of the current OpenMP specification, called Automatic Scoping . If the programmer adds one of the clauses default(__auto) or __auto(list-of-variables) to the OpenMP parallel directive, the compiler will perform the data dependency analysis and determine what the scope of all the variables should be, based on a set of scoping rules. The programmer no longer has to declare the scope of all the variables (private, firstprivate, lastprivate, reduction or shared ) explicitly, which in many cases is a tedious and error-prone work. In case the compiler is not able to determine the scope of a variable, the corresponding parallel region will be serialized. However, the compiler will report the result of the autoscoping process so that the programmer can easily check which variables could not be automatically scoped and add suitable explicit scoping clauses for just these variables to the OpenMP parallel directive. Add the compiler option -vpara to get warning messages and a list of variables for which autoscoping failed. Add the compiler option -g to get more details about the effect of autoscoping with the er_src command. $ $PSRC/pex/610|| f90 -g -O3 -xopenmp -vpara -c $PSRC/psr/jacobi_autoscope.f95 $ $PSRC/pex/610|| er_src jacobi_autoscope.o Find more information about autoscoping in http://docs.sun.com/source/817-6703/5_autoscope.html 6.1.4.3 Autoparallelization The option to turn on autoparallelization with the Oracle compilers is -xautopar which includes -depend -O3 and in case of Fortran also -stackvar. In case you want to combine autoparallelization and OpenMP49 , we strongly suggest using the -xautopar -xopenmp combination. With the option -xreduction, automatic parallelization of reductions is also permitted, e.g. accumulations, dot products etc., whereby the modification of the sequence of the arithmetic operation can cause different rounding error accumulations. Compiling with the option -xloopinfo makes the compiler emit information about the parallelization. If the number of loop iterations is unknown during compile time, code is produced which decides at runtime whether a parallel execution of the loop is more efficient or not (alternate coding). With automatic parallelization it is furthermore possible to specify the number of used threads by the environment variable omp_num_threads. 6.1.4.4 Nested Parallelization The Oracle compilers’ OpenMP support includes nested parallelism. You have to set the environment variable omp_nested=true or call the runtime routine omp_set_nested() to enable nested parallelism. Oracle Studio compilers support the OpenMP v3.0 as of version 12, so it is recommended to use the new functions omp_thread_limit and omp_max_active_levels to control the nesting behavior (see the OpenMP API v3.0 specification).50 49 The Oracle(Sun)-specific MP pragmas have been deprecated and are no longer supported. Thus the -xparallel option is obsolete now. Do not use this option. 50 However, the older Oracle(Sun)-specific variables sunw_mp_max_pool_threads and sunw_mp_max_nested_levels are still supported. • sunw_mp_max_pool_threads specifies the size (maximum number of threads) of the thread pool. The thread pool contains only non-user threads – threads that the libmtsk library creates. It does not include user threads such as the main thread. Setting sunw_mp_max_pool_threads to 0 forces the thread pool to be empty, and all parallel regions will be executed by one thread. The value specified should be a non-negative integer. The default value is 1023. This environment variable can prevent a single process from creating too many threads. That might happen e.g. for recursively nested parallel The RWTH HPC-Cluster User's Guide, Version 7.2, November 2010 57