Skip to content

Project Integration Examples

Jonathan R. Madsen edited this page Oct 28, 2020 · 1 revision

ASGarD Example

ASGarD is a PDE solver code, best detailed here.

Introduction

The first reason to integrate TiMemory to ASGarD is to study the impact of changing the floating point precision (double/single) on the application performance. The next step is to build a performance regression test suite.

A general rule of thumb(s) to integrate a project:

1. Set timemory_FIND_COMPONENTS_INTERFACE to a name specific to a project
2. Specify the components you absolutely need after COMPONENTS
3. Specify the components that are optional after OPTIONAL_COMPONENTS
4. Just use whatever target name you set to timemory_FIND_COMPONENTS_INTERFACE in all subsequent target_link_libraries(…) in your project

In this specific case

Note: It is recommended to compile timemory with same compiler vendor as the project it is integrated into. However, for compilers which use other compilers as their backend, e.g. older versions of Intel provide GCC compatibility and newer version use LLVM as the backend, it is fine to mix installations.

timemory is available on Cori with for Haswell and KNL and Cori-GPU (with module load cgpu):

  • timemory/3.0.1-gcc8-cuda-10.1-py36
  • timemory/haswell-develop-gcc-py37-mpich
  • timemory/cgpu-develop-gcc-py37-openmpi

Nevertheless, you can also compile timemory using the latest version available on github. In our case, we want to compile ASGarD with clang (PrgEnv-cray), so timemory should also be compiled with clang. Using cmake:

cmake -DCMAKE_INSTALL_PREFIX=/path/to/install/ -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTIMEMORY_USE_PAPI=OFF -DTIMEMORY_USE_CUDA=ON ..
make -j32
make install

See also: Installation Examples

Integrating timemory in ASGarD cmake

Applying the rule of thumb(s):

set(timemory_FIND_COMPONENTS_INTERFACE timemory-asgard)     # Rule of thumb #1
find_package(timemory REQUIRED 
    COMPONENTS cxx shared cuda                              # Rule of thumb #2
    OPTIONAL_COMPONENTS gotcha)                             # Rule of thumb #3
target_link_libraries(lib_dispatch PRIVATE timemory-asgard) # Rule of thumb #4
target_link_libraries(asgard PRIVATE timemory-asgard)       # Rule of thumb #4