Skip to content

Commit 411d4f7

Browse files
committed
fix merge conflicts with main
2 parents b4b77c7 + c5b8f13 commit 411d4f7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+9928
-53
lines changed

.github/workflows/array_api.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ jobs:
2626
python -m pip install --upgrade pip
2727
python -m pip install --upgrade numpy mypy==1.0.1 cmake pytest pybind11 scikit-build patchelf tqdm
2828
- name: Install pykokkos-base
29+
working-directory: base
2930
run: |
30-
cd /tmp
31-
git clone https://github.com/kokkos/pykokkos-base.git
32-
cd pykokkos-base
3331
python setup.py install -- -DENABLE_LAYOUTS=ON -DENABLE_MEMORY_TRAITS=OFF -DENABLE_VIEW_RANKS=5
3432
- name: Install pykokkos
3533
run: |
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: "[Base] Cancel Builds on Update"
2+
on:
3+
workflow_run:
4+
workflows: ['[Base] Linux CI', '[Base] Python Package']
5+
types: ['requested']
6+
7+
jobs:
8+
cancel-duplicate-workflow-runs:
9+
name: "Cancel duplicate workflow runs"
10+
strategy:
11+
matrix:
12+
os: [ubuntu-latest, ubuntu-22.04]
13+
14+
runs-on: ${{matrix.os}}
15+
steps:
16+
- uses: potiuk/cancel-workflow-runs@master
17+
name: "Cancel duplicate workflow runs"
18+
with:
19+
cancelMode: duplicates
20+
cancelFutureDuplicates: true
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
sourceRunId: ${{ github.event.workflow_run.id }}
23+
notifyPRCancel: true
24+
skipEventTypes: '["schedule"]'
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
name: "[Base] Linux CI"
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
paths:
9+
- 'base/**'
10+
- '.github/workflows/base-linux-ci.yml'
11+
12+
env:
13+
BUILD_TYPE: Release
14+
15+
jobs:
16+
cmake-build:
17+
strategy:
18+
matrix:
19+
python-version: [3.11, 3.12, 3.13]
20+
kokkos-branch: ['release-candidate-4.7.01']
21+
os: [ubuntu-latest, ubuntu-22.04]
22+
23+
runs-on: ${{matrix.os}}
24+
steps:
25+
- uses: actions/checkout@v2
26+
27+
- name: Set up Python ${{ matrix.python-version }}
28+
uses: actions/setup-python@v2
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
32+
- name: Update container
33+
run:
34+
sudo apt-get update &&
35+
sudo apt-get install -y build-essential gcc g++ ninja-build &&
36+
python -m pip install --upgrade pip &&
37+
python -m pip install 'cmake==3.22.0'
38+
39+
- name: Install Kokkos
40+
run:
41+
git clone -b ${{ matrix.kokkos-branch }} https://github.com/kokkos/kokkos.git /tmp/kokkos-source &&
42+
cmake -B /tmp/kokkos-build
43+
-DKokkos_ENABLE_SERIAL=ON
44+
-DKokkos_ENABLE_OPENMP=OFF
45+
-DBUILD_SHARED_LIBS=ON
46+
/tmp/kokkos-source &&
47+
cmake --build /tmp/kokkos-build --target all --parallel 2 &&
48+
sudo cmake --build /tmp/kokkos-build --target install --parallel 2
49+
50+
- name: Configure CMake
51+
run:
52+
python -m pip install -r base/requirements.txt &&
53+
python -m pip install pytest &&
54+
cmake -B ${{github.workspace}}/base/build
55+
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
56+
-DENABLE_LAYOUTS=OFF
57+
-DENABLE_MEMORY_TRAITS=OFF
58+
-DENABLE_EXAMPLES=ON
59+
-DENABLE_WERROR=ON
60+
-DENABLE_PRECOMPILED_HEADERS=ON
61+
-DPython3_EXECUTABLE=$(which python)
62+
${{github.workspace}}/base
63+
64+
- name: Build
65+
run:
66+
cmake --build ${{github.workspace}}/base/build --target all --parallel 2 &&
67+
sudo cmake --build ${{github.workspace}}/base/build --target install --parallel 2
68+
69+
- name: Import Test
70+
working-directory: ${{github.workspace}}/base/build
71+
run:
72+
mkdir -p scratch &&
73+
cd scratch &&
74+
export PYTHONPATH=/usr/local/lib/python${{ matrix.python-version }}/site-packages:${PYTHONPATH} &&
75+
DEBUG_OUTPUT=ON python -c "import kokkos; print(kokkos.__file__)"
76+
77+
- name: Test
78+
working-directory: ${{github.workspace}}/base/build
79+
run:
80+
export PYTHONPATH=${PWD}:/usr/local/lib/python${{ matrix.python-version }}/site-packages:${PYTHONPATH} &&
81+
ls &&
82+
pytest . &&
83+
python ./ex-numpy.py
84+
85+
pip-build:
86+
strategy:
87+
matrix:
88+
python-version: [3.11, 3.12, 3.13]
89+
kokkos-branch: ['release-candidate-4.7.01']
90+
os: [ubuntu-latest, ubuntu-22.04]
91+
92+
runs-on: ${{matrix.os}}
93+
defaults:
94+
run:
95+
working-directory: base
96+
steps:
97+
- uses: actions/checkout@v2
98+
99+
- name: Set up Python ${{ matrix.python-version }}
100+
uses: actions/setup-python@v2
101+
with:
102+
python-version: ${{ matrix.python-version }}
103+
104+
- name: Update container
105+
run:
106+
sudo apt-get update &&
107+
sudo apt-get install -y build-essential gcc g++ ninja-build &&
108+
python -m pip install --upgrade pip &&
109+
python -m pip install 'cmake==3.22.0'
110+
111+
- name: Install Kokkos
112+
run:
113+
git clone -b ${{ matrix.kokkos-branch }} https://github.com/kokkos/kokkos.git /tmp/kokkos-source &&
114+
cmake -B /tmp/kokkos-build
115+
-DKokkos_ENABLE_SERIAL=ON
116+
-DKokkos_ENABLE_THREADS=ON
117+
-DCMAKE_CXX_STANDARD=20
118+
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
119+
/tmp/kokkos-source &&
120+
cmake --build /tmp/kokkos-build --target all --parallel 2 &&
121+
sudo cmake --build /tmp/kokkos-build --target install --parallel 2
122+
123+
- name: Build
124+
run:
125+
python -m pip install -r requirements.txt &&
126+
python -m pip install pytest &&
127+
CMAKE_BUILD_PARALLEL_LEVEL=2 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"
128+
python -m pip install -v --user --no-deps .
129+
130+
- name: Import Test
131+
run:
132+
mkdir -p scratch &&
133+
cd scratch &&
134+
DEBUG_OUTPUT=ON python -c "import kokkos; print(kokkos.__file__)"
135+
136+
- name: Test
137+
working-directory: base/scratch
138+
run:
139+
python -m kokkos.test
140+
141+
subproject:
142+
strategy:
143+
matrix:
144+
python-version: [3.11, 3.12, 3.13]
145+
os: [ubuntu-latest, ubuntu-22.04]
146+
147+
runs-on: ${{matrix.os}}
148+
steps:
149+
- uses: actions/checkout@v3
150+
151+
- name: Set up Python ${{ matrix.python-version }}
152+
uses: actions/setup-python@v2
153+
with:
154+
python-version: ${{ matrix.python-version }}
155+
156+
- name: Update container
157+
run:
158+
sudo apt-get update &&
159+
sudo apt-get install -y build-essential gcc g++ ninja-build &&
160+
python -m pip install --upgrade pip &&
161+
python -m pip install 'cmake==3.22.0'
162+
163+
- name: Generate CMakeLists.txt
164+
run: |
165+
echo -e "cmake_minimum_required(VERSION 3.22.0 FATAL_ERROR)\nproject(pykokkos-base-as-subproject LANGUAGES CXX)\nadd_subdirectory(base)" > ${{github.workspace}}/CMakeLists.txt
166+
cat ${{github.workspace}}/CMakeLists.txt
167+
168+
- name: Configure CMake
169+
run:
170+
python -m pip install -r base/requirements.txt &&
171+
python -m pip install pytest &&
172+
cmake -B ${{github.workspace}}/build
173+
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
174+
-DENABLE_LAYOUTS=OFF
175+
-DENABLE_MEMORY_TRAITS=OFF
176+
-DENABLE_VIEW_RANKS=1
177+
-DENABLE_EXAMPLES=ON
178+
-DENABLE_WERROR=ON
179+
-DENABLE_SERIAL=ON
180+
-DENABLE_OPENMP=ON
181+
-DBUILD_SHARED_LIBS=ON
182+
-DPYTHON_EXECUTABLE=$(which python)
183+
-DPython3_EXECUTABLE=$(which python)
184+
${{github.workspace}}
185+
186+
- name: Build
187+
run:
188+
cmake --build ${{github.workspace}}/build --target all --parallel 2 &&
189+
sudo cmake --build ${{github.workspace}}/build --target install --parallel 2
190+
191+
- name: Setup PYTHONPATH
192+
run:
193+
echo "PYTHONPATH=/usr/local/lib/python${{ matrix.python-version }}/site-packages:${PYTHONPATH}" >> $GITHUB_ENV
194+
195+
- name: Import Test
196+
run:
197+
DEBUG_OUTPUT=ON python -c "import kokkos; print(kokkos.__file__)"
198+
199+
- name: Test
200+
run:
201+
python -m kokkos.test
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: "[Base] Python Package"
5+
6+
on:
7+
push:
8+
branches: [ main, develop ]
9+
pull_request:
10+
branches: [ main, develop ]
11+
paths:
12+
- 'base/**'
13+
- '.github/workflows/base-python-package.yml'
14+
15+
jobs:
16+
linting:
17+
strategy:
18+
matrix:
19+
python-version: [3.11, 3.12, 3.13]
20+
os: [ubuntu-latest, ubuntu-22.04]
21+
22+
runs-on: ${{matrix.os}}
23+
steps:
24+
- uses: actions/checkout@v2
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v2
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install flake8
33+
if [ -f base/requirements.txt ]; then pip install -r base/requirements.txt; fi
34+
- name: Lint with flake8
35+
working-directory: base
36+
run: |
37+
# stop the build if there are Python syntax errors or undefined names
38+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
39+
# flake8 options are defined in setup.cfg
40+
flake8 . --count --statistics
41+
42+
formatting:
43+
strategy:
44+
matrix:
45+
python-version: [3.13]
46+
os: [ubuntu-latest, ubuntu-22.04]
47+
48+
runs-on: ${{matrix.os}}
49+
steps:
50+
- uses: actions/checkout@v2
51+
- name: Set up Python ${{ matrix.python-version }}
52+
uses: actions/setup-python@v2
53+
with:
54+
python-version: ${{ matrix.python-version }}
55+
- name: Install dependencies
56+
run: |
57+
python -m pip install --upgrade pip
58+
pip install black
59+
if [ -f base/requirements.txt ]; then pip install -r base/requirements.txt; fi
60+
# Add LLVM key and install clang-16
61+
sudo apt-get update
62+
sudo apt-get install -y software-properties-common wget gnupg
63+
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
64+
DISTRIB_CODENAME=$(lsb_release -sc)
65+
echo "deb http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME}-16 main" | sudo tee /etc/apt/sources.list.d/llvm-16.list
66+
if sudo apt-get update 2>&1 | grep -q "llvm-toolchain-${DISTRIB_CODENAME}-16"; then
67+
echo "LLVM repository added successfully"
68+
fi
69+
if sudo apt-get install -y clang-format-16 2>/dev/null; then
70+
echo "Installed clang-format-16"
71+
echo "CLANG_FORMAT=clang-format-16" >> $GITHUB_ENV
72+
fi
73+
- name: black format
74+
working-directory: base
75+
run: |
76+
black --diff --check .
77+
- name: clang-format
78+
working-directory: base
79+
run: |
80+
set +e
81+
FILES=$(find include src examples -type f | egrep '\.hpp$|\.cpp$|\.cpp\.in$')
82+
FORMAT_OUT=$($CLANG_FORMAT -output-replacements-xml ${FILES})
83+
RET=$(echo ${FORMAT_OUT} | grep -c '<replacement ')
84+
if [ "${RET}" -ne 0 ]; then
85+
echo -e "\nError! Code not formatted. Detected ${RET} lines\n"
86+
$CLANG_FORMAT -i ${FILES}
87+
git diff
88+
exit ${RET}
89+
fi

