C and C++ programs using CPSlib functions must
include the following header file:
To access errno symbolic
constant values in C or C++, you must also include
the following header file:
The Fortran 90, Fortran 77, aC++, and C
compilers
share a common interface to CPSlib; the same library, libcps.sl,
allows access to the CPSlib functions from any of the languages.
In the Exemplar compilers, CPSlib is automatically linked in only
at +O3 (and above) when +Oparallel
is specified. If your program explicitly calls CPSlib routines or
calls other libraries that use CPS routines and you are not linking
at +O3
(or +O4) with +Oparallel,
you must explicitly link in CPSlib as shown in the example below.
Assume prog.c contains calls to CPSlib routines:
% cc prog.c -lpthread
-lcps -lpthread
Linking in CPSlib requires specifying—in the order
given—all of the string -lpthread -lcps
-lpthread. The pthread
library is required because CPSlib uses Pthreads routines. Pthreads
routines can be used independently of CPSlib. For more information
on using Pthreads, see the pthread(3t) man page or the book Programming
with Threads on HP-UX (B2355-90060).
CPSlib and MP_NUMBER_OF_THREADS |
 |
CPSlib checks the value of the MP_NUMBER_OF_THREADS
environment variable to determine how many processors to generate
code for. This variable is read at runtime. If this variable is
set to some positive integer n,
your program executes on n processors; n
must be less than or equal to the number of processors in the system
where the program is executing. The default value for MP_NUMBER_OF_THREADS
is 1.
The following command line shows the C shell syntax to use
when setting the variable to 8 processors:
% setenv MP_NUMBER_OF_THREADS
8