Skip to content

Commit

Permalink
Add CMake option: AMReX_CUDA_OBJDIR_AS_TEMPDIR (#4246)
Browse files Browse the repository at this point in the history
See issue #4245
  • Loading branch information
timrlaw authored Nov 25, 2024
1 parent 1c8b545 commit 4a3a5ff
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Docs/sphinx_documentation/source/GPU.rst
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ check the :ref:`table <tab:cmakecudavar>` below.
+------------------------------+-------------------------------------------------+-------------+-----------------+
| AMReX_CUDA_KEEP_FILES | Keep intermediately files (folder: nvcc_tmp) | NO | YES, NO |
+------------------------------+-------------------------------------------------+-------------+-----------------+
| AMReX_CUDA_OBJDIR_AS_TEMPDIR | Place intermediate files in object file folder | NO | YES, NO |
+------------------------------+-------------------------------------------------+-------------+-----------------+
| AMReX_CUDA_LTO | Enable CUDA link-time-optimization | NO | YES, NO |
+------------------------------+-------------------------------------------------+-------------+-----------------+
| AMReX_CUDA_MAXREGCOUNT | Limits the number of CUDA registers available | 255 | User-defined |
Expand Down
3 changes: 3 additions & 0 deletions Tools/CMake/AMReXCUDAOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ cuda_print_option(AMReX_CUDA_BACKTRACE)

option(AMReX_CUDA_KEEP_FILES "Keep intermediately generated files (folder: nvcc_tmp)" OFF)
cuda_print_option(AMReX_CUDA_KEEP_FILES)

option(AMReX_CUDA_OBJDIR_AS_TEMPDIR "Place intermediate files in object file folder" OFF)
cuda_print_option(AMReX_CUDA_OBJDIR_AS_TEMPDIR)
5 changes: 5 additions & 0 deletions Tools/CMake/AMReXParallelBackends.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ if ( AMReX_GPU_BACKEND STREQUAL "CUDA"
list(APPEND _cuda_flags --keep "SHELL:--keep-dir ${PROJECT_BINARY_DIR}/nvcc_tmp")
endif ()

# place intermediate files in object file folder
if (AMReX_CUDA_OBJDIR_AS_TEMPDIR)
list(APPEND _cuda_flags --objdir-as-tempdir)
endif ()

# compilation timings
if (AMReX_CUDA_COMPILATION_TIMER)
file(REMOVE "${PROJECT_BINARY_DIR}/nvcc_timings.csv")
Expand Down
5 changes: 5 additions & 0 deletions Tools/CMake/AMReX_SetupCUDA.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ if (AMReX_CUDA_KEEP_FILES)
string(APPEND CMAKE_CUDA_FLAGS " --keep --keep-dir ${PROJECT_BINARY_DIR}/nvcc_tmp")
endif ()

# place intermediate files in object file folder
if (AMReX_CUDA_OBJDIR_AS_TEMPDIR)
string(APPEND CMAKE_CUDA_FLAGS " --objdir-as-tempdir")
endif ()

# compilation timings
if (AMReX_CUDA_COMPILATION_TIMER)
file(REMOVE "${PROJECT_BINARY_DIR}/nvcc_timings.csv")
Expand Down

0 comments on commit 4a3a5ff

Please sign in to comment.