.github/workflows/main_ci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ jobs:
2626
python -m pip install --upgrade pip
2727
python -m pip install --upgrade numpy mypy==1.0.1 cmake pytest pybind11 scikit-build patchelf
2828
- name: Install pykokkos-base
29+
working-directory: base
2930
run: |
30-
cd /tmp
31-
git clone https://github.com/kokkos/pykokkos-base.git
32-
cd pykokkos-base
3331
python setup.py install -- -DENABLE_LAYOUTS=ON -DENABLE_MEMORY_TRAITS=OFF -DENABLE_VIEW_RANKS=5
3432
- name: Install pykokkos
3533
run: |

.github/workflows/nightly.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,8 @@ jobs:
3737
cmake --build .
3838
cmake --install .
3939
- name: Install pykokkos-base
40+
working-directory: base
4041
run: |
41-
cd /tmp
42-
git clone https://github.com/kokkos/pykokkos-base.git
43-
cd pykokkos-base
4442
python setup.py install -- -DENABLE_LAYOUTS=ON -DENABLE_MEMORY_TRAITS=OFF -DKokkos_DIR=/tmp/kokkos_install/lib/cmake/Kokkos/ -DENABLE_INTERNAL_KOKKOS=OFF
4543
- name: Install pykokkos
4644
run: |

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,38 @@ https://kokkos.github.io/pykokkos/index.html
1414

