diff --git a/.github/workflows/build_and_test_compiler_zoo.yml b/.github/workflows/build_and_test_compiler_zoo.yml index 4cd4a4c..ebed8ff 100644 --- a/.github/workflows/build_and_test_compiler_zoo.yml +++ b/.github/workflows/build_and_test_compiler_zoo.yml @@ -7,9 +7,10 @@ env: jobs: release_build: + name: Release Build and Test runs-on: ubuntu-latest container: - image: dbwy/compiler-zoo + image: dbwy/chemistry:dev strategy: matrix: compiler: [ {suite: gnu, version: 12}, {suite: llvm, version: 14} ] @@ -24,7 +25,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} @@ -42,10 +43,106 @@ jobs: shell: bash 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 + + 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 CUDA + shell: bash + run: echo "set(EXCHCXX_ENABLE_CUDA 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 + + 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 + + sycl_build: + name: SYCL Build and Test + runs-on: ubuntu-latest + container: + image: dbwy/chemistry-sycl:oneapi-2023.2.1 + + steps: + - uses: actions/checkout@v3 + + - name: Configure CMake + shell: bash + run: cmake -S $GITHUB_WORKSPACE -B ${{runner.workspace}}/build + -DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/install + -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 container: - image: dbwy/compiler-zoo + image: dbwy/chemistry:dev steps: - uses: actions/checkout@v3 @@ -57,7 +154,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} @@ -75,12 +172,43 @@ 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 runs-on: ubuntu-latest container: - image: dbwy/compiler-zoo + image: dbwy/chemistry:dev strategy: matrix: libxc_version: [ master, 6.2.0 ] @@ -95,7 +223,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 @@ -125,7 +253,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 +279,7 @@ jobs: needs: release_build runs-on: ubuntu-latest container: - image: dbwy/compiler-zoo + image: dbwy/chemistry:dev steps: - uses: actions/checkout@v3 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( 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" ) {