Skip to content

Commit

Permalink
split generate
Browse files Browse the repository at this point in the history
  • Loading branch information
geohot committed Nov 26, 2023
1 parent 19af20e commit 6effcb0
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 34 deletions.
80 changes: 51 additions & 29 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,56 @@ on:
workflow_dispatch:

jobs:
buildpackage:
name: Build Package
buildhip:
strategy:
fail-fast: false
matrix:
task: [hip, cuda, opencl]
name: Build ${{ matrix.task }}
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install ctypeslib
run: |
git clone [email protected]:geohot/ctypeslib.git
cd ctypeslib
pip install .
- name: Install HIP
run: |
sudo mkdir --parents --mode=0755 /etc/apt/keyrings
wget https://repo.radeon.com/rocm/rocm.gpg.key -O - | gpg --dearmor | sudo tee /etc/apt/keyrings/rocm.gpg > /dev/null
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/5.7.1 jammy main" | sudo tee --append /etc/apt/sources.list.d/rocm.list
echo -e 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' | sudo tee /etc/apt/preferences.d/rocm-pin-600
sudo apt update
sudo apt install rocm-hip-sdk
- name: Generate headers
run: ./generate.sh
- name: Install gpuctypes
run: pip install .
- name: Test gpuctypes
run: python3 -c "import gpuctypes.hip"
timeout-minutes: 10

steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install ctypeslib
run: |
git clone [email protected]:geohot/ctypeslib.git
cd ctypeslib
pip install .
- name: Install HIP
if: ${{ matrix.task == 'hip' }}
run: |
sudo mkdir --parents --mode=0755 /etc/apt/keyrings
wget https://repo.radeon.com/rocm/rocm.gpg.key -O - | gpg --dearmor | sudo tee /etc/apt/keyrings/rocm.gpg > /dev/null
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/5.7.1 jammy main" | sudo tee --append /etc/apt/sources.list.d/rocm.list
echo -e 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' | sudo tee /etc/apt/preferences.d/rocm-pin-600
sudo apt update -y
sudo apt install -y --no-install-recommends rocm-hip-sdk
- name: Install CUDA
if: ${{ matrix.task == 'cuda' }}
run: |
echo 'Acquire::http::Pipeline-Depth "5";' | sudo tee -a /etc/apt/apt.conf.d/99parallel
sudo apt update -y
sudo apt install -y --no-install-recommends git g++ cmake ninja-build llvm-15-dev zlib1g-dev libglew-dev \
flex bison libfl-dev libboost-thread-dev libboost-filesystem-dev nvidia-cuda-toolkit-gcc
- name: Install OpenCL
if: ${{ matrix.task == 'opencl' }}
run: |
echo "deb [ allow-insecure=yes ] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt update -y
sudo apt install --allow-unauthenticated -y --no-install-recommends \
intel-oneapi-runtime-openmp=2023.2.1-16 intel-oneapi-runtime-compilers-common=2023.2.1-16 intel-oneapi-runtime-compilers=2023.2.1-16 \
intel-oneapi-runtime-dpcpp-sycl-opencl-cpu=2023.2.1-16 intel-oneapi-runtime-tbb-common=2021.10.0-49541 \
intel-oneapi-runtime-tbb=2021.10.0-49541 intel-oneapi-runtime-opencl=2023.2.1-16
- name: Generate headers
run: ./generate_${{ matrix.task }}.sh
- name: Install gpuctypes
run: pip install .
- name: Test gpuctypes
run: python3 -c "import gpuctypes.${{ matrix.task }}"

5 changes: 0 additions & 5 deletions generate.sh

This file was deleted.

3 changes: 3 additions & 0 deletions generate_cuda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
clang2py /usr/include/cuda.h /usr/include/nvrtc.h -o gpuctypes/cuda.py -l /usr/lib/x86_64-linux-gnu/libcuda.so -l /usr/lib/x86_64-linux-gnu/libnvrtc.so
grep FIXME_STUB gpuctypes/cuda.py
3 changes: 3 additions & 0 deletions generate_hip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
clang2py /opt/rocm/include/hip/hiprtc.h /opt/rocm/include/hip/hip_runtime_api.h /opt/rocm/include/hip/driver_types.h --clang-args="-D__HIP_PLATFORM_AMD__ -I/opt/rocm/include" -o gpuctypes/hip.py -l /opt/rocm/lib/libhiprtc.so -l /opt/rocm/lib/libamdhip64.so
grep FIXME_STUB gpuctypes/hip.py
3 changes: 3 additions & 0 deletions generate_opencl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
clang2py /usr/include/CL/cl.h -o gpuctypes/opencl.py -l /usr/lib/x86_64-linux-gnu/libOpenCL.so
grep FIXME_STUB gpuctypes/opencl.py

0 comments on commit 6effcb0

Please sign in to comment.