Skip to content
This repository was archived by the owner on Dec 19, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
23 changes: 9 additions & 14 deletions .github/workflows/linux-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, 'pypy-3.6', 'pypy-3.7']
python-version: [3.9, "3.10", 3.11, 3.12, 3.13]
kokkos-branch: ['master', 'develop']

steps:
Expand All @@ -30,10 +30,9 @@ jobs:
sudo apt-get update &&
sudo apt-get install -y build-essential gcc g++ ninja-build &&
python -m pip install --upgrade pip &&
python -m pip install 'cmake==3.18.4'
python -m pip install 'cmake==3.31.6'

- name: Install Kokkos
if: ${{ matrix.python-version != 'pypy-3.6' && matrix.python-version != 'pypy-3.7' }}
run:
git clone -b ${{ matrix.kokkos-branch }} https://github.com/kokkos/kokkos.git /tmp/kokkos-source &&
cmake -B /tmp/kokkos-build
Expand Down Expand Up @@ -82,7 +81,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, 'pypy-3.6', 'pypy-3.7']
python-version: [3.9, "3.10", 3.11, 3.12, 3.13]
kokkos-branch: ['master']

steps:
Expand All @@ -98,16 +97,14 @@ jobs:
sudo apt-get update &&
sudo apt-get install -y build-essential gcc g++ ninja-build &&
python -m pip install --upgrade pip &&
python -m pip install 'cmake==3.18.4'
python -m pip install 'cmake==3.31.6'

- name: Install Kokkos
if: ${{ matrix.python-version != '3.8' && matrix.python-version != '3.9' }}
run:
git clone -b ${{ matrix.kokkos-branch }} https://github.com/kokkos/kokkos.git /tmp/kokkos-source &&
cmake -B /tmp/kokkos-build
-DKokkos_ENABLE_SERIAL=ON
-DKokkos_ENABLE_OPENMP=ON
-DCMAKE_CXX_STANDARD=17
-DBUILD_SHARED_LIBS=ON
/tmp/kokkos-source &&
cmake --build /tmp/kokkos-build --target all --parallel 2 &&
Expand Down Expand Up @@ -144,7 +141,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
python-version: [3.9, "3.10", 3.11, 3.12, 3.13]
kokkos-branch: ['develop']

steps:
Expand All @@ -160,16 +157,14 @@ jobs:
sudo apt-get update &&
sudo apt-get install -y build-essential gcc g++ ninja-build &&
python -m pip install --upgrade pip &&
python -m pip install 'cmake==3.20.2'
python -m pip install 'cmake==3.31.6'

- name: Install Kokkos
if: ${{ matrix.python-version != '3.7' }}
run:
git clone -b ${{ matrix.kokkos-branch }} https://github.com/kokkos/kokkos.git /tmp/kokkos-source &&
cmake -B /tmp/kokkos-build
-DKokkos_ENABLE_SERIAL=ON
-DKokkos_ENABLE_THREADS=ON
-DCMAKE_CXX_STANDARD=17
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
/tmp/kokkos-source &&
cmake --build /tmp/kokkos-build --target all --parallel 2 &&
Expand All @@ -179,7 +174,7 @@ jobs:
run:
python -m pip install -r requirements.txt &&
python -m pip install pytest &&
PYKOKKOS_BASE_SETUP_ARGS="-DENABLE_WERROR=ON -DENABLE_MEMORY_TRAITS=ON -DENABLE_LAYOUTS=ON -DENABLE_VIEW_RANKS=2 -DCMAKE_CXX_STANDARD=17 -DKokkos_ENABLE_THREADS=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=OFF"
PYKOKKOS_BASE_SETUP_ARGS="-DENABLE_WERROR=ON -DENABLE_MEMORY_TRAITS=ON -DENABLE_LAYOUTS=ON -DENABLE_VIEW_RANKS=2 -DKokkos_ENABLE_THREADS=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=OFF"
python -m pip install -v --user --no-deps -e .

- name: Import Test
Expand All @@ -197,7 +192,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
python-version: [3.9, "3.10", 3.11, 3.12, 3.13]

steps:
- uses: actions/checkout@v3
Expand All @@ -215,7 +210,7 @@ jobs:
sudo apt-get update &&
sudo apt-get install -y build-essential gcc g++ ninja-build &&
python -m pip install --upgrade pip &&
python -m pip install 'cmake==3.18.4'
python -m pip install 'cmake==3.31.6'

- name: Generate Hierarchy
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: [3.9, "3.10", 3.11, 3.12, 3.13]

steps:
- uses: actions/checkout@v2
Expand All @@ -34,11 +34,11 @@ jobs:
# flake8 options are defined in setup.cfg
flake8 . --count --statistics

formatting:
runs-on: ubuntu-18.04
formatting:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
python-version: [3.13]

steps:
- uses: actions/checkout@v2
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ EXECUTE_PROCESS(
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})

