1PAPI_register_thread(3) PAPI PAPI_register_thread(3)
2
3
4
6 PAPI_register_thread, PAPI_unregister_thread - Inform PAPI of thread
7 status
8
9
11 #include <papi.h>
12 int PAPI_register_thread (void);
13 int PAPI_unregister_thread (void);
14 Fortran Interface
15 #include fpapi.h
16 PAPIF_register_thread(C_INT check)
17 PAPIF_unregister_thread(C_INT check)
18
19
21 PAPI_register_thread should be called when the user wants to force PAPI
22 to initialize a thread that PAPI has not seen before. Usually this is
23 not necessary as PAPI implicitly detects the thread when an eventset is
24 created or other thread local PAPI functions are called. However, it
25 can be useful for debugging and performance enhancements in the run-
26 time systems of performance tools.
27
28 PAPI_unregister_thread should be called when the user wants to shutdown
29 a particular thread and free the associated thread ID. THIS IS IMPOR‐
30 TANT IF YOUR THREAD LIBRARY REUSES THE SAME THREAD ID FOR A NEW KERNEL
31 LWP. OpenMP does this. OpenMP parallel regions, if separated by a call
32 to omp_set_num_threads() will often kill off the underlying kernel LWPs
33 and then start new ones for the next region. However,
34 omp_get_thread_id() does not reflect this, as the thread IDs for the
35 new LWPs will be the same as the old LWPs. PAPI needs to know that the
36 underlying LWP has changed so it can set up the counters for that new
37 thread. This is accomplished by calling this function.
38
39
41 None.
42
43
45 On success, this function returns PAPI_OK. On error, a non-zero error
46 code is returned.
47
48
50 PAPI_ENOMEM
51 Space could not be allocated to store the new thread informa‐
52 tion.
53
54 PAPI_ESYS
55 A system or C library call failed inside PAPI, see the errno
56 variable.
57
58 PAPI_ESBSTR
59 Hardware counters for this thread could not be initialized.
60
61
63 None.
64
65
67 PAPI_thread_init(3), PAPI_thread_id(3)
68
69
70
71
72PAPI Programmer's Reference September, 2004 PAPI_register_thread(3)