From 2f2dc3e2d6431f355c4fe69edac8efbb02a188e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cezary=20Skrzy=C5=84ski?= Date: Mon, 4 Dec 2023 20:45:14 +0100 Subject: [PATCH] ci: add baseline builds --- .github/workflows/ci-baseline.yml | 92 +++++++++++++++++++++++++++++++ README.md | 3 +- docs/building.rst | 19 +++++++ src/bvh/math/common.hpp | 1 + src/bvh/util/bits.hpp | 20 +++++-- 5 files changed, 129 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/ci-baseline.yml diff --git a/.github/workflows/ci-baseline.yml b/.github/workflows/ci-baseline.yml new file mode 100644 index 0000000..8da48e9 --- /dev/null +++ b/.github/workflows/ci-baseline.yml @@ -0,0 +1,92 @@ +name: ci-baseline + +on: + pull_request: + types: [ opened, reopened, synchronize ] + push: + branches: + - 'main' + +concurrency: + group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + CI: + name: baseline + continue-on-error: false + strategy: + fail-fast: false + matrix: + image: + - amd64-ubuntu-22.04-clang-14-clang-14-cpp + - amd64-ubuntu-20.04-gcc-9-11.2.0-cpp + build_type: + - Release + - Debug + + runs-on: ubuntu-latest + container: + image: lifflander1/vt:${{ matrix.image }} + # env: + + steps: + - uses: actions/checkout@v4 + + - name: Checkout vt + uses: actions/checkout@v4 + with: + repository: DARMA-tasking/vt + path: vt + + - name: Checkout magistrate + uses: actions/checkout@v4 + with: + repository: DARMA-tasking/magistrate + path: vt/lib/checkpoint + + - name: Checkout kokkos + uses: actions/checkout@v4 + with: + repository: kokkos/kokkos + path: kokkos + ref: develop + + - name: Configure vt + working-directory: vt + run: | + cmake -B builddir \ + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ + -DVT_BUILD_EXAMPLES=OFF \ + -DVT_BUILD_TESTS=OFF \ + -Dvt_trace_enabled=ON + + - name: Build vt + working-directory: vt + run: | + cmake --build builddir --target install + + - name: Configure kokkos + working-directory: kokkos + run: | + cmake -B builddir \ + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + + - name: Build kokkos + working-directory: kokkos + run: | + cmake --build builddir --target install + + - name: Configure distBVH + run: | + cmake -B builddir \ + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + + - name: Build distBVH + run: | + cmake --build builddir --target install + + - name: Run tests + working-directory: builddir + run: | + ctest --output-on-failure diff --git a/README.md b/README.md index 4046f52..70d08c8 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,8 @@ Building is done via CMake (version 3.15 required). Detailed instructions can be BVH requires a compiler that supports C++17. This includes at least clang 5 or gcc version 7.0. BVH uses [DARMA/vt](https://github.com/DARMA-tasking/vt) for asynchronous tasking. For more information about DARMA/vt -please consult the [documentation](https://darma-tasking.github.io/docs/html/index.html). +please consult the [documentation](https://darma-tasking.github.io/docs/html/index.html). +BVH requires [Kokkos](https://github.com/kokkos/kokkos) version `4.0` or later. VTK can also be used for visualizing the the tree data structure. diff --git a/docs/building.rst b/docs/building.rst index 93165d6..26bfbff 100644 --- a/docs/building.rst +++ b/docs/building.rst @@ -18,6 +18,8 @@ that are summarized here: - :ref:`vt_DIR ` - :ref:`vt_ROOT ` +- :ref:`Kokkos_DIR ` +- :ref:`Kokkos_ROOT ` - :ref:`BVH_VT_INSERTABLE_COLLECTIONS ` - :ref:`VTK_ROOT ` - :ref:`BVH_DEBUG_LEVEL ` @@ -67,6 +69,23 @@ BVH can optionally use insertable collections. Use the following to turn off ins -DBVH_VT_INSERTABLE_COLLECTIONS=OFF +Locating Kokkos +----------------- + +BVH is dependent on `Kokkos`_. + +.. _cmake-kokkos-dir: + +.. code-block:: sh + + -DKokkos_DIR=path/to/kokkos/install/cmake + +.. _cmake-kokkos-root: + +.. code-block:: sh + + -DKokkos_ROOT=path/to/kokkos/install + Building with VTK ----------------- diff --git a/src/bvh/math/common.hpp b/src/bvh/math/common.hpp index 940aca0..8ab59c1 100644 --- a/src/bvh/math/common.hpp +++ b/src/bvh/math/common.hpp @@ -54,6 +54,7 @@ namespace bvh #ifdef __CUDA_ARCH__ constexpr double epsilon = DBL_EPSILON; + constexpr double epsilonf = FLT_EPSILON; #else constexpr double epsilon = std::numeric_limits< double >::epsilon(); constexpr double epsilonf = std::numeric_limits< float >::epsilon(); diff --git a/src/bvh/util/bits.hpp b/src/bvh/util/bits.hpp index e856e7b..b0c28ed 100644 --- a/src/bvh/util/bits.hpp +++ b/src/bvh/util/bits.hpp @@ -37,7 +37,9 @@ #include #include +#if !defined(KOKKOS_COMPILER_NVCC) #include +#endif namespace bvh { @@ -75,7 +77,7 @@ namespace bvh #error "unsupported compiler for find first set" #endif } - + inline std::uint64_t ffs( std::uint64_t _val ) { #ifdef __GNUC__ @@ -84,17 +86,25 @@ namespace bvh #error "unsupported compiler for find first set" #endif } - + inline std::uint32_t clz( std::uint32_t _val ) { +#if !defined(KOKKOS_COMPILER_NVCC) return _lzcnt_u32( _val ); +#else + return 0u; +#endif } - + inline std::uint64_t clz( std::uint64_t _val ) { +#if !defined(KOKKOS_COMPILER_NVCC) return _lzcnt_u64( _val ); +#else + return 0u; +#endif } - + inline int bsr( unsigned long _val ) { #ifdef __GNUC__ @@ -109,7 +119,7 @@ namespace bvh { return bsr( _val ); } - + inline bool is_pow2( unsigned _val ) { return _val & ( _val - 1 );