#This example uses APEX configured by TAU with ompt or openmp support.

Example configuration with oneAPI:
$ ./configure -bfd=download -cc=icx -c++=icpx -level_zero -apex -zerosum -ompt
$ make install -j

To use this example:
$ make clean
$ make
$ OMP_NUM_THREADS=4 tau_exec -T serial,ompt -apex ./openmp_test


  ___  ______ _______   __
 / _ \ | ___ \  ___\ \ / /
/ /_\ \| |_/ / |__  \ V /
|  _  ||  __/|  __| /   \
| | | || |   | |___/ /^\ \
\_| |_/\_|   \____/\/   \/

APEX Version: v2.7.1-2bd7ac2c-develop
Built on: 05:31:54 Oct 28 2026 (RelWithDebInfo)
C++ Language Standard version : 201703
Intel Compiler version : Intel(R) oneAPI DPC++/C++ Compiler 2026.1.0 (2026.1.0.20260617)
Configured features: Pthread, BFD, L0, OPENCL, PLUGINS

Executing command line: ./openmp_test

Initializing...
Initializing...
True sharing...
Result: 23986707.688849
Reduction sharing...
Result: 23986707.692895
False sharing...
Result: 23986707.695174
No Sharing...
Result: 23986707.695174

$ pprof
Reading Profile files in profile.*

NODE 0;CONTEXT 0;THREAD 0:
---------------------------------------------------------------------------------------
%Time    Exclusive    Inclusive       #Call      #Subrs  Inclusive Name
              msec   total msec                          usec/call
---------------------------------------------------------------------------------------
100.0           17          845           1           1     845338 .TAU application
 98.0            8          828           1           1     828075 int taupreload_main(int, char **, char **)
 97.0            9          819           1           6     819635 int apex_preload_main(int, char **, char **)
 81.6          689          689           1           0     689406 OpenMP_Parallel_Region true_sharing(double*, double*)
  7.2           60           60           1           0      60682 OpenMP_Parallel_Region openmp_reduction(double*, double*)
  5.3           44           44           2           0      22308 OpenMP_Parallel_Region main
  1.0            8            8           1           0       8053 OpenMP_Parallel_Region false_sharing(double*, double*)
  0.9            7            7           1           0       7725 OpenMP_Parallel_Region no_sharing(double*, double*)
---------------------------------------------------------------------------------------

USER EVENTS Profile :NODE 0, CONTEXT 0, THREAD 0
---------------------------------------------------------------------------------------
NumSamples   MaxValue   MinValue  MeanValue  Std. Dev.  Event Name
---------------------------------------------------------------------------------------
         1       2.26       2.26       2.26          0  1 Minute Load average
         1       2.26       2.26       2.26          0  1 Minute Load average : int taupreload_main(int, char **, char **)
         1          2          2          2          0  status:Threads
         1          2          2          2          0  status:Threads : int taupreload_main(int, char **, char **)
         1  2.722E+05  2.722E+05  2.722E+05          0  status:VmData kB
         1  2.722E+05  2.722E+05  2.722E+05          0  status:VmData kB : int taupreload_main(int, char **, char **)
         1         72         72         72          0  status:VmExe kB
         1         72         72         72          0  status:VmExe kB : int taupreload_main(int, char **, char **)
         1   1.29E+04   1.29E+04   1.29E+04          0  status:VmHWM kB
         1   1.29E+04   1.29E+04   1.29E+04          0  status:VmHWM kB : int taupreload_main(int, char **, char **)
         1          0          0          0          0  status:VmLck kB
         1          0          0          0          0  status:VmLck kB : int taupreload_main(int, char **, char **)
         1  2.444E+04  2.444E+04  2.444E+04          0  status:VmLib kB
         1  2.444E+04  2.444E+04  2.444E+04          0  status:VmLib kB : int taupreload_main(int, char **, char **)
         1        104        104        104          0  status:VmPTE kB
         1        104        104        104          0  status:VmPTE kB : int taupreload_main(int, char **, char **)
         1  4.523E+05  4.523E+05  4.523E+05          0  status:VmPeak kB
         1  4.523E+05  4.523E+05  4.523E+05          0  status:VmPeak kB : int taupreload_main(int, char **, char **)
         1          0          0          0          0  status:VmPin kB
         1          0          0          0          0  status:VmPin kB : int taupreload_main(int, char **, char **)
         1   1.29E+04   1.29E+04   1.29E+04          0  status:VmRSS kB
         1   1.29E+04   1.29E+04   1.29E+04          0  status:VmRSS kB : int taupreload_main(int, char **, char **)
         1  3.867E+05  3.867E+05  3.867E+05          0  status:VmSize kB
         1  3.867E+05  3.867E+05  3.867E+05          0  status:VmSize kB : int taupreload_main(int, char **, char **)
         1        140        140        140          0  status:VmStk kB
         1        140        140        140          0  status:VmStk kB : int taupreload_main(int, char **, char **)
         1          0          0          0          0  status:VmSwap kB
         1          0          0          0          0  status:VmSwap kB : int taupreload_main(int, char **, char **)
         1          0          0          0          0  status:nonvoluntary_ctxt_switches
         1          0          0          0          0  status:nonvoluntary_ctxt_switches : int taupreload_main(int, char **, char **)
         1          9          9          9          0  status:voluntary_ctxt_switches
         1          9          9          9          0  status:voluntary_ctxt_switches : int taupreload_main(int, char **, char **)
