I wrote the article about using Pause/Resume API from Intel® VTune™ Amplifier XE in C/C++ and Fortran code. With using my simple example, the user can control sampling data collection in their code.
Some users are not sure if they can use Pause/Resume API in MPI program. Actually it should work because we write same Pause/Resume API in code which ran in different process. Those APIs will run in different memory space, and don’t interact among.
Here is a simple example named mpi_pi.c (see attached) – which is a MPI program to work on one node, it calculates PI in many processes (in this example, we only collect performance data during PI calculating) then do reduction to get final result. Below are detail the steps to build & use Intel® VTune™ Amplifier to analyzer.
1. Prepare running environment.
# source /opt/intel/compilers_and_libraries/linux/bin/compilervars.sh intel64
# source /opt/intel/impi/<version>/intel64/bin/mpivars.sh
# source /opt/intel/vtune_amplifier_<version>/amplxe-vars.sh
2. Compile MPI program
# mpiicc -g mpi_pi.c -I$VTUNE_AMPLIFIER_2019_DIR/include $VTUNE_AMPLIFIER_2019_DIR/lib64/libittnotify.a -o mpi_pi
3. Run VTune Amplifier XE
# mpirun -n 16 amplxe-cl -collect hotspots -start-paused -r results -- ./mpi_pi
4. Observe result
However if the user does “mpirun -n 16 amplxe-cl -collect advanced-hotspots -start-paused -r result -- ./mpi_pi”, it will cause unexpected result. Why? The reason is that Resume/Pause API should communicate with vtune drivers (hardware PMU Event-based sampling mode) but different process will send many requests of pause or resume which will confused vtune drivers (my test environment is not cluster system). Since Hotspots is user-mode data collection which is to use OS timers – which are different in many processes, the results are expected.
Product and Performance Information
Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.