1PAPI_thread_init(3)                  PAPI                  PAPI_thread_init(3)
2
3
4

NAME

6       PAPI_thread_init - initialize thread support in the PAPI library
7
8

SYNOPSIS

10       C Interface
11
12       #include "papi.h"
13       int PAPI_thread_init (unsigned long int (*handle)());
14
15       Fortran Interface
16
17       #include "fpapi.h"
18       PAPIF_thread_init(C_INT FUNCTION handle, C_INT check)
19
20

DESCRIPTION

22       PAPI_thread_init initializes thread support in the PAPI library. Appli‐
23       cations that make no use of threads do not need to call  this  routine.
24       This  function  MUST return a UNIQUE thread ID for every new thread/LWP
25       created. The OpenMP call omp_get_thread_num() violates  this  rule,  as
26       the  underlying LWPs may have been killed off by the run-time system or
27       by a call to omp_set_num_threads().  In that case, it may still  possi‐
28       ble  to  use  omp_get_thread_num()  in  conjunction  with PAPI_unregis‐
29       ter_thread() when the OpenMP thread has finished. However  it  is  much
30       better  to  use  the  underlying  thread  subsystem's  call,  which  is
31       pthread_self() on Linux platforms.
32
33

ARGUMENTS

35       handle --  Pointer to a function that returns current thread ID.
36
37

RETURN VALUES

39       PAPI_OK
40              The call returned successfully.
41
42       PAPI_EINVAL
43              One or more of the arguments is invalid.
44
45

EXAMPLES

47       if (PAPI_thread_init(pthread_self) != PAPI_OK)
48         exit(1);
49
50

BUGS

52       This function has no known bugs.
53
54

SEE ALSO

56       PAPI_thread_id(3),   PAPI_list_threads(3),    PAPI_get_thr_specific(3),
57       PAPI_set_thr_specific(3),     PAPI_register_thread(3),    PAPI_unregis‐
58       ter_thread (3), PAPI(3)
59
60
61
62PAPI Programmer's Reference     September, 2004            PAPI_thread_init(3)
Impressum