Skip to content

Commit

Permalink
Fix FP flags for NVHPC and add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tom91136 committed Aug 25, 2024
1 parent d012cbc commit 1c195f8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ endif ()

# setup some defaults flags for everything
set(DEFAULT_DEBUG_FLAGS -O2)
set(DEFAULT_RELEASE_FLAGS -O3 -march=native -ffast-math)
set(DEFAULT_RELEASE_FLAGS -O3
$<$<OR:$<CXX_COMPILER_ID:NVHPC>,$<CXX_COMPILER_ID:PGI>>:-fast>
$<$<AND:$<NOT:$<CXX_COMPILER_ID:NVHPC>>,$<NOT:$<CXX_COMPILER_ID:PGI>>>:-ffast-math>
)

macro(hint_flag FLAG DESCRIPTION)
if (NOT DEFINED ${FLAG})
Expand Down Expand Up @@ -283,7 +286,7 @@ if ((CMAKE_GENERATOR MATCHES "Unix Makefiles") OR (CMAKE_GENERATOR MATCHES "Ninj
-DSRC_DIR_PREFIX="${CMAKE_SOURCE_DIR}/src"
-DOUT_DIR_PREFIX="CMakeFiles/${EXE_NAME}.dir"
-P ${CMAKE_SOURCE_DIR}/cmake/extract_compile_command.cmake
)
)
add_dependencies(${EXE_NAME} extract_compile_commands)
else ()
set(COMPILE_COMMANDS COMPILE_FLAGS)
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ $ cd miniBUDE

# configure the build, build type defaults to Release
# The -DMODEL flag is required
$ cmake -Bbuild -H. -DMODEL=<model> <model specific flags prefixed with -D...>
$ cmake -Bbuild -H. -DMODEL=<model> -DCXX_EXTRA_FLAGS=-march=native <more model specific flags prefixed with -D...>

# compile
$ cmake --build build
Expand All @@ -54,6 +54,13 @@ The source for each model's implementations are located in `./src/<model>`.

Currently available models are:

**For optional benchmark performance, please set `-DCXX_EXTRA_FLAGS=-march=native` or
equivalent. `-march=native` is no longer added by default to prevent bad arch selection on ARM
platforms.**

**This benchmark should be compiled with relaxed FP rules (e.g. `-O3 -ffast-math` or `-Ofast`); a
suitable flags will set automatically if compiling with GCC/Clang and NVHPC.**

```
omp;ocl;std-indices;std-ranges;hip;cuda;kokkos;sycl;acc;raja;tbb;thrust
```
Expand Down

0 comments on commit 1c195f8

Please sign in to comment.