Thứ Tư, 5 tháng 8, 2009

Nested Parallel for and OpenMP compilers

Nested parallelism behavior depends on the implementation therefore it's different on different compilers.

For example with nested parallel for

#pragma omp for
for ( , , )
#pragma omp for
for ( , , )
foo();

On GNU compiler (gcc 4,3,3 for example), you will see the warning: "work-sharing region may not be closely nested inside of work-sharing, critical, ordered or master region".

However, on SunStudio 12, an error is thrown: " pragma for is not allowed to be nested inside of for".

Be careful and considerate when using nested parallel for.

GNU Feature Test Macros

Why do we usually specify #define _GNU_SOURCE in our source code?What does it actually mean? #define _GNU_SOURCE is a GNU Feature Test Macro. GNU Feature Test Macros enable extensions on glibc (GNU C Library). I helps the system to have more functionalities.

For more information, please have a look at http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html