add additional checks for cuda library #74
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unit Tests | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
mactest: | |
name: Mac OpenCL Test | |
runs-on: macos-13 | |
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 gpuctypes | |
run: pip install . | |
- name: Run OpenCL test | |
run: python3 test/test_opencl.py -v | |
buildhip: | |
strategy: | |
fail-fast: false | |
matrix: | |
task: [hip, cuda, opencl] | |
name: Build ${{ matrix.task }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Make apt fast | |
run: echo 'Acquire::http::Pipeline-Depth "5";' | sudo tee -a /etc/apt/apt.conf.d/99parallel | |
- 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: | | |
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 | |
nvcc -V | |
- 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 \ | |
opencl-headers ocl-icd-opencl-dev \ | |
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: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Install ctypeslib | |
run: | | |
sudo apt-get install -y --no-install-recommends clang | |
pip install clang==14.0.6 | |
git clone https://github.com/geohot/ctypeslib.git | |
cd ctypeslib | |
pip install . | |
clang2py -V | |
- name: Generate headers | |
run: | | |
mv gpuctypes/${{ matrix.task }}.py gpuctypes/${{ matrix.task }}.py.bak | |
./generate_${{ matrix.task }}.sh | |
- name: Install gpuctypes | |
run: pip install . | |
- name: Test gpuctypes import | |
run: python3 -c "import gpuctypes.${{ matrix.task }} as ${{ matrix.task }}" | |
- name: Run device specific test | |
run: python3 test/test_${{ matrix.task }}.py -v | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Generated ${{ matrix.task }} Header | |
path: gpuctypes/${{ matrix.task }}.py | |
- name: Confirm the generated headers match the committed | |
run: diff gpuctypes/${{ matrix.task }}.py.bak gpuctypes/${{ matrix.task }}.py | |