Skip to content

Download and Compile

MeisterEule edited this page Jan 23, 2023 · 17 revisions

Download Vftrace

Vftrace is freely available on GitHub and can easily be cloned. Third party tools are included via the submodule system

git clone --recursive https://github.com/SX-Aurora/Vftrace.git

An already cloned repository without the third party tools can obtain them with

git submodule update --init

Alternatively you can download a fixed release here.

Compile Vftrace

Vftrace uses autotools and automake as a build system.

Prepare Source Directory

The first step is to prepare the source folder is autoreconf it:

$ autoreconf -if
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
configure.ac:15: installing './ar-lib'
configure.ac:9: installing './compile'
configure.ac:19: installing './config.guess'
configure.ac:19: installing './config.sub'
configure.ac:8: installing './install-sh'
configure.ac:8: installing './missing'
parallel-tests: installing './test-driver'

Configure Build Directory

The second step is to configure your build folder:

$ <path-to-vftrace-source>/configure \
   --prefix=<install-path> \
   CC=<c-compiler> \
   FC=<fortran-compiler> \
   CXX=<c++-compiler>

The --help flag gives more available options. The most important options are:

  • --prefix=<install-path>: Path where Vftrace will be installed to. The subfolders lib, include, bin, shared will be automatically created.
  • --enable-fortran: Build Fortran interfaces for user functions, and Fortran MPI-wrappers, if MPI is enabled.
  • --enable-fortran08: Build Fortran08 MPI-wrappers, if MPI is enabled.
  • --enable-mpi: Build MPI-Wrappers and Vftrace code sections to profile MPI-parallel codes. If fortran and fortran08 are enabled the corresponding MPI-wrappers will be build as well.
  • --enable-openmp: Builds Vftrace code sections to profile OpenMP parallelized codes. (This is currently disabled. Although compilers that support the required OMP-5.x callback system, to our knowledge all of them are broken and not able to properly profile applications.)
  • --enable-dynlib-tracing: Enable tracing of library functions loaded with dlopen. This option conflicts with --with-cupti.
  • --enable-self-profiling: Enable self-profiling of Vftrace. Only for Vftrace-developers.
  • --with-cupti=<cupti-path>: Enable CUDA or OpenCL profiling.
  • --with-liberty=<liberty-path>: Enable demangling of c++ symbols to make them less cryptic and more human readable.
  • CC: C-compiler to be used. If --enable-mpi is given, CC needs to be given the MPI-Compiler (e.g. mpicc)
  • FC: Fortran-compiler to be used. If --enable-mpi is given, FC needs to be given the MPI-Compiler (e.g. mpif90)

Build Vftrace

After a successful configure Vftrace can be compiled:

make -j <nprocs>

If fortran is enabled the -j <nprocs> needs to be omitted to build in serial, due to fortran module dependencies that cannot be resolved by autotools.

Test Vftrace

Vftrace comes with an extensive test suite in order to check whether it was compiled correctly.

make -j <nprocs> check

Note that some (MPI-)tests might fail, not necessarily because of Vftrace not being compiled correctly, but due to non-standard compliant or buggy compilers/MPIs.

Install Vftrace

Vftrace can be installed to the provided --prefix path with: make install The install directory contains four subfolders:

  • bin: Contains programs and tools for Vftrace.
    • vftrace_diff_profiles:
    • vftrace_vfd_dump: Converts binary vfd-files from sampling into a human-readable timeline of events.
    • vftrace_check_config: Checks a config file for compatibility with vftrace and errors.
    • vftrace_generate_default_config: Gives a complete config file with default options.
  • include: Include files for user functions.
    • vftrace.h: C/C++-header.
    • vftrace.mod: Fortran module file.
  • lib:
    • libvftrace.a: Static Vftrace library.
    • livftrace.so: Dynamic Vftrace library.
    • libvftrace.la: Libtool library file for libvftrace.
  • share/man/man1/: Contains the manpages.
    • vftrace_generate_default_config.1: Explains the usage of vftrace_generate_default_config.
    • vftrace_check_config.1: Explains the usage of vftrace_check_config.
    • vftrace.1: Explains the usage and control of libvftrace.

Known Issues

  • For some compilers the installation step has been observed to fail with an error message like this
/usr/bin/ld: cannot find -l-L/opt/gcc-9.2/lib/gcc/x86_64-pc-linux-gnu/9.2.0

This is due to the fact that libtool parses a list of libraries from the output of e.g. gcc -v test.c. Therein, some compilers insert, for same libraries, a space between the -l keyword and the library name, e.g. -l foo instead of -lfoo. Libtool does not (yet) take care of this space, which leads to the flawed linker command above. To work around this issue, you can remove the corrupt lines from the libtool file via

sed -i 's/-l -l//' libtool

and execute make install again.

  • When building a shared library on SX Aurora, libtool might fail to install that library due to the following issues:
nfort: Warning: unrecognized option '--whole-archive'
nfort: Warning: unrecognized option '--no-whole-archive'
nfort: Warning: unrecognized option '-rpath'
nfort: Warning: unrecognized option '-rpath'
nfort: Warning: unrecognized option '-soname'

This can be circumvented by the following replacement:

sed -i -e 's/^wl=""/wl="-Wl,"/' -e 's/^pic_flag=""/pic_flag=" -fPIC"/' libtool