Skip to content

Commit

Permalink
Merge branch 'main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
boulderdaze committed Mar 20, 2024
2 parents d5ecb80 + 9d5bd45 commit 4a9149d
Show file tree
Hide file tree
Showing 56 changed files with 1,555 additions and 641 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
8 changes: 6 additions & 2 deletions .github/workflows/docker_and_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,23 @@ jobs:
- Dockerfile.no_json
- Dockerfile.nvhpc
- Dockerfile.openmp
# - Dockerfile.intel # intel image is too large for GH action
- Dockerfile.intel
# - Dockerfile.mpi
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive

- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache

- name: Build Docker image
run: docker build -t micm -f docker/${{ matrix.dockerfile }} .

- name: Run tests in container
if: matrix.dockerfile != 'Dockerfile.coverage'
# only run this if we are not running coverage tests or have built the cuda files
if: matrix.dockerfile != 'Dockerfile.coverage' && matrix.dockerfile != 'Dockerfile.nvhpc'
run: docker run --name test-container -t micm bash -c 'make test ARGS="--rerun-failed --output-on-failure -j8"'

- name: Run coverage tests in container
Expand Down
13 changes: 2 additions & 11 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,7 @@ jobs:
- uses: actions/checkout@v3

- name: Run CMake
run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }}
if: matrix.build_type == 'Release'

- name: Run CMake
run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }}
if: matrix.build_type == 'Debug'
run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}

- name: Build
run: cmake --build build --config ${{ matrix.build_type }} --parallel 10
Expand Down Expand Up @@ -82,11 +77,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Run CMake
run: cmake -S . -B build -G "Visual Studio 17 2022" -A ${{ matrix.architecture }}
if: matrix.build_type == 'Release'
- name: Run CMake
run: cmake -S . -B build -G "Visual Studio 17 2022" -A ${{ matrix.architecture }}
if: matrix.build_type == 'Debug'
run: cmake -S . -B build -G "Visual Studio 17 2022" -A ${{ matrix.architecture }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
- name: Build
run: cmake --build build --config ${{ matrix.build_type }} --parallel 10
- name: Test
Expand Down
30 changes: 30 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
cff-version: 1.2.0
message: If you use this software, please cite it as below.
title: Model Independent Chemistry Model (MICM)
version: v3.3.1
doi: "10.5281/zenodo.10472189"
authors:
- family-names: Dawson
given-names: Matthew
- family-names: Sun
given-names: Jian
- family-names: Shores
given-names: Kyle
- family-names: Fillmore
given-names: David
- family-names: Tan
given-names: Qina
- family-names: Craig
given-names: Cheryl
- family-names: Gim
given-names: Jiwon
- family-names: Waxmonsky
given-names: Michael
- family-names: Vitt
given-names: Francis
- family-names: Conley
given-names: Andrew
- family-names: Karsenti
given-names: Aharon
license: Apache-2.0
url: "https://github.com/NCAR/micm"
46 changes: 22 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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++
Expand All @@ -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(
Expand Down Expand Up @@ -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()
2 changes: 1 addition & 1 deletion cmake/StaticAnalyzers.cmake
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
16 changes: 8 additions & 8 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -65,7 +65,7 @@ endif()
################################################################################
# MPI

if(ENABLE_MPI)
if(MICM_ENABLE_MPI)
find_package(MPI REQUIRED)
message(STATUS "Compiling with MPI support")
endif()
Expand Down Expand Up @@ -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
Expand All @@ -105,20 +105,20 @@ endif()
################################################################################
# Docs

if(BUILD_DOCS)
if(MICM_BUILD_DOCS)
find_package(Doxygen REQUIRED)
find_package(Sphinx REQUIRED)
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()

Expand All @@ -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}")
Expand Down
8 changes: 4 additions & 4 deletions cmake/test_util.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
################################################################################
# Utility functions for creating tests

if(ENABLE_MEMCHECK)
if(MICM_ENABLE_MEMCHECK)
find_program(MEMORYCHECK_COMMAND "valgrind")
endif()

Expand Down Expand Up @@ -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})
Expand All @@ -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})
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions docker/Dockerfile.coverage
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.docs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion docker/Dockerfile.intel
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ RUN mkdir /build \
&& cd /build \
&& cmake \
-D CMAKE_BUILD_TYPE=release \
# -D CMAKE_CXX_FLAGS_DEBUG="-g -Rno-debug-disables-optimization" \
../micm \
&& make -j 8 install

Expand Down
6 changes: 3 additions & 3 deletions docker/Dockerfile.llvm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile.memcheck
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile.mpi
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading

0 comments on commit 4a9149d

Please sign in to comment.