From 0c23465aa2eaeaacc6b1bcbb23f317bc283e8c92 Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Mon, 4 Mar 2024 15:52:14 -0600 Subject: [PATCH] prefixing all options with micm_ (#413) * prefixing all options with micm_ * correcting target compile options * namespacing compile option * prefixing gpu arch with micm --- .devcontainer/devcontainer.json | 2 +- CMakeLists.txt | 46 +++++++++---------- cmake/StaticAnalyzers.cmake | 2 +- cmake/dependencies.cmake | 16 +++---- cmake/test_util.cmake | 8 ++-- docker/Dockerfile | 2 +- docker/Dockerfile.coverage | 10 ++-- docker/Dockerfile.docs | 2 +- docker/Dockerfile.llvm | 6 +-- docker/Dockerfile.memcheck | 4 +- docker/Dockerfile.mpi | 4 +- docker/Dockerfile.nvhpc | 4 +- docker/Dockerfile.openmp | 6 +-- docker/Dockerfile.publish | 4 +- docs/source/contributing/index.rst | 6 +-- docs/source/getting_started.rst | 6 +-- docs/source/user_guide/index.rst | 2 +- include/micm/process/jit_process_set.hpp | 2 +- include/micm/solver/jit_lu_decomposition.hpp | 2 +- include/micm/solver/jit_rosenbrock.hpp | 4 +- include/micm/util/cuda_vector_matrix.hpp | 2 +- .../util/sparse_matrix_vector_ordering.hpp | 4 +- include/micm/util/vector_matrix.hpp | 6 +-- packaging/CMakeLists.txt | 2 +- src/CMakeLists.txt | 40 ++++++++-------- src/process/CMakeLists.txt | 4 +- src/solver/CMakeLists.txt | 2 +- src/util/CMakeLists.txt | 2 +- test/integration/CMakeLists.txt | 2 +- .../RosenbrockChapman/CMakeLists.txt | 2 +- test/tutorial/CMakeLists.txt | 6 +-- test/unit/CMakeLists.txt | 6 +-- test/unit/openmp/CMakeLists.txt | 2 +- test/unit/process/CMakeLists.txt | 6 +-- test/unit/solver/CMakeLists.txt | 4 +- test/unit/util/CMakeLists.txt | 2 +- 36 files changed, 115 insertions(+), 115 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6f3312dcb..112a7a12f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,5 +6,5 @@ ], "settings": { }, - "postCreateCommand": "cd /workspaces/micm && mkdir build && cd build && cmake -D CMAKE_BUILD_TYPE=release -D ENABLE_CLANG_TIDY:BOOL=FALSE -D ENABLE_LLVM:BOOL=TRUE -D ENABLE_MEMCHECK:BOOL=TRUE .. && make install -j 2" + "postCreateCommand": "cd /workspaces/micm && mkdir build && cd build && cmake -D CMAKE_BUILD_TYPE=release -D MICM_ENABLE_LLVM:BOOL=TRUE -D MICM_ENABLE_MEMCHECK:BOOL=TRUE .. && make install -j 2" } diff --git a/CMakeLists.txt b/CMakeLists.txt index 4dea28c1b..71361cb2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,31 +27,29 @@ set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${PROJECT_SOURCE_DIR}/cmake") # Set up include and lib directories set(MICM_LIB_DIR "${PROJECT_BINARY_DIR}/lib") -option(ENABLE_CLANG_TIDY "Enable clang-tiday to format source code" OFF) -option(ENABLE_MPI "Enable MPI parallel support" OFF) -option(ENABLE_OPENMP "Enable OpenMP support" OFF) -option(ENABLE_COVERAGE "Enable code coverage output" OFF) -option(ENABLE_MEMCHECK "Enable memory checking in tests" OFF) -option(ENABLE_JSON "Enable json configureation file reading" ON) -option(BUILD_DOCS "Build the documentation" OFF) -option(ENABLE_CUDA "Build with Cuda support" OFF) -option(ENABLE_OPENACC "Build with OpenACC Support" OFF) -option(ENABLE_LLVM "Build with LLVM support for JIT-compiling" OFF) -option(ENABLE_TESTS "Build the tests" ON) -option(ENABLE_EXAMPLES "Build the examples" ON) -set(DEFAULT_VECTOR_MATRIX_SIZE "4" CACHE STRING "Default size for vectorizable matrix types") +option(MICM_ENABLE_CLANG_TIDY "Enable clang-tiday to format source code" OFF) +option(MICM_ENABLE_MPI "Enable MPI parallel support" OFF) +option(MICM_ENABLE_OPENMP "Enable OpenMP support" OFF) +option(MICM_ENABLE_COVERAGE "Enable code coverage output" OFF) +option(MICM_ENABLE_MEMCHECK "Enable memory checking in tests" OFF) +option(MICM_ENABLE_JSON "Enable json configureation file reading" ON) +option(MICM_BUILD_DOCS "Build the documentation" OFF) +option(MICM_ENABLE_CUDA "Build with Cuda support" OFF) +option(MICM_ENABLE_OPENACC "Build with OpenACC Support" OFF) +option(MICM_ENABLE_LLVM "Build with LLVM support for JIT-compiling" OFF) +option(MICM_ENABLE_TESTS "Build the tests" ON) +option(MICM_ENABLE_EXAMPLES "Build the examples" ON) +set(MICM_DEFAULT_VECTOR_MATRIX_SIZE "4" CACHE STRING "Default size for vectorizable matrix types") include(CMakeDependentOption) # Option to collect custom OpenACC flags -cmake_dependent_option(ENABLE_GPU_TYPE "Enable custom CUDA flags" OFF - "ENABLE_OPENACC OR ENABLE_CUDA" ON) +cmake_dependent_option(MICM_ENABLE_GPU_TYPE "Enable custom CUDA flags" OFF + "MICM_ENABLE_OPENACC OR MICM_ENABLE_CUDA" ON) -if(ENABLE_GPU_TYPE) - set(GPU_TYPE "" CACHE STRING "The GPU type being targeted") +if(MICM_ENABLE_GPU_TYPE) + set(MICM_GPU_TYPE "" CACHE STRING "The GPU type being targeted") endif() -add_compile_definitions(DEFAULT_VECTOR_SIZE=${DEFAULT_VECTOR_MATRIX_SIZE}) - # on ubuntu with clang, an incorrect version of the c++ standard library was being linked if (${CMAKE_HOST_SYSTEM_NAME} MATCHES "Linux" AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") # If the compiler is Clang, use libc++ @@ -68,16 +66,16 @@ include(cmake/dependencies.cmake) add_subdirectory(src) -if(BUILD_DOCS) +if(MICM_BUILD_DOCS) add_subdirectory(docs) endif() ################################################################################ # Tests -if(PROJECT_IS_TOP_LEVEL AND ENABLE_TESTS) +if(PROJECT_IS_TOP_LEVEL AND MICM_ENABLE_TESTS) # Test code coverage - if(ENABLE_COVERAGE) + if(MICM_ENABLE_COVERAGE) include(CodeCoverage) append_coverage_compiler_flags() setup_target_for_coverage_lcov( @@ -111,14 +109,14 @@ endif() ################################################################################ # Command-line driver examples -if(PROJECT_IS_TOP_LEVEL AND ENABLE_EXAMPLES AND ENABLE_JSON) +if(PROJECT_IS_TOP_LEVEL AND MICM_ENABLE_EXAMPLES AND MICM_ENABLE_JSON) add_subdirectory(examples) endif() ################################################################################ # Copy configuration data -if(PROJECT_IS_TOP_LEVEL AND (ENABLE_TESTS OR ENABLE_EXAMPLES)) +if(PROJECT_IS_TOP_LEVEL AND (MICM_ENABLE_TESTS OR MICM_ENABLE_EXAMPLES)) add_custom_target(copy_example_configs ALL ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/examples/configs ${CMAKE_BINARY_DIR}/examples/configs) endif() diff --git a/cmake/StaticAnalyzers.cmake b/cmake/StaticAnalyzers.cmake index e5c316328..982716130 100644 --- a/cmake/StaticAnalyzers.cmake +++ b/cmake/StaticAnalyzers.cmake @@ -1,6 +1,6 @@ # modified from https://github.com/filipdutescu/modern-cpp-template/blob/master/cmake/StaticAnalyzers.cmake -if(ENABLE_CLANG_TIDY) +if(MICM_ENABLE_CLANG_TIDY) find_program(CLANGTIDY clang-tidy) if(CLANGTIDY) set(CMAKE_CXX_CLANG_TIDY ${CLANGTIDY} -extra-arg=-Wno-unknown-warning-option) diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index 75cd0d00c..fab9056fd 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -3,7 +3,7 @@ include(FetchContent) ################################################################################ # Memory check -if(ENABLE_MEMCHECK) +if(MICM_ENABLE_MEMCHECK) find_file(MEMCHECK_SUPPRESS_FILE DOC "Suppression file for memory checking" NAMES openmpi-valgrind.supp @@ -22,7 +22,7 @@ endif() ################################################################################ # OpenMP -if(ENABLE_OPENMP) +if(MICM_ENABLE_OPENMP) if(APPLE) # Apple clang by default doesn't include support for openmp # but if omp was installed with `brew install libomp`, support can be configured @@ -65,7 +65,7 @@ endif() ################################################################################ # MPI -if(ENABLE_MPI) +if(MICM_ENABLE_MPI) find_package(MPI REQUIRED) message(STATUS "Compiling with MPI support") endif() @@ -94,7 +94,7 @@ endif() ################################################################################ # nlohmann::json -if(ENABLE_JSON) +if(MICM_ENABLE_JSON) FetchContent_Declare(json GIT_REPOSITORY https://github.com/nlohmann/json.git GIT_TAG v3.11.2 @@ -105,7 +105,7 @@ endif() ################################################################################ # Docs -if(BUILD_DOCS) +if(MICM_BUILD_DOCS) find_package(Doxygen REQUIRED) find_package(Sphinx REQUIRED) endif() @@ -113,12 +113,12 @@ endif() ################################################################################ # GPU Support -if(ENABLE_CUDA) +if(MICM_ENABLE_CUDA) find_package(CUDA REQUIRED) enable_language(CUDA) endif() -if(ENABLE_OPENACC) +if(MICM_ENABLE_OPENACC) find_package(OpenACC REQUIRED) endif() @@ -127,7 +127,7 @@ endif() # # TODO: Try to use fetch content for LLVM libraries -if(ENABLE_LLVM) +if(MICM_ENABLE_LLVM) find_package(LLVM REQUIRED CONFIG) if(LLVM_FOUND) message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") diff --git a/cmake/test_util.cmake b/cmake/test_util.cmake index 7571f439f..fabffb63e 100644 --- a/cmake/test_util.cmake +++ b/cmake/test_util.cmake @@ -1,7 +1,7 @@ ################################################################################ # Utility functions for creating tests -if(ENABLE_MEMCHECK) +if(MICM_ENABLE_MEMCHECK) find_program(MEMORYCHECK_COMMAND "valgrind") endif() @@ -37,7 +37,7 @@ endfunction(create_standard_test) # Add a test function(add_micm_test test_name test_binary test_args working_dir test_skip_memcheck) - if(ENABLE_MPI) + if(MICM_ENABLE_MPI) add_test(NAME ${test_name} COMMAND mpirun -v -np 2 ${CMAKE_BINARY_DIR}/${test_binary} ${test_args} WORKING_DIRECTORY ${working_dir}) @@ -49,11 +49,11 @@ function(add_micm_test test_name test_binary test_args working_dir test_skip_mem set(MEMORYCHECK_COMMAND_OPTIONS "--error-exitcode=1 --trace-children=yes --leak-check=full --gen-suppressions=all ${MEMCHECK_SUPPRESS}") set(memcheck "${MEMORYCHECK_COMMAND} ${MEMORYCHECK_COMMAND_OPTIONS}") separate_arguments(memcheck) - if(ENABLE_MPI AND MEMORYCHECK_COMMAND AND ENABLE_MEMCHECK AND NOT test_skip_memcheck) + if(MICM_ENABLE_MPI AND MEMORYCHECK_COMMAND AND MICM_ENABLE_MEMCHECK AND NOT test_skip_memcheck) add_test(NAME memcheck_${test_name} COMMAND mpirun -v -np 2 ${memcheck} ${CMAKE_BINARY_DIR}/${test_binary} ${test_args} WORKING_DIRECTORY ${working_dir}) - elseif(MEMORYCHECK_COMMAND AND ENABLE_MEMCHECK AND NOT test_skip_memcheck) + elseif(MEMORYCHECK_COMMAND AND MICM_ENABLE_MEMCHECK AND NOT test_skip_memcheck) add_test(NAME memcheck_${test_name} COMMAND ${memcheck} ${CMAKE_BINARY_DIR}/${test_binary} ${test_args} WORKING_DIRECTORY ${working_dir}) diff --git a/docker/Dockerfile b/docker/Dockerfile index ab7155ba4..189be6357 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -18,7 +18,7 @@ RUN mkdir /build \ && cd /build \ && cmake \ -D CMAKE_BUILD_TYPE=release \ - -D ENABLE_CLANG_TIDY:BOOL=FALSE \ + -D MICM_ENABLE_CLANG_TIDY:BOOL=FALSE \ ../micm \ && make install -j 8 diff --git a/docker/Dockerfile.coverage b/docker/Dockerfile.coverage index fdd8e78bc..8ab499260 100644 --- a/docker/Dockerfile.coverage +++ b/docker/Dockerfile.coverage @@ -24,11 +24,11 @@ RUN mkdir /build \ && cd /build \ && cmake \ -D CMAKE_BUILD_TYPE=debug \ - -D ENABLE_CLANG_TIDY:BOOL=FALSE \ - -D ENABLE_COVERAGE:BOOL=TRUE \ - -D ENABLE_LLVM:BOOL=TRUE \ - # -D ENABLE_MPI:BOOL=TRUE \ - # -D ENABLE_OPENMP:BOOL=TRUE \ + -D MICM_ENABLE_CLANG_TIDY:BOOL=FALSE \ + -D MICM_ENABLE_COVERAGE:BOOL=TRUE \ + -D MICM_ENABLE_LLVM:BOOL=TRUE \ + # -D MICM_ENABLE_MPI:BOOL=TRUE \ + # -D MICM_ENABLE_OPENMP:BOOL=TRUE \ ../micm \ && make install -j 8 diff --git a/docker/Dockerfile.docs b/docker/Dockerfile.docs index 867a3c021..46b467793 100644 --- a/docker/Dockerfile.docs +++ b/docker/Dockerfile.docs @@ -26,7 +26,7 @@ RUN echo "The suffix is '$SWITCHER_SUFFIX'" RUN mkdir /build \ && cd /build \ - && cmake -D BUILD_DOCS=ON \ + && cmake -D MICM_BUILD_DOCS=ON \ /micm \ && make docs diff --git a/docker/Dockerfile.llvm b/docker/Dockerfile.llvm index 74d4e54f4..33b3272fa 100644 --- a/docker/Dockerfile.llvm +++ b/docker/Dockerfile.llvm @@ -21,9 +21,9 @@ RUN mkdir /build \ && cd /build \ && cmake \ -D CMAKE_BUILD_TYPE=release \ - -D ENABLE_CLANG_TIDY:BOOL=FALSE \ - -D ENABLE_LLVM:BOOL=TRUE \ - -D ENABLE_MEMCHECK:BOOL=TRUE \ + -D MICM_ENABLE_CLANG_TIDY:BOOL=FALSE \ + -D MICM_ENABLE_LLVM:BOOL=TRUE \ + -D MICM_ENABLE_MEMCHECK:BOOL=TRUE \ ../micm \ && make install -j 8 diff --git a/docker/Dockerfile.memcheck b/docker/Dockerfile.memcheck index 3366ce906..c03959794 100644 --- a/docker/Dockerfile.memcheck +++ b/docker/Dockerfile.memcheck @@ -17,8 +17,8 @@ RUN mkdir /build \ && cd /build \ && cmake \ -D CMAKE_BUILD_TYPE=release \ - -D ENABLE_CLANG_TIDY:BOOL=FALSE \ - -D ENABLE_MEMCHECK:BOOL=TRUE \ + -D MICM_ENABLE_CLANG_TIDY:BOOL=FALSE \ + -D MICM_ENABLE_MEMCHECK:BOOL=TRUE \ ../micm \ && make install -j 8 diff --git a/docker/Dockerfile.mpi b/docker/Dockerfile.mpi index 5bf14b2eb..281a7799b 100644 --- a/docker/Dockerfile.mpi +++ b/docker/Dockerfile.mpi @@ -20,8 +20,8 @@ ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 RUN mkdir /build \ && cd /build \ && cmake \ - -D ENABLE_CLANG_TIDY:BOOL=FALSE \ - -D ENABLE_MPI:BOOL=TRUE \ + -D MICM_ENABLE_CLANG_TIDY:BOOL=FALSE \ + -D MICM_ENABLE_MPI:BOOL=TRUE \ ../micm \ && make install -j 8 diff --git a/docker/Dockerfile.nvhpc b/docker/Dockerfile.nvhpc index 8f79f1bf2..e04971dc3 100644 --- a/docker/Dockerfile.nvhpc +++ b/docker/Dockerfile.nvhpc @@ -45,8 +45,8 @@ RUN mkdir /cuda_build \ && cd /cuda_build \ && cmake \ -D CMAKE_BUILD_TYPE=debug \ - -D ENABLE_CUDA=ON \ - -D GPU_TYPE="a100" \ + -D MICM_ENABLE_CUDA=ON \ + -D MICM_GPU_TYPE="a100" \ ../micm \ && make -j 8 install diff --git a/docker/Dockerfile.openmp b/docker/Dockerfile.openmp index 66ae9408a..2920e1790 100644 --- a/docker/Dockerfile.openmp +++ b/docker/Dockerfile.openmp @@ -16,9 +16,9 @@ COPY . /micm/ RUN mkdir /build \ && cd /build \ && cmake \ - -D ENABLE_CLANG_TIDY:BOOL=FALSE \ - -D ENABLE_OPENMP:BOOL=TRUE \ - -D ENABLE_JSON:BOOL=TRUE \ + -D MICM_ENABLE_CLANG_TIDY:BOOL=FALSE \ + -D MICM_ENABLE_OPENMP:BOOL=TRUE \ + -D MICM_ENABLE_JSON:BOOL=TRUE \ ../micm \ && make install -j 8 diff --git a/docker/Dockerfile.publish b/docker/Dockerfile.publish index 1edf539f0..1dc794040 100644 --- a/docker/Dockerfile.publish +++ b/docker/Dockerfile.publish @@ -19,8 +19,8 @@ RUN mkdir /build \ && cd /build \ && cmake \ -D CMAKE_BUILD_TYPE=release \ - -D ENABLE_LLVM:BOOL=TRUE \ - -D ENABLE_JSON:BOOL=TRUE \ + -D MICM_ENABLE_LLVM:BOOL=TRUE \ + -D MICM_ENABLE_JSON:BOOL=TRUE \ ../micm \ && make install -j 8 diff --git a/docs/source/contributing/index.rst b/docs/source/contributing/index.rst index a684149bb..27d6e3baf 100644 --- a/docs/source/contributing/index.rst +++ b/docs/source/contributing/index.rst @@ -63,7 +63,7 @@ From the root directory of micm: cd docs pip install -r requirements.txt cd .. && mkdir build && cd build - cmake -DBUILD_DOCS=ON .. + cmake -DMICM_BUILD_DOCS=ON .. make docs open docs/sphinx/index.html @@ -77,7 +77,7 @@ Venv cd docs pip install -r requirements.txt cd .. && mkdir build && cd build - cmake -DBUILD_DOCS=ON .. + cmake -DMICM_BUILD_DOCS=ON .. make docs open docs/sphinx/index.html @@ -91,6 +91,6 @@ Conda cd docs pip install -r requirements.txt cd .. && mkdir build && cd build - cmake -DBUILD_DOCS=ON .. + cmake -DMICM_BUILD_DOCS=ON .. make docs open docs/sphinx/index.html \ No newline at end of file diff --git a/docs/source/getting_started.rst b/docs/source/getting_started.rst index 103e9e3e3..7cec3480d 100644 --- a/docs/source/getting_started.rst +++ b/docs/source/getting_started.rst @@ -29,7 +29,7 @@ step will simply copy the header files into the normal location required by your $ make test CMake will allow for setting options such as the installation directory -with CMAKE_INSTALL_PREFIX, or various build flags such as BUILD_DOCS, ENABLE_CUDA, etc. +with CMAKE_INSTALL_PREFIX, or various build flags such as MICM_BUILD_DOCS, MICM_ENABLE_CUDA, etc. Options ------- @@ -43,13 +43,13 @@ Some of these libraries can be included automatically with cmake build options, others require that you have libraries installed on your system. - JSON configuration support - - When building micm, you need to enable the JSON option. This will download and configure the `nlohmann/jsoncpp library `_ for you. For example: ``cmake -DENABLE_JSON=ON ..`` + - When building micm, you need to enable the JSON option. This will download and configure the `nlohmann/jsoncpp library `_ for you. For example: ``cmake -DMICM_ENABLE_JSON=ON ..`` - JIT-compiled chemistry functions - This requires `LLVM `_ to be installed with on your system. Once it is, you can include the jit options with ``cmake -DENBABLE_LLVM=ON ..`` - GPU support - Coming soon - OpenMP - - On macOS, you either need to configure cmake to use gcc which ships with OpenMP (either ``CXX=g++ cmake -DENABLE_OPENMP=ON ..`` or ``cmake -DCMAKE_CXX_COMPILER=g++ -DENABLE_OPENMP=ON ..``) + - On macOS, you either need to configure cmake to use gcc which ships with OpenMP (either ``CXX=g++ cmake -DMICM_ENABLE_OPENMP=ON ..`` or ``cmake -DCMAKE_CXX_COMPILER=g++ -DMICM_ENABLE_OPENMP=ON ..``) For more ways to build and install micm, see :ref:`Installation and usage`. If you would like instructions for building the docs, see :ref:`Contributing`. diff --git a/docs/source/user_guide/index.rst b/docs/source/user_guide/index.rst index 2670c6aa2..8fcf38752 100644 --- a/docs/source/user_guide/index.rst +++ b/docs/source/user_guide/index.rst @@ -30,7 +30,7 @@ If you would like to include the json examples, you must configure micm to build .. code-block:: console - $ cmake -DENABLE_JSON=ON .. + $ cmake -DMICM_ENABLE_JSON=ON .. $ make $ ./test_rate_constants_no_user_defined_example_with_config $ ./test_rate_constants_user_defined_example_with_config diff --git a/include/micm/process/jit_process_set.hpp b/include/micm/process/jit_process_set.hpp index 7190b18ee..e27a00f58 100644 --- a/include/micm/process/jit_process_set.hpp +++ b/include/micm/process/jit_process_set.hpp @@ -15,7 +15,7 @@ namespace micm /// @brief JIT-compiled solver function calculators for a collection of processes /// The template parameter is the number of grid cells to solve simultaneously - template + template class JitProcessSet : public ProcessSet { std::shared_ptr compiler_; diff --git a/include/micm/solver/jit_lu_decomposition.hpp b/include/micm/solver/jit_lu_decomposition.hpp index c54277a59..b85c12d8f 100644 --- a/include/micm/solver/jit_lu_decomposition.hpp +++ b/include/micm/solver/jit_lu_decomposition.hpp @@ -16,7 +16,7 @@ namespace micm /// /// See LuDecomposition class description for algorithm details /// The template parameter is the number of blocks (i.e. grid cells) in the block-diagonal matrix - template + template class JitLuDecomposition : public LuDecomposition { std::shared_ptr compiler_; diff --git a/include/micm/solver/jit_rosenbrock.hpp b/include/micm/solver/jit_rosenbrock.hpp index 42b614c34..3a834d908 100644 --- a/include/micm/solver/jit_rosenbrock.hpp +++ b/include/micm/solver/jit_rosenbrock.hpp @@ -32,8 +32,8 @@ namespace micm template< template class MatrixPolicy = VectorMatrix, template class SparseMatrixPolicy = VectorSparseMatrix, - class LinearSolverPolicy = JitLinearSolver, - class ProcessSetPolicy = JitProcessSet> + class LinearSolverPolicy = JitLinearSolver, + class ProcessSetPolicy = JitProcessSet> class JitRosenbrockSolver : public RosenbrockSolver { std::shared_ptr compiler_; diff --git a/include/micm/util/cuda_vector_matrix.hpp b/include/micm/util/cuda_vector_matrix.hpp index 08df31c77..040f8d14f 100644 --- a/include/micm/util/cuda_vector_matrix.hpp +++ b/include/micm/util/cuda_vector_matrix.hpp @@ -27,7 +27,7 @@ namespace micm * CUDA functionality requires T to be of type double, otherwise this * behaves similarily to VectorMatrix. */ - template + template class CudaVectorMatrix : public VectorMatrix { private: diff --git a/include/micm/util/sparse_matrix_vector_ordering.hpp b/include/micm/util/sparse_matrix_vector_ordering.hpp index bfbadd582..f4b79975d 100644 --- a/include/micm/util/sparse_matrix_vector_ordering.hpp +++ b/include/micm/util/sparse_matrix_vector_ordering.hpp @@ -18,7 +18,7 @@ namespace micm /// /// The template argument is the number of blocks per set of blocks and should be /// approximately the size of the vector register. - template + template class SparseMatrixVectorOrdering { protected: @@ -67,6 +67,6 @@ namespace micm // Default vectorized SparseMatrix template - using VectorSparseMatrix = SparseMatrix>; + using VectorSparseMatrix = SparseMatrix>; } // namespace micm \ No newline at end of file diff --git a/include/micm/util/vector_matrix.hpp b/include/micm/util/vector_matrix.hpp index 935918f5f..2bebedce0 100644 --- a/include/micm/util/vector_matrix.hpp +++ b/include/micm/util/vector_matrix.hpp @@ -8,8 +8,8 @@ #include #include -#ifndef DEFAULT_VECTOR_SIZE -# define DEFAULT_VECTOR_SIZE 4 +#ifndef MICM_DEFAULT_VECTOR_SIZE +# define MICM_DEFAULT_VECTOR_SIZE 4 #endif namespace micm @@ -22,7 +22,7 @@ namespace micm /// /// The template arguments are the type of the matrix elements and the size of the number /// of rows per group. - template + template class VectorMatrix { protected: diff --git a/packaging/CMakeLists.txt b/packaging/CMakeLists.txt index 122ffdc1f..02f13e438 100644 --- a/packaging/CMakeLists.txt +++ b/packaging/CMakeLists.txt @@ -14,7 +14,7 @@ install( PUBLIC_HEADER DESTINATION ${INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR} ) -if(ENABLE_JSON) +if(MICM_ENABLE_JSON) install(TARGETS nlohmann_json EXPORT micm_Exports) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 875c795bc..a13725a71 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,53 +9,55 @@ add_library(musica::micm ALIAS micm) target_compile_features(micm INTERFACE cxx_std_20) +target_compile_definitions(micm INTERFACE MICM_DEFAULT_VECTOR_SIZE=${MICM_DEFAULT_VECTOR_MATRIX_SIZE}) + target_include_directories(micm INTERFACE $ $ ) -if(ENABLE_JSON) +if(MICM_ENABLE_JSON) target_link_libraries(micm INTERFACE nlohmann_json::nlohmann_json) target_compile_definitions(micm INTERFACE USE_JSON) endif() -if(ENABLE_OPENMP) +if(MICM_ENABLE_OPENMP) target_link_libraries(micm INTERFACE OpenMP::OpenMP_CXX) endif() -if(ENABLE_MPI) +if(MICM_ENABLE_MPI) target_link_libraries(micm INTERFACE MPI::MPI_CXX) endif() -if(ENABLE_LLVM) +if(MICM_ENABLE_LLVM) target_link_libraries(micm INTERFACE ${llvm_libs}) endif() -if(ENABLE_OPENACC OR ENABLE_CUDA) - if(NOT GPU_TYPE) - message(FATAL_ERROR "GPU_TYPE is not set or is empty. Please provide a GPU type.") +if(MICM_ENABLE_OPENACC OR MICM_ENABLE_CUDA) + if(NOT MICM_GPU_TYPE) + message(FATAL_ERROR "MICM_GPU_TYPE is not set or is empty. Please provide a GPU type.") endif() - set(GPU_ARCH "") - if (GPU_TYPE STREQUAL a100) - set(GPU_ARCH "80") + set(MICM_GPU_ARCH "") + if (MICM_GPU_TYPE STREQUAL a100) + set(MICM_GPU_ARCH "80") endif() - if (GPU_TYPE STREQUAL v100) - set(GPU_ARCH "70") + if (MICM_GPU_TYPE STREQUAL v100) + set(MICM_GPU_ARCH "70") endif() - if(NOT GPU_ARCH) - message(FATAL_ERROR "GPU_TYPE (${GPU_TYPE}) is not recognized. Available options are [a100, v100].") + if(NOT MICM_GPU_ARCH) + message(FATAL_ERROR "MICM_GPU_TYPE (${MICM_GPU_TYPE}) is not recognized. Available options are [a100, v100].") endif() endif() -if(ENABLE_OPENACC) +if(MICM_ENABLE_OPENACC) add_library(micm_openacc) add_library(musica::micm_openacc ALIAS micm_openacc) - set(GPU_FLAGS -gpu=cc${GPU_ARCH},lineinfo -Minfo=accel) + set(GPU_FLAGS -gpu=cc${MICM_GPU_ARCH},lineinfo -Minfo=accel) message(STATUS "GPU Flags: ${OpenACC_CXX_FLAGS} ${GPU_FLAGS}") target_compile_options(micm_openacc PRIVATE ${OpenACC_CXX_FLAGS} ${GPU_FLAGS}) @@ -69,9 +71,9 @@ if(ENABLE_OPENACC) ) endif() -if(ENABLE_CUDA) - message(STATUS "GPU architecture ${GPU_ARCH}") - set(CMAKE_CUDA_ARCHITECTURES ${GPU_ARCH}) +if(MICM_ENABLE_CUDA) + message(STATUS "GPU architecture ${MICM_GPU_ARCH}") + set(CMAKE_CUDA_ARCHITECTURES ${MICM_GPU_ARCH}) add_library(micm_cuda) add_library(musica::micm_cuda ALIAS micm_cuda) diff --git a/src/process/CMakeLists.txt b/src/process/CMakeLists.txt index 775ed0234..91146f486 100644 --- a/src/process/CMakeLists.txt +++ b/src/process/CMakeLists.txt @@ -1,10 +1,10 @@ -if(ENABLE_CUDA) +if(MICM_ENABLE_CUDA) target_sources(micm_cuda PRIVATE process_set.cu ) endif() -if(ENABLE_OPENACC) +if(MICM_ENABLE_OPENACC) target_sources(micm_openacc PRIVATE ) diff --git a/src/solver/CMakeLists.txt b/src/solver/CMakeLists.txt index 7bf198c06..93fca55eb 100644 --- a/src/solver/CMakeLists.txt +++ b/src/solver/CMakeLists.txt @@ -1,4 +1,4 @@ -if(ENABLE_CUDA) +if(MICM_ENABLE_CUDA) target_sources(micm_cuda PRIVATE lu_decomposition.cu diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index 4f58c5827..0b36860f8 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -1,4 +1,4 @@ -if(ENABLE_CUDA) +if(MICM_ENABLE_CUDA) target_sources(micm_cuda PRIVATE cuda_vector_matrix.cu diff --git a/test/integration/CMakeLists.txt b/test/integration/CMakeLists.txt index c9e9ab9de..cd45bdaee 100644 --- a/test/integration/CMakeLists.txt +++ b/test/integration/CMakeLists.txt @@ -10,7 +10,7 @@ create_standard_test(NAME chapman_integration SOURCES chapman.cpp) create_standard_test(NAME analytical_rosenbrock_integration SOURCES analytical_rosenbrock.cpp) create_standard_test(NAME terminator_integration SOURCES terminator.cpp) -if(ENABLE_LLVM) +if(MICM_ENABLE_LLVM) create_standard_test(NAME analytical_jit_rosenbrock_integration SOURCES analytical_jit_rosenbrock.cpp) create_standard_test(NAME jit_terminator_integration SOURCES jit_terminator.cpp) endif() diff --git a/test/regression/RosenbrockChapman/CMakeLists.txt b/test/regression/RosenbrockChapman/CMakeLists.txt index c97ed3db3..71b47a7a1 100644 --- a/test/regression/RosenbrockChapman/CMakeLists.txt +++ b/test/regression/RosenbrockChapman/CMakeLists.txt @@ -10,7 +10,7 @@ create_standard_test(NAME regression_test_rosenbrock_p_force SOURCES regression_ create_standard_test(NAME regression_test_rosenbrock_dforce_dy SOURCES regression_test_dforce_dy.cpp) create_standard_test(NAME regression_test_solve SOURCES regression_test_solve.cpp) -if(ENABLE_LLVM) +if(MICM_ENABLE_LLVM) create_standard_test(NAME regression_test_jit_p_force SOURCES regression_test_jit_p_force.cpp) create_standard_test(NAME regression_test_jit_dforce_dy SOURCES regression_test_jit_dforce_dy.cpp) create_standard_test(NAME regression_test_jit_solve SOURCES regression_test_jit_solve.cpp) diff --git a/test/tutorial/CMakeLists.txt b/test/tutorial/CMakeLists.txt index 825f9d15b..13b0413b9 100644 --- a/test/tutorial/CMakeLists.txt +++ b/test/tutorial/CMakeLists.txt @@ -14,15 +14,15 @@ create_standard_test(NAME rate_constants_no_user_defined_example_by_hand SOURCES create_standard_test(NAME rate_constants_user_defined_example_by_hand SOURCES test_rate_constants_user_defined_by_hand.cpp) create_standard_test(NAME solver_configuration SOURCES test_solver_configuration.cpp) create_standard_test(NAME vectorized_matrix_solver SOURCES test_vectorized_matrix_solver.cpp) -if(ENABLE_JSON) +if(MICM_ENABLE_JSON) create_standard_test(NAME rate_constants_no_user_defined_example_with_config SOURCES test_rate_constants_no_user_defined_with_config.cpp) create_standard_test(NAME rate_constants_user_defined_example_with_config SOURCES test_rate_constants_user_defined_with_config.cpp) - if(ENABLE_OPENMP) + if(MICM_ENABLE_OPENMP) create_standard_test(NAME openmp_tutorial SOURCES test_openmp.cpp) endif() - if(ENABLE_LLVM) + if(MICM_ENABLE_LLVM) # Memory checking the JIT Tutorial is too costly, so just build standard test create_standard_test(NAME jit_tutorial SOURCES test_jit_tutorial.cpp SKIP_MEMCHECK) diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index 81c8de5ee..d4a20d333 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -1,7 +1,7 @@ -if(ENABLE_JSON) +if(MICM_ENABLE_JSON) add_subdirectory(configure) endif() -if(ENABLE_LLVM) +if(MICM_ENABLE_LLVM) add_subdirectory(jit) endif() add_subdirectory(process) @@ -9,7 +9,7 @@ add_subdirectory(solver) add_subdirectory(system) add_subdirectory(util) add_subdirectory(version) -if(ENABLE_OPENMP AND ENABLE_JSON) +if(MICM_ENABLE_OPENMP AND MICM_ENABLE_JSON) add_subdirectory(openmp) endif() diff --git a/test/unit/openmp/CMakeLists.txt b/test/unit/openmp/CMakeLists.txt index b744f9807..e983ff3b1 100644 --- a/test/unit/openmp/CMakeLists.txt +++ b/test/unit/openmp/CMakeLists.txt @@ -7,6 +7,6 @@ include(test_util) # Tests create_standard_test(NAME openmp SOURCES test_openmp.cpp) -if(ENABLE_LLVM) +if(MICM_ENABLE_LLVM) create_standard_test(NAME openmp_jit_solver SOURCES test_openmp_jit_solver.cpp) endif() \ No newline at end of file diff --git a/test/unit/process/CMakeLists.txt b/test/unit/process/CMakeLists.txt index 9d81cdc65..fa37803f3 100644 --- a/test/unit/process/CMakeLists.txt +++ b/test/unit/process/CMakeLists.txt @@ -17,15 +17,15 @@ create_standard_test(NAME tunneling_rate_constant SOURCES test_tunneling_rate_co create_standard_test(NAME user_defined_rate_constant SOURCES test_user_defined_rate_constant.cpp) # GPU tests -if(ENABLE_CUDA) +if(MICM_ENABLE_CUDA) create_standard_test(NAME cuda_process_set SOURCES test_cuda_process_set.cpp LIBRARIES musica::micm_cuda) endif() -if(ENABLE_OPENACC) +if(MICM_ENABLE_OPENACC) create_standard_test(NAME openacc_process_set SOURCES test_openacc_process_set.cpp LIBRARIES musica::micm_openacc) endif() -if(ENABLE_LLVM) +if(MICM_ENABLE_LLVM) create_standard_test(NAME jit_process_set SOURCES test_jit_process_set.cpp) create_standard_test(NAME jit_forcing_calculation SOURCES test_jit_forcing_calculation.cpp forcing_calculation.cpp) endif() \ No newline at end of file diff --git a/test/unit/solver/CMakeLists.txt b/test/unit/solver/CMakeLists.txt index f29189603..6a2cb265e 100644 --- a/test/unit/solver/CMakeLists.txt +++ b/test/unit/solver/CMakeLists.txt @@ -13,13 +13,13 @@ create_standard_test(NAME rosenbrock SOURCES test_rosenbrock.cpp) create_standard_test(NAME state SOURCES test_state.cpp) # GPU tests -if(ENABLE_CUDA) +if(MICM_ENABLE_CUDA) create_standard_test(NAME cuda_lu_decomposition SOURCES test_cuda_lu_decomposition.cpp LIBRARIES musica::micm_cuda) create_standard_test(NAME cuda_linear_solver SOURCES test_cuda_linear_solver.cpp LIBRARIES musica::micm_cuda) create_standard_test(NAME cuda_rosenbrock SOURCES test_cuda_rosenbrock.cpp LIBRARIES musica::micm_cuda) endif() -if(ENABLE_LLVM) +if(MICM_ENABLE_LLVM) create_standard_test(NAME jit_linear_solver SOURCES test_jit_linear_solver.cpp) create_standard_test(NAME jit_lu_decomposition SOURCES test_jit_lu_decomposition.cpp) create_standard_test(NAME jit_rosenbrock SOURCES test_jit_rosenbrock.cpp) diff --git a/test/unit/util/CMakeLists.txt b/test/unit/util/CMakeLists.txt index 3448e067c..894bad2a6 100644 --- a/test/unit/util/CMakeLists.txt +++ b/test/unit/util/CMakeLists.txt @@ -11,7 +11,7 @@ create_standard_test(NAME sparse_matrix_standard_ordering SOURCES test_sparse_ma create_standard_test(NAME sparse_matrix_vector_ordering SOURCES test_sparse_matrix_vector_ordering.cpp) create_standard_test(NAME vector_matrix SOURCES test_vector_matrix.cpp) -if(ENABLE_CUDA) +if(MICM_ENABLE_CUDA) add_library(micm_cuda_test_utils) target_link_libraries(micm_cuda_test_utils PUBLIC cudart micm) target_sources(micm_cuda_test_utils PRIVATE cuda_matrix_utils.cu)