Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Parallel Programming Guide for HP-UX Systems: K-Class and V-Class Servers > Appendix A Porting CPSlib functions to pthreads

Introduction

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

The Compiler Parallel Support Library (CPSlib) is a library of thread management and synchronization routines that was initially developed to control parallelism on HP's legacy multinode systems. Most programs fully exploited their parallelism using higher-level devices such as automatic parallelization, compiler directives, and message-passing. CPSlib, however, provides a lower-level interface for the few cases that required it.

With the introduction of the V2250 series server, HP recommends the use of POSIX threads (pthreads) for purposes of thread management and parallelism. Pthreads provide portability for programmers who want to use their applications on multiple platforms.

This appendix describes how CPSlib functions map to pthread functions, and how to write a pthread program to perform the same tasks as CPSlib functions. Topics included in this chapter include:

If you are running on a server released prior to the V2250 and require explicit information on CPSlib, refer to the Exemplar Programming Guide for HP-UX systems.

Accessing pthreads

When you use pthreads routines, your program must include the < pthread.h> header file and the pthreads library must be explicitly linked to your program.

For example, assume the program prog.c contains calls to pthreads routines. To compile the program so that it links in the pthreads library, issue the following command:

% cc -D_POSIX_C_SOURCE=199506L prog.c -lpthread

The -D_POSIX_C_SOURCE=199506L string indicates the appropriate POSIX revision level. In the example above, the level is indicated as 199506L.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.