1515
## Installation
1616

17-
Please follow the instructions at:
17+
### Quick Start
18+
19+
PyKokkos consists of two components that need to be installed separately:
20+
21+
1. **pykokkos-base** (C++ bindings to Kokkos)
22+
2. **pykokkos** (Python translation layer)
23+
24+
#### Installing pykokkos-base
25+
26+
```bash
27+
# Clone the repository
28+
git clone https://github.com/kokkos/pykokkos.git
29+
cd pykokkos/
30+
31+
# Create and activate conda environment
32+
conda create --name pyk --file base/requirements.txt python=3.11
33+
conda activate pyk
34+
35+
# Install pykokkos-base from the root directory
36+
python install_base.py install -- -DENABLE_LAYOUTS=ON -DENABLE_MEMORY_TRAITS=OFF -DENABLE_VIEW_RANKS=3 -DENABLE_CUDA=ON -DENABLE_THREADS=OFF -DENABLE_OPENMP=ON
37+
```
38+
39+
#### Installing pykokkos
40+
41+
After installing pykokkos-base:
42+
43+
```bash
44+
# Install pykokkos (ensure you're in the pyk environment)
45+
pip install -e .
46+
```
47+
48+
For more detailed installation instructions, please visit:
1849
https://kokkos.github.io/pykokkos/installation.html
1950

2051
## Citation

0 commit comments

Comments
 (0)