Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Include GPU in wheels #479

Draft
wants to merge 43 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
4bf007a
GPU in wheels, attempt 1
95-martin-orion Nov 16, 2021
2b230f7
Checking for nvcc binary
95-martin-orion Nov 16, 2021
0c57285
PATH testing
95-martin-orion Nov 16, 2021
9d6eac3
Appease YAML
95-martin-orion Nov 16, 2021
d2c2c00
CIBW PATH
95-martin-orion Nov 16, 2021
bbb7a50
jumping YAML hoops
95-martin-orion Nov 16, 2021
85220a7
CIBW which nvcc
95-martin-orion Nov 16, 2021
033d67f
hardcoded PATH
95-martin-orion Nov 19, 2021
178f51b
yaml fixup
95-martin-orion Nov 19, 2021
2a5ff71
pwd and ls
95-martin-orion Dec 1, 2021
bf2061d
rm CIBW_TEST_COMMAND_LINUX
95-martin-orion Dec 1, 2021
74942aa
the mystery deepens
95-martin-orion Dec 3, 2021
dc6a9e8
env-pass
95-martin-orion Dec 3, 2021
43db2ca
script-based CUDA install
95-martin-orion Dec 3, 2021
159aec6
bash the .sh
95-martin-orion Dec 3, 2021
c53ce63
don't sudo what's already sudone
95-martin-orion Dec 3, 2021
925cc0b
preload deps to prevent reboot
95-martin-orion Dec 3, 2021
4c85cd3
double install, yay
95-martin-orion Dec 3, 2021
1142a18
ooc install, ic no pre-install
95-martin-orion Dec 3, 2021
bf7d029
move script into qsim
95-martin-orion Dec 10, 2021
95e2d73
export directly
95-martin-orion Dec 10, 2021
3a6b86f
need more data
95-martin-orion Dec 10, 2021
6033c9f
sourcery
95-martin-orion Dec 10, 2021
578264f
version and which-nvcc check
95-martin-orion Dec 10, 2021
247bdda
passthrough PATH
95-martin-orion Dec 10, 2021
47361d1
move the env
95-martin-orion Dec 10, 2021
aed7e6a
less PATH is more PATH
95-martin-orion Dec 13, 2021
164974c
and without changing the PATH...
95-martin-orion Dec 13, 2021
9671f4a
remove which nvcc also
95-martin-orion Dec 13, 2021
a09c4ad
pass unmodified PATH
95-martin-orion Dec 13, 2021
ba997ef
path after PATH
95-martin-orion Dec 21, 2021
29d4993
LD_LIBRARY_PATH passthrough
95-martin-orion Dec 21, 2021
1026221
find Python (not libs)
95-martin-orion Dec 21, 2021
9989069
find all components
95-martin-orion Dec 21, 2021
2dc97e0
install python-devel
95-martin-orion Dec 21, 2021
08080f8
prioritize CUDA in PATH
95-martin-orion Dec 21, 2021
3095486
try version pin
95-martin-orion Dec 23, 2021
f2e0707
Merge branch 'master' into qsim-gha-gpu
95-martin-orion Jan 5, 2022
f9e88d3
Skip GPU tests on GPU-less machines
95-martin-orion Jan 5, 2022
168c9ee
Fix Windows test; potential Ubuntu flake
95-martin-orion Jan 6, 2022
c0a864b
Split out qsimcirq-gpu
95-martin-orion Jan 26, 2022
921d08f
Merge branch 'qsim-split' into qsim-gha-gpu
95-martin-orion Jan 26, 2022
e798db0
format
95-martin-orion Jan 26, 2022
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
17 changes: 15 additions & 2 deletions .github/workflows/testing_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ jobs:
CIBW_BUILD: "${{ matrix.cibw.build || '*' }}"
CIBW_ARCHS: "${{ matrix.cibw.arch || 'auto' }}"
CIBW_MANYLINUX_X86_64_IMAGE: "${{ matrix.cibw.manylinux_image }}"
CIBW_BEFORE_ALL_LINUX: "bash build_tools/cuda_install.sh && echo $PATH"
# Testing: wrong immintrin headers may be due to PATH priority order.
# Switched new CUDA paths to front in attempt to fix.
CIBW_ENVIRONMENT_LINUX: PATH=/usr/local/cuda-11/bin:$PATH LD_LIBRARY_PATH=/usr/local/cuda-11/lib64:$LD_LIBRARY_PATH
CIBW_ENVIRONMENT_PASS_LINUX: PATH LD_LIBRARY_PATH
CIBW_BEFORE_BUILD_MACOS: "brew install libomp"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: ""
# due to package and module name conflict have to temporarily move it away to run tests
Expand All @@ -52,11 +57,19 @@ jobs:
# Used to host cibuildwheel
- uses: actions/setup-python@v2

# Install NVCC on Ubuntu to include GPU in the wheel.
- name: cuda-toolkit
if: ${{ matrix.os == 'ubuntu-20.04' }}
uses: Jimver/[email protected]
with:
cuda: "11.5.1"

- name: Install cibuildwheel and twine
run: python -m pip install cibuildwheel==1.11.0

- name: Run C++ tests
run: bash build_tools/test_libs.sh
# temporary
# - name: Run C++ tests
# run: bash build_tools/test_libs.sh

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
Expand Down
31 changes: 31 additions & 0 deletions build_tools/cuda_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
set -x

# install dependencies
kernel_version=$(uname -r)
yum clean all
yum install -y kernel
yum install -y kernel-devel-${kernel_version} kernel-headers-${kernel_version} pciutils

# install python and CUDA toolkit
# TODO: need to pin version

yum install -y yum-utils epel-release
yum install -y python3-devel.x86_64
yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo
yum clean all
yum -y install nvidia-driver-latest-dkms cuda
yum -y install cuda-drivers

# post-install actions

# commented to allow outer PATH-setting
# export PATH=/usr/local/cuda-11/bin:$PATH
# export LD_LIBRARY_PATH=/usr/local/cuda-11/lib64:$LD_LIBRARY_PATH

# works here, does not escape to build process
nvcc --version
which nvcc
nvidia-smi

set +x
2 changes: 1 addition & 1 deletion pybind_interface/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if(NOT pybind11_POPULATED)
add_subdirectory(${pybind11_SOURCE_DIR} ${pybind11_BINARY_DIR})
endif()

find_package(PythonLibs 3.6 REQUIRED)
find_package(Python 3.6 REQUIRED COMPONENTS Interpreter Development)
find_package(CUDA REQUIRED)

include_directories(${PYTHON_INCLUDE_DIRS} ${pybind11_SOURCE_DIR}/include)
Expand Down