|
| 1 | +.. |
| 2 | + # Copyright 2021 Lawrence Livermore National Security, LLC and other |
| 3 | + # PerfFlowAspect Project Developers. See the top-level LICENSE file for |
| 4 | + # details. |
| 5 | + # |
| 6 | + # SPDX-License-Identifier: LGPL-3.0 |
| 7 | +
|
| 8 | +##################### |
| 9 | + Caliper Integration |
| 10 | +##################### |
| 11 | + |
| 12 | +PerfFlowAspect can be built with Caliper to leverage collection of additional |
| 13 | +performance data, such as hardware performance counters on CPUs and GPU |
| 14 | +measurements on NVIDIA GPUs. `Caliper <https://github.com/llnl/caliper>`_ is an |
| 15 | +instrumentation and performance annotation library. |
| 16 | + |
| 17 | +PerfFlowAspect supports the Caliper integration for both C/C++ and Python |
| 18 | +codebases. This enables a single PerfFlowAspect annotation to generate both |
| 19 | +`.pfw` trace files and `.cali` files, so users do not need any additional |
| 20 | +annotations to obtain Caliper data. |
| 21 | + |
| 22 | +A Caliper install is required before building PerfFlowAspect in this case. |
| 23 | +Caliper can be configured at runtime, as shown in examples below. |
| 24 | + |
| 25 | +************* |
| 26 | + C/C++ Build |
| 27 | +************* |
| 28 | + |
| 29 | +Caliper needs to be is built with the same `clang` compiler chain as |
| 30 | +PerfFlowAspect. These can be specified with the `-DCMAKE_C_COMPILER` and |
| 31 | +`-DCMAKE_CXX_COMPILER`. |
| 32 | + |
| 33 | +.. code:: bash |
| 34 | +
|
| 35 | + cmake -DCMAKE_C_COMPILER=<path-to-clang18-compiler> \ |
| 36 | + -DCMAKE_C_COMPILER=<path-to-clang18++-compiler> \ |
| 37 | + -DWITH_PYTHON_BINDINGS=On \ |
| 38 | + -Dcaliper_DIR=<path-to-install>/share/lib/caliper ../ |
| 39 | +
|
| 40 | +*************** |
| 41 | + C/C++ Example |
| 42 | +*************** |
| 43 | + |
| 44 | +.. code:: bash |
| 45 | +
|
| 46 | + CALI_CONFIG=runtime-report ./smoketest |
| 47 | + CALI_CONFIG=runtime-report,output=test.cali ./smoketest |
| 48 | +
|
| 49 | +.. code:: bash |
| 50 | +
|
| 51 | + Path Min time/rank Max time/rank Avg time/rank Time % |
| 52 | + _Z3fooRKSs 0.004527 0.004527 0.004527 45.778137 |
| 53 | + _Z3barv 0.004511 0.004511 0.004511 45.616341 |
| 54 | + _Z3basv 0.000079 0.000079 0.000079 0.798867 |
| 55 | +
|
| 56 | +.. code:: bash |
| 57 | +
|
| 58 | + CALI_PAPI_COUNTERS=PAPI_TOT_CYC,PAPI_L2_DCM CALI_SERVICES_ENABLE=event,trace,papi,report ./smoketest |
| 59 | +
|
| 60 | +.. code:: bash |
| 61 | +
|
| 62 | + event.begin#annotation papi.PAPI_TOT_CYC papi.PAPI_L2_DCM annotation region.count event.end#annotation |
| 63 | + _Z3fooRKSs 118289 679 |
| 64 | + _Z3barv 200050 765 _Z3fooRKSs |
| 65 | + _Z3basv 115098 352 _Z3fooRKSs/_Z3barv |
| 66 | + 66564 242 _Z3fooRKSs/_Z3barv/_Z3basv 1 _Z3basv |
| 67 | + 117061 385 _Z3fooRKSs/_Z3barv 1 _Z3barv |
| 68 | + 93592 206 _Z3fooRKSs 1 _Z3fooRKSs |
| 69 | + _Z3fooRKSs 146308 332 |
| 70 | + _Z3barv 87811 255 _Z3fooRKSs |
| 71 | + _Z3basv 84904 244 _Z3fooRKSs/_Z3barv |
| 72 | + 34547 66 _Z3fooRKSs/_Z3barv/_Z3basv 1 _Z3basv |
| 73 | + 82540 168 _Z3fooRKSs/_Z3barv 1 _Z3barv |
| 74 | + 80711 144 _Z3fooRKSs 1 _Z3fooRKSs |
| 75 | + _Z3fooRKSs 127765 183 |
| 76 | + _Z3barv 85440 241 _Z3fooRKSs |
| 77 | + _Z3basv 82100 250 _Z3fooRKSs/_Z3barv |
| 78 | + 33969 67 _Z3fooRKSs/_Z3barv/_Z3basv 1 _Z3basv |
| 79 | + 81511 161 _Z3fooRKSs/_Z3barv 1 _Z3barv |
| 80 | + 77498 128 _Z3fooRKSs 1 _Z3fooRKSs |
| 81 | + _Z3fooRKSs 119853 164 |
| 82 | + _Z3barv 83285 227 _Z3fooRKSs |
| 83 | + _Z3basv 82702 297 _Z3fooRKSs/_Z3barv |
| 84 | + 34170 78 _Z3fooRKSs/_Z3barv/_Z3basv 1 _Z3basv |
| 85 | + 81589 149 _Z3fooRKSs/_Z3barv 1 _Z3barv |
| 86 | + 78920 119 _Z3fooRKSs 1 _Z3fooRKSs |
| 87 | +
|
| 88 | +.. code:: bash |
| 89 | +
|
| 90 | + PERFFLOW_OPTIONS='cpu-mem-usage=True:log-event=compact' CALI_CONFIG="load(time_exclusive.json),spot" ./smoketest |
| 91 | +
|
| 92 | +.. code:: bash |
| 93 | +
|
| 94 | + Path Min time/rank Max time/rank Avg time/rank Total time spot.channel |
| 95 | + _Z3fooRKSs 0.018068 0.018068 0.018068 0.018068 regionprofile |
| 96 | + _Z3barv 0.009124 0.009124 0.009124 0.009124 regionprofile |
| 97 | + _Z3basv 0.000074 0.000074 0.000074 0.000074 regionprofile |
| 98 | +
|
| 99 | +**************** |
| 100 | + Python Example |
| 101 | +**************** |
| 102 | + |
| 103 | +For Python applications, Caliper can be enabled by setting the `caliper-enable` |
| 104 | +option. In this case, `PYTHONPATH` needs to be set to include the `pycaliper` |
| 105 | +package from Caliper installation. |
| 106 | + |
| 107 | +.. code:: bash |
| 108 | +
|
| 109 | + export PYTHONPATH=<path-to-caliper-install>/lib/python<X.Y>/site-packages |
| 110 | + PERFFLOW_OPTIONS="caliper-enable=True" CALI_CONFIG=runtime-report ./smoketest.py |
| 111 | +
|
| 112 | + Inside main |
| 113 | + foo |
| 114 | + bar |
| 115 | + bas |
| 116 | + foo |
| 117 | + bar |
| 118 | + bas |
| 119 | + foo |
| 120 | + bar |
| 121 | + bas |
| 122 | + foo |
| 123 | + bar |
| 124 | + bas |
| 125 | + Path Time (E) Time (I) Time % (E) Time % (I) |
| 126 | + <function foo at 0x155546a24540> 0.004692 0.009423 47.547246 95.486397 |
| 127 | + <function bar at 0x155546a24400> 0.004659 0.004731 47.213609 47.939151 |
| 128 | + <function bas at 0x15554732de40> 0.000072 0.000072 0.725542 0.725542 |
0 commit comments