1PAPI_library_init(3)                 PAPI                 PAPI_library_init(3)
2
3
4

NAME

6       PAPI_library_init   - initialize the PAPI library.
7       PAPI_is_initialized - check for initialization.
8
9

SYNOPSIS

11       C Interface
12       #include <papi.h>
13       int PAPI_library_init(int version);
14       int PAPI_is_initialized(void);
15       Fortran Interface
16       #include fpapi.h
17       PAPIF_library_init(C_INT check)
18       PAPIF_is_initialized(C_INT check)
19
20

DESCRIPTION

22       PAPI_library_init()  initializes  the  PAPI  library. It must be called
23       before any low level PAPI functions can be used. If your application is
24       making  use of threads PAPI_thread_init(3) must also be called prior to
25       making any calls to the library other than PAPI_library_init().
26
27       PAPI_is_initialized() returns the status of the PAPI library.  The PAPI
28       library  can  be in one of three states, as described under RETURN VAL‐
29       UES.
30
31

ARGUMENTS

33       version -- upon initialization, PAPI checks the  argument  against  the
34       internal  value of PAPI_VER_CURRENT when the library was compiled. This
35       guards against portability  problems  when  updating  the  PAPI  shared
36       libraries on your system.
37
38

RETURN VALUES

40       PAPI_library_init  : On success, this function returns PAPI_VER_CURRENT
41       .  A positive return  code  other  than  PAPI_VER_CURRENT  indicates  a
42       library version mis-match.  A negative error code indicates an initial‐
43       ization error.
44
45       PAPI_is_initialized :
46
47       PAPI_NOT_INITED
48        -- PAPI has not been initialized
49
50       PAPI_LOW_LEVEL_INITED
51        -- PAPI_library_init has been called
52
53       PAPI_HIGH_LEVEL_INITED
54        -- a high level PAPI function has been called
55
56
57

ERRORS

59       PAPI_is_initialized never returns an error.
60
61       PAPI_library_init can return the following:
62
63       PAPI_EINVAL
64              papi.h is different from the version used to  compile  the  PAPI
65              library.
66
67       PAPI_ENOMEM
68              Insufficient memory to complete the operation.
69
70       PAPI_ESBSTR
71              This substrate does not support the underlying hardware.
72
73       PAPI_ESYS
74              A  system  or  C  library call failed inside PAPI, see the errno
75              variable.
76
77

EXAMPLES

79       int retval;
80
81       /* Initialize the library */
82
83       retval = PAPI_library_init(PAPI_VER_CURRENT);
84
85       if (retval != PAPI_VER_CURRENT && retval > 0) {
86         fprintf(stderr,"PAPI library version mismatch!\n");
87         exit(1); }
88
89       if (retval < 0)
90         handle_error(retval);
91
92       retval = PAPI_is_initialized();
93
94       if (retval != PAPI_LOW_LEVEL_INITED)
95         handle_error(retval);
96
97

BUGS

99       If you don't call this before using any of the low  level  PAPI  calls,
100       your application could core dump.
101
102

SEE ALSO

104       PAPI_thread_init(3), PAPI(3)
105
106
107
108
109PAPI Programmer's Reference     September, 2004           PAPI_library_init(3)
Impressum