From 5a4bf3f56805ffb43cdf8e6da6eebef08657ef02 Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Thu, 14 Mar 2024 11:16:14 -0500 Subject: [PATCH] Actions (#427) * organizing actions * not building json tests for clang on windows * trying to get linux to run * debug and release types on mac and unbuntu * readme badges and docker and coverage test name * adding gcc and clang tests for debug and release on mac * adding concurrency check * trying to prevent duplicates from running * another duplicate prevention * removing x86 because it takes too long * using homebrew gcc compilers * remove large files to allow intel dockerfile to run * removing comment * fixing build * making tests pass for intel buil * maybe now * not running tests on nvhpc build * syntax fix * trying to make github pickup the actions changes * removing comment * maybe being more correct in the windows action? * Revert "making tests pass for intel buil" This reverts commit 8f7d493b335d8dff5ec58d9fe79f5c10f50635ff. * Revert "maybe now" This reverts commit 443ab5f19ab935cb7f66bd56f85c591dc32a1e06. * setting intel compiler flags --- .github/workflows/docker_and_coverage.yml | 8 ++++++-- .github/workflows/windows.yml | 13 ++----------- docker/Dockerfile.intel | 1 - docker/Dockerfile.nvhpc | 15 +++------------ src/CMakeLists.txt | 13 +++++++++++++ test/unit/util/test_cuda_vector_matrix.cpp | 2 +- 6 files changed, 25 insertions(+), 27 deletions(-) diff --git a/.github/workflows/docker_and_coverage.yml b/.github/workflows/docker_and_coverage.yml index 53270c370..2566c3c4f 100644 --- a/.github/workflows/docker_and_coverage.yml +++ b/.github/workflows/docker_and_coverage.yml @@ -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 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index f72b4b427..dd74d1a3f 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -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 @@ -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 diff --git a/docker/Dockerfile.intel b/docker/Dockerfile.intel index 180f7c493..cb41cef7c 100644 --- a/docker/Dockerfile.intel +++ b/docker/Dockerfile.intel @@ -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 diff --git a/docker/Dockerfile.nvhpc b/docker/Dockerfile.nvhpc index e04971dc3..fa674f965 100644 --- a/docker/Dockerfile.nvhpc +++ b/docker/Dockerfile.nvhpc @@ -28,26 +28,17 @@ ENV FC=nvfortran # Micm COPY . /micm/ -# build the library and run the tests -RUN mkdir /build \ - && cd /build \ - && cmake \ - -D CMAKE_BUILD_TYPE=release \ - ../micm \ - && make -j 8 install - - # copy headers needed for cublas to /usr/include RUN cp -r /opt/nvidia/hpc_sdk/*/23.7/cuda/include/* /usr/include/ # build the library and run the tests -RUN mkdir /cuda_build \ - && cd /cuda_build \ +RUN mkdir /build \ + && cd /build \ && cmake \ -D CMAKE_BUILD_TYPE=debug \ -D MICM_ENABLE_CUDA=ON \ -D MICM_GPU_TYPE="a100" \ ../micm \ - && make -j 8 install + && make WORKDIR /build \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a13725a71..f70f38032 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,6 +17,19 @@ target_include_directories(micm $ ) +# Check for Intel compiler +if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" OR CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") + # Set compiler flags for Intel C++ + if (WIN32) + # For Windows + target_compile_options(micm INTERFACE "/fp:precise") + else () + # For other operating systems (e.g., Linux, macOS) + target_compile_options(micm INTERFACE "-ffp-model=precise") + endif () +endif () + + if(MICM_ENABLE_JSON) target_link_libraries(micm INTERFACE nlohmann_json::nlohmann_json) target_compile_definitions(micm INTERFACE USE_JSON) diff --git a/test/unit/util/test_cuda_vector_matrix.cpp b/test/unit/util/test_cuda_vector_matrix.cpp index e3c776a51..dc2b60870 100644 --- a/test/unit/util/test_cuda_vector_matrix.cpp +++ b/test/unit/util/test_cuda_vector_matrix.cpp @@ -34,7 +34,7 @@ TEST(CudaVectorMatrix, DeviceMemCopy) EXPECT_EQ(h_vector[3], 4 * 4); } -template +template static void ModifyAndSyncToHost(micm::CudaVectorMatrix& matrix) { matrix.CopyToDevice();