Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to new container ecosystem in CI #30

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 136 additions & 8 deletions .github/workflows/build_and_test_compiler_zoo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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} ]
Expand All @@ -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}


Expand All @@ -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
Expand All @@ -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}


Expand All @@ -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 ]
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
17 changes: 11 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
14 changes: 14 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/test>
)


add_executable( xc_kernel_test xc_kernel_test.cxx reference_values.cxx )
target_link_libraries( xc_kernel_test PUBLIC exchcxx catch2_main )
Expand Down
2 changes: 2 additions & 0 deletions test/ut_common.hpp → test/ut_common.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@

#include "reference_values.hpp"

#cmakedefine EXCHCXX_SYCL_TEST_GPU


enum class TestInterface {
EXC,
Expand Down
21 changes: 8 additions & 13 deletions test/xc_kernel_test.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1934,30 +1934,25 @@ 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;

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<sycl::info::device::name>()
// << "\n";
std::cout << "Running on "
<< q.get_device().get_info<sycl::info::device::name>()
<< "\n";

SECTION( "Libxc Functionals" ) {

Expand Down