From 3df6e95510794c049efa1065f53322206584140f Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Sun, 20 Aug 2023 15:54:35 -0700 Subject: [PATCH 1/7] [CI] Move to dbwy/chemistry container --- .github/workflows/build_and_test_compiler_zoo.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_and_test_compiler_zoo.yml b/.github/workflows/build_and_test_compiler_zoo.yml index 4cd4a4c..c7222f8 100644 --- a/.github/workflows/build_and_test_compiler_zoo.yml +++ b/.github/workflows/build_and_test_compiler_zoo.yml @@ -9,7 +9,7 @@ jobs: release_build: runs-on: ubuntu-latest container: - image: dbwy/compiler-zoo + image: dbwy/chemistry:dev strategy: matrix: compiler: [ {suite: gnu, version: 12}, {suite: llvm, version: 14} ] @@ -45,7 +45,7 @@ jobs: debug_build: runs-on: ubuntu-latest container: - image: dbwy/compiler-zoo + image: dbwy/chemistry:dev steps: - uses: actions/checkout@v3 @@ -80,7 +80,7 @@ jobs: needs: release_build runs-on: ubuntu-latest container: - image: dbwy/compiler-zoo + image: dbwy/chemistry:dev strategy: matrix: libxc_version: [ master, 6.2.0 ] @@ -125,7 +125,7 @@ jobs: needs: release_build runs-on: ubuntu-latest container: - image: dbwy/compiler-zoo + image: dbwy/chemistry:dev steps: - uses: actions/checkout@v3 @@ -151,7 +151,7 @@ jobs: needs: release_build runs-on: ubuntu-latest container: - image: dbwy/compiler-zoo + image: dbwy/chemistry:dev steps: - uses: actions/checkout@v3 From 6106e2e7fd667ba6ca50d57c821f3130066ab139 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Sun, 20 Aug 2023 16:43:37 -0700 Subject: [PATCH 2/7] [CI] Add unit test that tests Libxc discovery using the preinstalled in dbwy/chemistry --- .../workflows/build_and_test_compiler_zoo.yml | 31 +++++++++++++++++++ CMakeLists.txt | 17 ++++++---- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_and_test_compiler_zoo.yml b/.github/workflows/build_and_test_compiler_zoo.yml index c7222f8..2637113 100644 --- a/.github/workflows/build_and_test_compiler_zoo.yml +++ b/.github/workflows/build_and_test_compiler_zoo.yml @@ -75,6 +75,37 @@ jobs: shell: bash run: cmake --build ${{runner.workspace}}/build --target test + libxc_discovery: + name: Discover Installed Libxc + needs: release_build + runs-on: ubuntu-latest + container: + image: dbwy/chemistry:dev + + steps: + - uses: actions/checkout@v3 + + - name: Setup Compiler + shell: bash + run: $GITHUB_WORKSPACE/.github/workflows/scripts/compiler_setup.sh + gnu 12 + + - name: Configure CMake + shell: bash + run: cmake -S $GITHUB_WORKSPACE -B ${{runner.workspace}}/build + -DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/install + -DCMAKE_PREFIX_PATH=/usr/local/libxc/6.1.0 + -DEXCHCXX_DISABLE_FETCH=ON + -DCMAKE_TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/${GH_ACTIONS_TOOLCHAIN} + + - name: Build + shell: bash + run: cmake --build ${{runner.workspace}}/build -j2 + + - name: Test + shell: bash + run: cmake --build ${{runner.workspace}}/build --target test + libxc_versions: name: Test Libxc Compatibility needs: release_build diff --git a/CMakeLists.txt b/CMakeLists.txt index 76bdbb3..cb9cde8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,12 +5,13 @@ include(FetchContent) project( ExchCXX VERSION 0.1.0 LANGUAGES C CXX ) # ExchCXX Options -option( EXCHCXX_ENABLE_TESTS "Enable Unit Tests" ON ) -option( EXCHCXX_ENABLE_BENCHMARK "Enable Performance Benchmark" OFF ) -option( EXCHCXX_ENABLE_CUDA "Enable Device Code (CUDA)" OFF ) -option( EXCHCXX_ENABLE_HIP "Enable Device Code (HIP)" OFF ) -option( EXCHCXX_ENABLE_SYCL "Enable Device Code (SYCL)" OFF ) -option( BUILD_SHARED_LIBS "Build Shared Libs" OFF ) +option( EXCHCXX_ENABLE_TESTS "Enable Unit Tests" ON ) +option( EXCHCXX_ENABLE_BENCHMARK "Enable Performance Benchmark" OFF ) +option( EXCHCXX_ENABLE_CUDA "Enable Device Code (CUDA)" OFF ) +option( EXCHCXX_ENABLE_HIP "Enable Device Code (HIP)" OFF ) +option( EXCHCXX_ENABLE_SYCL "Enable Device Code (SYCL)" OFF ) +option( BUILD_SHARED_LIBS "Build Shared Libs" OFF ) +option( EXCHCXX_DISABLE_FETCH "Disable FetchContent for Deps" OFF ) # Decided if we're compiling device bindings @@ -65,6 +66,10 @@ if( ${Libxc_FOUND} ) message( FATAL_ERROR "Libxc version 7+ breaks the API currently used in ExchCXX" ) endif() +elseif( EXCHCXX_DISABLE_FETCH ) + + message( FATAL_ERROR "Libxc was not found and FetchContent was disabled." ) + else() FetchContent_Declare( From fe207dd96bc8bcc7b1ce307b458dec892e5eba0f Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Sun, 20 Aug 2023 17:14:48 -0700 Subject: [PATCH 3/7] [CI] Add NVGPU *build* to CI --- .../workflows/build_and_test_compiler_zoo.yml | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/workflows/build_and_test_compiler_zoo.yml b/.github/workflows/build_and_test_compiler_zoo.yml index 2637113..caa2bd1 100644 --- a/.github/workflows/build_and_test_compiler_zoo.yml +++ b/.github/workflows/build_and_test_compiler_zoo.yml @@ -42,6 +42,39 @@ jobs: shell: bash run: cmake --build ${{runner.workspace}}/build --target test + nvgpu_build: + runs-on: ubuntu-latest + container: + image: dbwy/chemistry-nvgpu:cuda-11.7.0 + + steps: + - uses: actions/checkout@v3 + + - name: Setup Compiler + shell: bash + run: $GITHUB_WORKSPACE/.github/workflows/scripts/compiler_setup.sh + gnu 12 + + - name: Setup Build Type + shell: bash + run: echo "set(CMAKE_BUILD_TYPE Release CACHE BOOL \"\" FORCE)" >> + ${GITHUB_WORKSPACE}/${GH_ACTIONS_TOOLCHAIN} + + - name: Enable CUDA + shell: bash + run: echo "set(EXCHCXX_ENABLE_CUDA CACHE BOOL ON FORCE)" >> + ${GITHUB_WORKSPACE}/${GH_ACTIONS_TOOLCHAIN} + + - name: Configure CMake + shell: bash + run: cmake -S $GITHUB_WORKSPACE -B ${{runner.workspace}}/build + -DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/install + -DCMAKE_TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/${GH_ACTIONS_TOOLCHAIN} + + - name: Build + shell: bash + run: cmake --build ${{runner.workspace}}/build -j2 + debug_build: runs-on: ubuntu-latest container: From c2b0627edaaea45aebc5e955602e406259f3c88a Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Sun, 20 Aug 2023 17:22:55 -0700 Subject: [PATCH 4/7] Fixup fe207dd --- .github/workflows/build_and_test_compiler_zoo.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_and_test_compiler_zoo.yml b/.github/workflows/build_and_test_compiler_zoo.yml index caa2bd1..d9eb2cb 100644 --- a/.github/workflows/build_and_test_compiler_zoo.yml +++ b/.github/workflows/build_and_test_compiler_zoo.yml @@ -24,7 +24,7 @@ jobs: - name: Setup Build Type shell: bash - run: echo "set(CMAKE_BUILD_TYPE Release CACHE BOOL \"\" FORCE)" >> + run: echo "set(CMAKE_BUILD_TYPE Release CACHE STRING \"\" FORCE)" >> ${GITHUB_WORKSPACE}/${GH_ACTIONS_TOOLCHAIN} @@ -57,12 +57,12 @@ jobs: - name: Setup Build Type shell: bash - run: echo "set(CMAKE_BUILD_TYPE Release CACHE BOOL \"\" FORCE)" >> + run: echo "set(CMAKE_BUILD_TYPE Release CACHE STRING \"\" FORCE)" >> ${GITHUB_WORKSPACE}/${GH_ACTIONS_TOOLCHAIN} - name: Enable CUDA shell: bash - run: echo "set(EXCHCXX_ENABLE_CUDA CACHE BOOL ON FORCE)" >> + run: echo "set(EXCHCXX_ENABLE_CUDA ON CACHE BOOL \"\" FORCE)" >> ${GITHUB_WORKSPACE}/${GH_ACTIONS_TOOLCHAIN} - name: Configure CMake @@ -90,7 +90,7 @@ jobs: - name: Setup Build Type shell: bash - run: echo "set(CMAKE_BUILD_TYPE Debug CACHE BOOL \"\" FORCE)" >> + run: echo "set(CMAKE_BUILD_TYPE Debug CACHE STRING \"\" FORCE)" >> ${GITHUB_WORKSPACE}/${GH_ACTIONS_TOOLCHAIN} @@ -159,7 +159,7 @@ jobs: - name: Setup Build Type shell: bash - run: echo "set(CMAKE_BUILD_TYPE Debug CACHE BOOL \"\" FORCE)" >> + run: echo "set(CMAKE_BUILD_TYPE Debug CACHE STRING \"\" FORCE)" >> ${GITHUB_WORKSPACE}/${GH_ACTIONS_TOOLCHAIN} - name: Setup Libxc From bd975e4f6c88d118c7de1f5684839cc4b24a969d Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Sun, 20 Aug 2023 18:28:49 -0700 Subject: [PATCH 5/7] [CI] Misc + add HIP to CI --- .../workflows/build_and_test_compiler_zoo.yml | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/.github/workflows/build_and_test_compiler_zoo.yml b/.github/workflows/build_and_test_compiler_zoo.yml index d9eb2cb..da477f3 100644 --- a/.github/workflows/build_and_test_compiler_zoo.yml +++ b/.github/workflows/build_and_test_compiler_zoo.yml @@ -7,6 +7,7 @@ env: jobs: release_build: + name: Release Build and Test runs-on: ubuntu-latest container: image: dbwy/chemistry:dev @@ -43,6 +44,7 @@ jobs: run: cmake --build ${{runner.workspace}}/build --target test nvgpu_build: + name: CUDA Build runs-on: ubuntu-latest container: image: dbwy/chemistry-nvgpu:cuda-11.7.0 @@ -75,7 +77,43 @@ jobs: shell: bash run: cmake --build ${{runner.workspace}}/build -j2 + amdgpu_build: + name: HIP Build + runs-on: ubuntu-latest + container: + image: dbwy/chemistry-amdgpu:rocm-5.6 + + steps: + - uses: actions/checkout@v3 + + - name: Setup Compiler + shell: bash + run: $GITHUB_WORKSPACE/.github/workflows/scripts/compiler_setup.sh + gnu 12 + + - name: Setup Build Type + shell: bash + run: echo "set(CMAKE_BUILD_TYPE Release CACHE STRING \"\" FORCE)" >> + ${GITHUB_WORKSPACE}/${GH_ACTIONS_TOOLCHAIN} + + - name: Enable HIP + shell: bash + run: | + echo "set(EXCHCXX_ENABLE_HIP ON CACHE BOOL \"\" FORCE)" >> ${GITHUB_WORKSPACE}/${GH_ACTIONS_TOOLCHAIN} + echo "set(CMAKE_HIP_ARCHITECHTURES gfx90a CACHE STRING \"\" FORCE)" >> ${GITHUB_WORKSPACE}/${GH_ACTIONS_TOOLCHAIN} + + - name: Configure CMake + shell: bash + run: cmake -S $GITHUB_WORKSPACE -B ${{runner.workspace}}/build + -DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/install + -DCMAKE_TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/${GH_ACTIONS_TOOLCHAIN} + + - name: Build + shell: bash + run: cmake --build ${{runner.workspace}}/build -j2 + debug_build: + name: Debug Build and Test runs-on: ubuntu-latest container: image: dbwy/chemistry:dev From f30d31b3993a81ba0b949be692c5dba90c3f8e80 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Sun, 20 Aug 2023 19:31:03 -0700 Subject: [PATCH 6/7] [CI] Add SYCL build --- .../workflows/build_and_test_compiler_zoo.yml | 29 +++++++++++++++++++ .github/workflows/scripts/compiler_setup.sh | 6 ++++ 2 files changed, 35 insertions(+) diff --git a/.github/workflows/build_and_test_compiler_zoo.yml b/.github/workflows/build_and_test_compiler_zoo.yml index da477f3..b3e43f7 100644 --- a/.github/workflows/build_and_test_compiler_zoo.yml +++ b/.github/workflows/build_and_test_compiler_zoo.yml @@ -112,6 +112,35 @@ jobs: shell: bash run: cmake --build ${{runner.workspace}}/build -j2 + sycl_build: + name: SYCL Build + runs-on: ubuntu-latest + container: + image: dbwy/chemistry-sycl:oneapi-2023.2.1 + + steps: + - uses: actions/checkout@v3 + + - name: Setup Compiler + shell: bash + run: $GITHUB_WORKSPACE/.github/workflows/scripts/compiler_setup.sh + dpcpp 2023.2.1 + + - name: Enable HIP + shell: bash + run: | + echo "set(EXCHCXX_ENABLE_SYCL ON CACHE BOOL \"\" FORCE)" >> ${GITHUB_WORKSPACE}/${GH_ACTIONS_TOOLCHAIN} + + - name: Configure CMake + shell: bash + run: cmake -S $GITHUB_WORKSPACE -B ${{runner.workspace}}/build + -DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/install + -DCMAKE_TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/${GH_ACTIONS_TOOLCHAIN} + + - name: Build + shell: bash + run: cmake --build ${{runner.workspace}}/build -j2 + debug_build: name: Debug Build and Test runs-on: ubuntu-latest diff --git a/.github/workflows/scripts/compiler_setup.sh b/.github/workflows/scripts/compiler_setup.sh index 2d6fae0..be0ee7f 100755 --- a/.github/workflows/scripts/compiler_setup.sh +++ b/.github/workflows/scripts/compiler_setup.sh @@ -15,6 +15,12 @@ then update-alternatives --set g++ /usr/bin/g++-${CVER} update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30 update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30 +elif [[ "${CSUITE}" == "dpcpp" ]] +then + update-alternatives --set icx /opt/intel/oneapi/compiler/${CVER}/linux/bin/icx + update-alternatives --set icpx /opt/intel/oneapi/compiler/${CVER}/linux/bin/icpx + update-alternatives --install /usr/bin/cc cc /usr/bin/icx 30 + update-alternatives --install /usr/bin/c++ c++ /usr/bin/icpx 30 else echo "Compiler Suite Not Recognized!" exit 125 From 50daa3e4d078256de5cbffc3540d9ad736ab880c Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 21 Aug 2023 09:33:28 -0700 Subject: [PATCH 7/7] [CI] Revamp SYCL unit tests + configure, enable CPU test for SYCL in GH Actions --- .../workflows/build_and_test_compiler_zoo.yml | 21 ++++++++----------- .github/workflows/scripts/compiler_setup.sh | 6 ------ test/CMakeLists.txt | 14 +++++++++++++ test/{ut_common.hpp => ut_common.hpp.in} | 2 ++ test/xc_kernel_test.cxx | 21 +++++++------------ 5 files changed, 33 insertions(+), 31 deletions(-) rename test/{ut_common.hpp => ut_common.hpp.in} (99%) diff --git a/.github/workflows/build_and_test_compiler_zoo.yml b/.github/workflows/build_and_test_compiler_zoo.yml index b3e43f7..ebed8ff 100644 --- a/.github/workflows/build_and_test_compiler_zoo.yml +++ b/.github/workflows/build_and_test_compiler_zoo.yml @@ -113,7 +113,7 @@ jobs: run: cmake --build ${{runner.workspace}}/build -j2 sycl_build: - name: SYCL Build + name: SYCL Build and Test runs-on: ubuntu-latest container: image: dbwy/chemistry-sycl:oneapi-2023.2.1 @@ -121,26 +121,23 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Setup Compiler - shell: bash - run: $GITHUB_WORKSPACE/.github/workflows/scripts/compiler_setup.sh - dpcpp 2023.2.1 - - - name: Enable HIP - shell: bash - run: | - echo "set(EXCHCXX_ENABLE_SYCL ON CACHE BOOL \"\" FORCE)" >> ${GITHUB_WORKSPACE}/${GH_ACTIONS_TOOLCHAIN} - - name: Configure CMake shell: bash run: cmake -S $GITHUB_WORKSPACE -B ${{runner.workspace}}/build -DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/install - -DCMAKE_TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/${GH_ACTIONS_TOOLCHAIN} + -DCMAKE_CXX_COMPILER=icpx -DCMAKE_C_COMPILER=icx + -DCMAKE_PREFIX_PATH=/usr/local/libxc/6.1.0 + -DEXCHCXX_ENABLE_SYCL=ON - name: Build shell: bash run: cmake --build ${{runner.workspace}}/build -j2 + - name: Test + shell: bash + run: cmake --build ${{runner.workspace}}/build --target test && + cat ${{runner.workspace}}/build/Testing/Temporary/LastTest.log + debug_build: name: Debug Build and Test runs-on: ubuntu-latest diff --git a/.github/workflows/scripts/compiler_setup.sh b/.github/workflows/scripts/compiler_setup.sh index be0ee7f..2d6fae0 100755 --- a/.github/workflows/scripts/compiler_setup.sh +++ b/.github/workflows/scripts/compiler_setup.sh @@ -15,12 +15,6 @@ then update-alternatives --set g++ /usr/bin/g++-${CVER} update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30 update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30 -elif [[ "${CSUITE}" == "dpcpp" ]] -then - update-alternatives --set icx /opt/intel/oneapi/compiler/${CVER}/linux/bin/icx - update-alternatives --set icpx /opt/intel/oneapi/compiler/${CVER}/linux/bin/icpx - update-alternatives --install /usr/bin/cc cc /usr/bin/icx 30 - update-alternatives --install /usr/bin/c++ c++ /usr/bin/icpx 30 else echo "Compiler Suite Not Recognized!" exit 125 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2a0d1e5..7c6d253 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -16,9 +16,23 @@ if( NOT Catch2_FOUND ) endif() endif() +# Testing options +option(EXCHCXX_SYCL_TEST_GPU "Enable GPU Device Selection in SYCL Unit Tests" OFF) + +# Generate test config header +configure_file( + ${PROJECT_SOURCE_DIR}/test/ut_common.hpp.in + ${PROJECT_BINARY_DIR}/test/ut_common.hpp +) + # Global Catch2 executable add_library( catch2_main STATIC ut_main.cxx) target_link_libraries( catch2_main PUBLIC Catch2::Catch2 ) +target_include_directories( catch2_main PUBLIC + ${PROJECT_SOURCE_DIR}/test + $ +) + add_executable( xc_kernel_test xc_kernel_test.cxx reference_values.cxx ) target_link_libraries( xc_kernel_test PUBLIC exchcxx catch2_main ) diff --git a/test/ut_common.hpp b/test/ut_common.hpp.in similarity index 99% rename from test/ut_common.hpp rename to test/ut_common.hpp.in index 05f17f7..a79959f 100644 --- a/test/ut_common.hpp +++ b/test/ut_common.hpp.in @@ -56,6 +56,8 @@ #include "reference_values.hpp" +#cmakedefine EXCHCXX_SYCL_TEST_GPU + enum class TestInterface { EXC, diff --git a/test/xc_kernel_test.cxx b/test/xc_kernel_test.cxx index 395d0b0..1b572fb 100644 --- a/test/xc_kernel_test.cxx +++ b/test/xc_kernel_test.cxx @@ -1934,14 +1934,6 @@ void test_sycl_interface( TestInterface interface, EvalType evaltype, } -#if 0 -struct SYCLTestFeature { - sycl::queue q; - SYCLTestFeature() : - q( sycl::gpu_selector{}, - sycl::property_list{sycl::property::queue::in_order{}} ) { } -}; -#else struct SYCLTestFeature { static sycl::queue q; @@ -1949,15 +1941,18 @@ struct SYCLTestFeature { }; sycl::queue SYCLTestFeature::q( - sycl::gpu_selector{}, - sycl::property_list{sycl::property::queue::in_order{}} ); +#ifdef EXCHCXX_SYCL_TEST_GPU + sycl::gpu_selector_v, +#else + sycl::default_selector_v, #endif + sycl::property_list{sycl::property::queue::in_order{}} ); TEST_CASE_METHOD( SYCLTestFeature, "SYCL Interfaces", "[xc-device]" ) { - //std::cout << "Running on " - // << q.get_device().get_info() - // << "\n"; + std::cout << "Running on " + << q.get_device().get_info() + << "\n"; SECTION( "Libxc Functionals" ) {