Sun Studio 12: C User's Guide

B.2.87 -xexplicitpar

(SPARC) Obsolete, do not use. Use -xopenmp instead.


Note –

-xexplicitpar does not accept OpenMP parallelization directives. However, the Sun-specific MP pragmas have been deprecated and are no longer supported. The compiler supports the APIs specified by the OpenMP 2.5 standard instead. See theSun Studio 12: OpenMP API User’s Guide for migration information to the directives of the standard.


(SPARC) Generates parallelized code based on specification of #pragma MP directives. You do the dependency analysis: analyze and specify loops for inter-iteration data dependencies. The software parallelizes the specified loops. If optimization is not at -xO3 or higher, optimization is raised to -xO3 and a warning is issued. Avoid -xexplicitpar if you do your own thread management.

To get faster code, this option requires a multiprocessor system. On a single-processor system, the generated code usually runs slower.

If you identify a loop for parallelization, and the loop has dependencies, you can get incorrect results, possibly different ones with each run, and with no warnings. Do not apply an explicit parallel pragma to a reduction loop. The explicit parallelization is done, but the reduction aspect of the loop is not done, and the results can be incorrect.

In summary, to parallelize explicitly:

The following is an example of inserting a parallel pragma immediately before the loop:


#pragma MP taskloop
  for (j=0; j<1000; j++){
  ...
  }

If you use -xexplicitpar and compile and link in one step, then linking automatically includes the microtasking library and the threads-safe C runtime library. If you use -xexplicitpar and compile and link in separate steps, then you must also link with -xexplicitpar. For a complete list of all compiler options that must be specified at both compile time and at link time, see Table A–2.


Note –

Do not specify -xexplicitpar and -xopenmp together.