---------------------------------------------------------------------------------------

NODE 0;CONTEXT 0;THREAD 1:
---------------------------------------------------------------------------------------
%Time    Exclusive    Inclusive       #Call      #Subrs  Inclusive Name
              msec   total msec                          usec/call
---------------------------------------------------------------------------------------
100.0            5          826           1           1     826213 .TAU application
 99.4          821          821           1           0     821141 proc_data_reader::read_proc

NODE 0;CONTEXT 0;THREAD 2:
---------------------------------------------------------------------------------------
%Time    Exclusive    Inclusive       #Call      #Subrs  Inclusive Name
              msec   total msec                          usec/call
---------------------------------------------------------------------------------------
100.0        0.037          814           1           1     814274 .TAU application
100.0          814          814           1           0     814237 OpenMP_Thread_Type_ompt_thread_worker

NODE 0;CONTEXT 0;THREAD 3:
---------------------------------------------------------------------------------------
%Time    Exclusive    Inclusive       #Call      #Subrs  Inclusive Name
              msec   total msec                          usec/call
---------------------------------------------------------------------------------------
100.0        0.018          812           1           1     812423 .TAU application
100.0          812          812           1           0     812405 OpenMP_Thread_Type_ompt_thread_worker

NODE 0;CONTEXT 0;THREAD 4:
---------------------------------------------------------------------------------------
%Time    Exclusive    Inclusive       #Call      #Subrs  Inclusive Name
              msec   total msec                          usec/call
---------------------------------------------------------------------------------------
100.0        0.026          810           1           1     810509 .TAU application
100.0          810          810           1           0     810483 OpenMP_Thread_Type_ompt_thread_worker

FUNCTION SUMMARY (total):
---------------------------------------------------------------------------------------
%Time    Exclusive    Inclusive       #Call      #Subrs  Inclusive Name
              msec   total msec                          usec/call
---------------------------------------------------------------------------------------
100.0           22        4,108           5           5     821751 .TAU application
 59.3        2,437        2,437           3           0     812375 OpenMP_Thread_Type_ompt_thread_worker
 20.2            8          828           1           1     828075 int taupreload_main(int, char **, char **)
 20.0          821          821           1           0     821141 proc_data_reader::read_proc
 19.9            9          819           1           6     819635 int apex_preload_main(int, char **, char **)
 16.8          689          689           1           0     689406 OpenMP_Parallel_Region true_sharing(double*, double*)
  1.5           60           60           1           0      60682 OpenMP_Parallel_Region openmp_reduction(double*, double*)
  1.1           44           44           2           0      22308 OpenMP_Parallel_Region main
  0.2            8            8           1           0       8053 OpenMP_Parallel_Region false_sharing(double*, double*)
  0.2            7            7           1           0       7725 OpenMP_Parallel_Region no_sharing(double*, double*)

FUNCTION SUMMARY (mean):
---------------------------------------------------------------------------------------
%Time    Exclusive    Inclusive       #Call      #Subrs  Inclusive Name
              msec   total msec                          usec/call
---------------------------------------------------------------------------------------
100.0            4          821           1           1     821751 .TAU application
 59.3          487          487         0.6           0     812375 OpenMP_Thread_Type_ompt_thread_worker
 20.2            1          165         0.2         0.2     828075 int taupreload_main(int, char **, char **)
 20.0          164          164         0.2           0     821141 proc_data_reader::read_proc
 19.9            1          163         0.2         1.2     819635 int apex_preload_main(int, char **, char **)
 16.8          137          137         0.2           0     689406 OpenMP_Parallel_Region true_sharing(double*, double*)
  1.5           12           12         0.2           0      60682 OpenMP_Parallel_Region openmp_reduction(double*, double*)
  1.1            8            8         0.4           0      22308 OpenMP_Parallel_Region main
  0.2            1            1         0.2           0       8053 OpenMP_Parallel_Region false_sharing(double*, double*)
  0.2            1            1         0.2           0       7725 OpenMP_Parallel_Region no_sharing(double*, double*)


# With independent APEX installation
If you already have an APEX installation, you need to enable APEX and also provide the path
 to the apex library.

As an example:
$ APEX_TAU=1 tau_exec -T serial -loadlib=/home/users/jalcaraz/apex/lib/libapex.so ./openmp_test
