Vulpes  0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
Loading...
Searching...
No Matches
Compile options

Background

This page explains the main compile options you should know while developing. Depending on your aims, you should use (a combination) of different options.

Day to day

If you are developing the library, you should pass most of you time in Debug mode, namely you should add to the cmake command

-DCMAKE_BUILD_TYPE=Debug

If you are developing serial code, it is highly suggested to use a memory sanitizer, which depending on you preferences could be the GNU debugger or Asan. In case of doubts, prefer the second. It is activated by adding the flag

-DAsan=ON

WARNING: this flag conflict with MPI, so if you are developing parallel code you should not use it.

For static analysis purposed, you may need to add the flag

-DCMAKE_EXPORT_COMPILE_COMMANDS=ON

Profiling

To profile code and to maximize performance, test in Release mode

-DCMAKE_BUILD_TYPE=Release

You can also add the aggressive option

-DNative=ON

to compile exploiting the architecture of your CPU. To profile code you can use either:

  • Valgrind. This incurs in heavy overheads but gives you precise reports.
    valgrind --tool=callgrind ./<exec>
  • The Profile class in utils. You can profile the call of a function using the PROFILE macro. This requires manual intervention to the code and that the flag NPROFILE is not defined.

To compile the profiler out, so that its timers become empty functions, add

-DNProfile=ON

which defines NPROFILE.

Where to work?

If you want to test your code you can either add an example or a test in the respective folders. The former has no dependence on Google Test, so its more light-weight but is not a way to test your code. NOTE: all code in the library should be tested. If you want to check the test coverage, add the compile option

-DCoverage=ON

Check the compile commands

To show the complete commands that a Makefile generated by CMake is running (i.e., to see the full compiler and linker commands), you can use the VERBOSE=1 flag when invoking make.

make VERBOSE=1