Marcações

TWEETS RECENTES

ENCONTRE-NOS NO FACEBOOK

New OpenMP features

OpenMP is an add-on to the C, C++, and FORTRAN programming languages that is meant to give the programmer an easy and portable way to parallelize their programs. This is done by adding directives (or pragmas), run-time routines, and environment variables that allow the programmer to control how a program is parallelized.

The XL Compilers support OpenMP, and, in this latest release, have added support for two important parts of the OpenMP 3.0 specification, and improved its implementation of another. The final important change is the reimplementation of OpenMP thread private variables. These are global variables where each threads has is own copy. In previous releases, this was implemented using a library (the smp run-time), but, in this release, it is implemented using calls to the operating system. This will decrease the time needed to access these variables, and, as a result, increase the performance of programs that use these variables heavily. Nothing special needs to be done to use this new feature; it is the default for thread private variable. However, you can revert to the old behavior by using -qsmp=noostls.

The first is the finalization of the task implementation for FORTRAN. The main advantage of the task construct is that it can be used to parallelize recursive algorithms and loops where the iteration count cannot be determined without running the loop. The standard example is to parallelize an algorithm that traverses a linked-list and does something to each node. In a future post, we will go over cases where tasks are useful, and how to use them.

The other new feature is the ability to privatize a FORTRAN allocatable array that is in the allocated state, and to use them in reductions. In previous releases, the programmer would have to take care of allocating the array for each thread and to deallocate it. As well, the programmer would have to jump through hoops in order to mimic first and last private clauses. This makes things easier for the programmer. However, the real advantage is the ability to use an allocatable array in a reduction clause. Now if you want to have an array reduction you do not have to use a fixed size array. It can be whatever you need it to be.