Skip to content

Commit

Permalink
CMake: overhaul options (AMReX-Codes#1490)
Browse files Browse the repository at this point in the history
* Doc: move ENABLE_CUDA_FASTMATH to the GPU options section

* CMake: change all options to include AMReX_ namespace

* CMake: remove ENABLE_ACC option

* CMake: make AMReX_SPACEDIM a multi-valued string

* Doc: add option AMReX_ENABLE_TESTS

* CMake: rename AMReX_Options.cmake to AMReXOptions.cmake

* CMake: refactor GPU-related options

* CMake: MPI must be turned off if DPCPP is enabled

* CMake: set via precision via selection of value

* CMake: forgot to update Particles/CMakeLists.txt

* CMake: append prefix to TL_PROFILE

* Update Docs/sphinx_documentation/source/AMReX_Profiling_Tools.rst

Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>

* Update Docs/sphinx_documentation/source/AMReX_Profiling_Tools.rst

Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>

* Update Docs/sphinx_documentation/source/BuildingAMReX.rst

Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>

* CMake: components in Config file shall not have namespace prefix

* Revert "CMake: components in Config file shall not have namespace prefix"

This reverts commit 924cf15.

* Update Tools/CMake/AMReX_SetupCUDA.cmake

Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>

* CMake: update Doc

* Update Tools/CMake/AMReX_SetupCUDA.cmake

Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>

Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
  • Loading branch information
mic84 and ax3l authored Nov 5, 2020
1 parent 22e6f93 commit 86c6b3d
Show file tree
Hide file tree
Showing 68 changed files with 811 additions and 770 deletions.
50 changes: 25 additions & 25 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ jobs:
cmake .. \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_INSTALL_PREFIX=/tmp/my-amrex \
-DENABLE_MPI=OFF \
-DENABLE_PARTICLES=ON \
-DENABLE_DP=OFF \
-DENABLE_DP_PARTICLES=OFF \
-DCMAKE_CXX_STANDARD=14 \
-DCMAKE_INSTALL_PREFIX=/tmp/my-amrex \
-DAMReX_MPI=OFF \
-DAMReX_PARTICLES=ON \
-DAMReX_PRECISION=SINGLE \
-DAMReX_PARTICLES_PRECISION=SINGLE \
-DCMAKE_CXX_STANDARD=14 \
-DCMAKE_C_COMPILER=$(which clang) \
-DCMAKE_CXX_COMPILER=$(which clang++) \
-DCMAKE_Fortran_COMPILER=$(which gfortran)
Expand All @@ -67,7 +67,7 @@ jobs:
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DAMReX_BUILD_TUTORIALS=ON \
-DENABLE_PARTICLES=ON
-DAMReX_PARTICLES=ON
make -j 2
# Build libamrex and all tutorials
Expand All @@ -87,7 +87,7 @@ jobs:
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DAMReX_BUILD_TUTORIALS=ON \
-DENABLE_PARTICLES=ON \
-DAMReX_PARTICLES=ON \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_C_COMPILER=$(which gcc-10) \
-DCMAKE_CXX_COMPILER=$(which g++-10) \
Expand All @@ -111,8 +111,8 @@ jobs:
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DAMReX_BUILD_TUTORIALS=ON \
-DENABLE_MPI=OFF \
-DENABLE_PARTICLES=ON
-DAMReX_MPI=OFF \
-DAMReX_PARTICLES=ON
make -j 2
# Build libamrex and all tutorials
Expand All @@ -132,8 +132,8 @@ jobs:
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DAMReX_BUILD_TUTORIALS=ON \
-DENABLE_PARTICLES=ON \
-DENABLE_FORTRAN=OFF \
-DAMReX_PARTICLES=ON \
-DAMReX_FORTRAN=OFF \
-DCMAKE_CXX_STANDARD=11
make -j 2
Expand All @@ -152,13 +152,13 @@ jobs:
cmake .. \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DAMReX_BUILD_TUTORIALS=ON \
-DENABLE_PARTICLES=ON \
-DENABLE_CUDA=ON \
-DAMReX_PARTICLES=ON \
-DAMReX_GPU_BACKEND=CUDA \
-DCMAKE_C_COMPILER=$(which gcc-4.8) \
-DCMAKE_CXX_COMPILER=$(which g++-4.8) \
-DCMAKE_CUDA_HOST_COMPILER=$(which g++-4.8) \
-DCMAKE_Fortran_COMPILER=$(which gfortran-4.8) \
-DCUDA_ARCH=6.0
-DAMReX_CUDA_ARCH=6.0
make -j 2
tutorials-dpcpp:
Expand All @@ -178,12 +178,12 @@ jobs:
cmake .. \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DAMReX_BUILD_TUTORIALS=ON \
-DENABLE_PARTICLES=ON \
-DENABLE_DPCPP=ON \
-DAMReX_PARTICLES=ON \
-DAMReX_GPU_BACKEND=SYCL \
-DCMAKE_C_COMPILER=$(which clang) \
-DCMAKE_CXX_COMPILER=$(which dpcpp) \
-DCMAKE_Fortran_COMPILER=$(which gfortran)
make -j 2
make -j 2
tutorials-hip:
name: HIP ROCm@3.8 GFortran@9.3 C++17 [tutorials]
Expand All @@ -201,11 +201,11 @@ jobs:
cmake .. \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DAMReX_BUILD_TUTORIALS=ON \
-DENABLE_PARTICLES=ON \
-DENABLE_FORTRAN=ON \
-DENABLE_LINEAR_SOLVERS=ON \
-DENABLE_HIP=ON \
-DAMD_ARCH=gfx900 \
-DAMReX_PARTICLES=ON \
-DAMReX_FORTRAN=ON \
-DAMReX_LINEAR_SOLVERS=ON \
-DAMReX_GPU_BACKEND=HIP \
-DAMReX_AMD_ARCH=gfx900 \
-DCMAKE_C_COMPILER=$(which hipcc) \
-DCMAKE_CXX_COMPILER=$(which hipcc) \
-DCMAKE_Fortran_COMPILER=$(which gfortran)
Expand Down Expand Up @@ -281,10 +281,10 @@ jobs:
mkdir build
cd build
cmake .. \
-DENABLE_OMP=ON \
-DAMReX_OMP=ON \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DAMReX_ENABLE_TESTS=ON \
-DENABLE_PARTICLES=ON
-DAMReX_PARTICLES=ON
make -j 2
- name: Run tests
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ jobs:
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DAMReX_BUILD_TUTORIALS=ON \
-DENABLE_PARTICLES=ON
-DAMReX_PARTICLES=ON
make -j 2
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=ON -DAMReX_BUILD_TUTORIALS=ON -DENABLE_FORTRAN=OFF -DENABLE_MPI=OFF
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=ON -DAMReX_BUILD_TUTORIALS=ON -DAMReX_FORTRAN=OFF -DAMReX_MPI=OFF
cmake --build . --config Debug
2 changes: 1 addition & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@

-- Add CUPTI trace for CUDA kernel timing.

-- Implement ENABLE_FORTRAN (BL_NO_FORT) option in CMake.
-- Implement AMReX_FORTRAN (BL_NO_FORT) option in CMake.

-- Fix CUDA build of tools.

Expand Down
25 changes: 5 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,6 @@ include( AMReX_Utils )
get_amrex_version()


#
# For the time being, set this option here.
# We must do this because we need to provide a default for CMAKE_CXX_COMPILER
#
option( ENABLE_DPCPP "Enable DPCPP support" OFF )
if (ENABLE_DPCPP)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
# Set default for CMAKE_CXX_COMPILER only if amrex
# is not a subproject
set(CMAKE_CXX_COMPILER dpcpp)
endif ()
message(STATUS "Enabling experimental support for dpc++")
endif ()


########################################################################
#
# AMReX project
Expand Down Expand Up @@ -80,19 +65,19 @@ endif()
#
# Include options, utilities and other stuff we need
#
include( AMReX_Options )
include( AMReXOptions )

#
# Enable Fortran if requested
#
if(ENABLE_FORTRAN)
if(AMReX_FORTRAN)
enable_language(Fortran)
endif ()

#
# Enable CUDA if requested
#
if (ENABLE_CUDA)
if (AMReX_CUDA)
# CMake 3.18+: CMAKE_CUDA_ARCHITECTURES
# https://cmake.org/cmake/help/latest/policy/CMP0104.html
if(POLICY CMP0104)
Expand Down Expand Up @@ -132,9 +117,9 @@ endif ()
#
# Plotfile tools
#
option(ENABLE_PLOTFILE_TOOLS "Enable Plotfile tools" NO)
option(AMReX_PLOTFILE_TOOLS "Enable Plotfile tools" NO)

if (ENABLE_PLOTFILE_TOOLS)
if (AMReX_PLOTFILE_TOOLS)
# If this get executed, it cannot be EXCLUDED_FROM_ALL
# because it needs to get installed
add_subdirectory(Tools/Plotfile)
Expand Down
7 changes: 3 additions & 4 deletions Docs/sphinx_documentation/source/AMReX_Profiling_Tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ in your GNUMakefile. If using cmake then set the following cmake flags

::

AMREX_ENABLE_TINY_PROFILE = ON
AMREX_ENABLE_BASE_PROFILE = OFF
AMReX_TINY_PROFILE = ON
AMReX_BASE_PROFILE = OFF

Note that if you set ``PROFILE = TRUE`` (or ``AMREX_ENABLE_BASE_PROFILE =
Note that if you set ``PROFILE = TRUE`` (or ``AMReX_BASE_PROFILE =
ON``) then this will override the ``TINY_PROFILE`` flag and tiny profiling will
be disabled.

Expand Down Expand Up @@ -245,4 +245,3 @@ parser itself. It has been integrated into Amrvis for visual interpretation of
the data allowing Amrvis to open the bl_prof database like a plotfile but with
interfaces appropriate to profiling data. AMRProfParser and Amrvis can be run
in parallel both interactively and in batch mode.

4 changes: 2 additions & 2 deletions Docs/sphinx_documentation/source/Basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2507,9 +2507,9 @@ overflow). The handling of seg fault, assertion errors and
interruption by control-C are enabled by default. Note that
``AMREX_ASSERT()`` is only on when compiled with ``DEBUG=TRUE`` or
``USE_ASSERTION=TRUE`` in GNU make, or with ``-DCMAKE_BUILD_TYPE=Debug`` or
``-DENABLE_ASSERTIONS=YES`` in CMake. The trapping of floating point exceptions is not
``-DAMReX_ASSERTIONS=YES`` in CMake. The trapping of floating point exceptions is not
enabled by default unless the code is compiled with ``DEBUG=TRUE`` in GNU make, or with
``-DCMAKE_BUILD_TYPE=Debug`` or ``-DENABLE_FPE=YES`` in CMake to turn on compiler flags
``-DCMAKE_BUILD_TYPE=Debug`` or ``-DAMReX_FPE=YES`` in CMake to turn on compiler flags
if supported. Alternatively, one can always use runtime parameters to control the
handling of floating point exceptions: ``amrex.fpe_trap_invalid`` for
NaNs, ``amrex.fpe_trap_zero`` for division by zero and
Expand Down
Loading

0 comments on commit 86c6b3d

Please sign in to comment.