# location where kokkos libraries are/will be installed
IF(ENABLE_INTERNAL_KOKKOS OR NOT Kokkos_DIR)
IF(ENABLE_INTERNAL_KOKKOS OR NOT Kokkos_ROOT)
SET(_Kokkos_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
ELSEIF(Kokkos_DIR)
STRING(REGEX REPLACE "/cmake/.*" "" _Kokkos_LIBDIR "${Kokkos_DIR}")
ELSEIF(Kokkos_ROOT)
STRING(REGEX REPLACE "/cmake/.*" "" _Kokkos_LIBDIR "${Kokkos_ROOT}")
ENDIF()

# absolute path to libpykokkos install
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ of time required to compile the bindings.

### Kokkos Installation

If Kokkos is installed *externaly* to pykokkos-base, set the CMake option `ENABLE_INTERNAL_KOKKOS=OFF`
and set the environment variable `Kokkos_ROOT=<Kokkos Install Directory>/lib64/cmake/Kokkos`.
If the `ENABLE_INTERNAL_KOKKOS` option is not specified the first time CMake is run, CMake will try to
find an existing Kokkos installation. If no existing installation is found, it will build and install
find an existing Kokkos installation. If an existing installation *is not* found, it will build and install
Kokkos from a submodule. When Kokkos is added as a submodule, you can configure the submodule
as you would normally configure Kokkos. However, due to some general awkwardness configuring cmake
from `setup.py` (especially via `pip install`), CMake tries to "automatically" configure
Expand Down
8 changes: 4 additions & 4 deletions cmake/Modules/KokkosPythonKokkos.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ IF(NOT _INTERNAL_KOKKOS AND NOT TARGET Kokkos::kokkoscore)
FIND_FILE(Kokkos_InterOp_Header
NO_DEFAULT_PATH
NAMES Kokkos_InterOp.hpp KokkosExp_InterOp.hpp
PATHS ${Kokkos_INCLUDE_DIR} ${Kokkos_DIR}
HINTS ${Kokkos_INCLUDE_DIR} ${Kokkos_DIR}
PATHS ${Kokkos_INCLUDE_DIR} ${Kokkos_ROOT}
HINTS ${Kokkos_INCLUDE_DIR} ${Kokkos_ROOT}
DOC "Path to Kokkos InterOp header"
PATH_SUFFIXES include ../../../include)

Expand All @@ -60,8 +60,8 @@ ELSEIF(TARGET Kokkos::kokkoscore)
FIND_FILE(Kokkos_InterOp_Header
NO_DEFAULT_PATH
NAMES Kokkos_InterOp.hpp KokkosExp_InterOp.hpp
PATHS ${Kokkos_INCLUDE_DIR} ${Kokkos_DIR}
HINTS ${Kokkos_INCLUDE_DIR} ${Kokkos_DIR}
PATHS ${Kokkos_INCLUDE_DIR} ${Kokkos_ROOT}
HINTS ${Kokkos_INCLUDE_DIR} ${Kokkos_ROOT}
DOC "Path to Kokkos InterOp header"
PATH_SUFFIXES include ../../../include)

Expand Down
2 changes: 1 addition & 1 deletion external/kokkos
Submodule kokkos updated 930 files
2 changes: 1 addition & 1 deletion external/pybind11
Submodule pybind11 updated 320 files
18 changes: 12 additions & 6 deletions include/execution_spaces.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,23 @@

namespace Common {
template <typename Sp, size_t SpaceIdx>
void generate_execution_space_init(py::class_<Sp> &,
void generate_execution_space_init(
[[maybe_unused]] py::class_<Sp> &,
enable_if_t<SpaceIdx == Serial_Backend, int> = 0) {}

template <typename Sp, size_t SpaceIdx>
void generate_execution_space_init(py::class_<Sp> &,
void generate_execution_space_init(
[[maybe_unused]] py::class_<Sp> &,
enable_if_t<SpaceIdx == Threads_Backend, int> = 0) {}

template <typename Sp, size_t SpaceIdx>
void generate_execution_space_init(py::class_<Sp> &,
void generate_execution_space_init(
[[maybe_unused]] py::class_<Sp> &,
enable_if_t<SpaceIdx == OpenMP_Backend, int> = 0) {}

template <typename Sp, size_t SpaceIdx>
void generate_execution_space_init(py::class_<Sp> &_space,
void generate_execution_space_init(
[[maybe_unused]] py::class_<Sp> &_space,
enable_if_t<SpaceIdx == Cuda_Backend, int> = 0) {
#if defined(KOKKOS_ENABLE_CUDA) && defined(__CUDACC__)
_space.def(py::init([](uint64_t stream_ptr, bool manage_stream) {
Expand All @@ -76,7 +80,8 @@ void generate_execution_space_init(py::class_<Sp> &_space,
}

template <typename Sp, size_t SpaceIdx>
void generate_execution_space_init(py::class_<Sp> &_space,
void generate_execution_space_init(
[[maybe_unused]] py::class_<Sp> &_space,
enable_if_t<SpaceIdx == HIP_Backend, int> = 0) {
#if defined(KOKKOS_ENABLE_HIP) && defined(__HIPCC__)
_space.def(py::init([](uint64_t stream_ptr, bool manage_stream) {
Expand Down Expand Up @@ -134,4 +139,5 @@ template <size_t... SpaceIdx>
void generate_execution_spaces(py::module &_mod,
std::index_sequence<SpaceIdx...>) {
FOLD_EXPRESSION(Space::generate_execution_space<SpaceIdx>(_mod));
}
}

9 changes: 3 additions & 6 deletions include/pools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,8 @@ void generate_pool(py::module &_mod, const std::string &_name,

_pool.def(py::init([](uint64_t seed) { return new PoolT{seed}; }));

_pool.def(
"init",
[](PoolT &_p, uint64_t _seed, int _num_states) {
_p.init(_seed, _num_states);
},
"Initialize the random pool");
_pool.def(py::init([](uint64_t seed, uint64_t num_states) {
return new PoolT{seed, num_states};
}));
}
} // namespace Common
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = [
"setuptools < 60.0.0",
"setuptools < 80.0.0",
"setuptools_scm >= 2.0.0",
"wheel >= 0.29.0",
"scikit-build >= 0.8.0",
Expand Down