Skip to content
Snippets Groups Projects
Commit 38147dd3 authored by Grégoire Kubler's avatar Grégoire Kubler
Browse files

fix : created release cuda job that uses a shell executor instead of docker

This is a workaround for avoiding to run release job with a docker executor requires to use
CUDA with Docker in Docker (DinD).
No more need to pre install deps as they are pre installed on the runner.
parent 279e29d8
No related branches found
No related tags found
2 merge requests!38version 0.3.0,!19feat : release_pip
Pipeline #54937 passed
......@@ -13,7 +13,7 @@ stages:
include:
- project: 'eclipse/aidge/gitlab_shared_files'
ref: 'fix_cuda_release'
ref: 'main'
file:
# choose which jobs to run by including the corresponding files.
- '.gitlab/ci/ubuntu_cpp.gitlab-ci.yml'
......@@ -25,3 +25,40 @@ include:
# - '.gitlab/ci/windows_python.gitlab-ci.yml'
# - '.gitlab/ci/release/cibuildwheel_windows.gitlab-ci.yml'
release:pip:ubuntu:
tags:
- release:cuda
variables:
DOCKER_HOST: unix:///var/run/docker.sock
CIBW_ENVIRONMENT: >-
BUILD_WITH_CUDA=1
AIDGE_DEPENDENCIES='aidge_core aidge_backend_cpu'
AIDGE_INSTALL='/AIDGE_INSTALL_CIBUILDWHEEL'
CUDA_TOOLKIT_VERSION='11-8'
DOCKER_HOST='unix:///var/run/docker.sock'
ARCH='x86_64'
CUDNN_VERSION='9'
CUDA_MAJOR_VERSION='11'
CUDA_MINOR_VERSION='8'
SEARCH_PATH='/home/ubuntu/builds/$CI_RUNNER_SHORT_TOKEN/$CI_CONCURRENT_ID'
parallel:
matrix:
- CIBW_BUILD: "cp38-manylinux_x86_64"
- CIBW_BUILD: "cp39-manylinux_x86_64"
- CIBW_BUILD: "cp310-manylinux_x86_64"
before_script:
# retrieve aidge dependencies
- DEPENDENCY_JOB="build:ubuntu_python"
- !reference [.ubuntu:download:repositories, before_script] # located in common.gitlab-ci.yml
script:
- /home/ubuntu/.local/bin/cibuildwheel --output-dir wheelhouse
after_script:
# Ensure all files are owned by the correct user at the end of the job
- sudo chown -R $(whoami):$(whoami) .
......@@ -42,13 +42,6 @@ if(CMAKE_COMPILER_IS_GNUCXX AND COVERAGE)
Include(CodeCoverage)
endif()
enable_language(CUDA)
message(STATUS "Cuda compiler version = ${CMAKE_CUDA_COMPILER_VERSION}")
# Define a preprocessor macro with the Cuda compiler version
add_definitions(-DCUDA_COMPILER_VERSION="${CMAKE_CUDA_COMPILER_VERSION}")
##############################################
# Find system dependencies
##############################################
......@@ -67,6 +60,13 @@ endif()
##########
# CUDA
if(NOT $ENV{AIDGE_INSTALL} STREQUAL "")
message(WARNING "Env var CIBUILDWHEEL detected : currently building for a release job."
"\nSetting manually CUDACXX, PATH & LD_LIBRARY_PATH Variables")
list(APPEND ENV{LD_LIBRARY_PATH} /usr/local/cuda/lib64)
list(APPEND ENV{PATH} /usr/local/cuda/bin)
set(ENV{CUDACXX} /usr/local/cuda/bin/nvcc)
endif()
find_package(CUDAToolkit REQUIRED)
if(NOT DEFINED CMAKE_CUDA_STANDARD)
set(CMAKE_CUDA_STANDARD 14)
......@@ -76,6 +76,10 @@ if(NOT DEFINED CMAKE_CUDA_ARCHITECURE)
set(CMAKE_CUDA_ARCHITECTURE native)
endif()
message(STATUS "Cuda compiler version = ${CMAKE_CUDA_COMPILER_VERSION}")
# Define a preprocessor macro with the Cuda compiler version
add_definitions(-DCUDA_COMPILER_VERSION="${CMAKE_CUDA_COMPILER_VERSION}")
message(STATUS "CUDA STANDARD : ${CMAKE_CUDA_STANDARD}")
message(STATUS "CUDA ARCHITECTURE : ${CMAKE_CUDA_ARCHITECTURES}")
......
......@@ -7,7 +7,7 @@ dependencies = [
requires-python = ">= 3.7"
readme = "README.md"
license = { file = "LICENSE" }
classifiers = [
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Programming Language :: Python :: 3"
]
......@@ -39,8 +39,6 @@ build-backend = "setuptools.build_meta"
[tool.cibuildwheel]
build-frontend = "build"
test-requires = "pytest"
# pass command line options to 'docker create'
container-engine = { name = "docker", create-args = ["--gpus", "all"]}
test-command = "pytest {project}/aidge_backend_cuda/unit_tests"
# uncomment to run cibuildwheel locally on selected distros
# build=[
......@@ -48,39 +46,64 @@ test-command = "pytest {project}/aidge_backend_cuda/unit_tests"
# "cp39-manylinux_x86_64",
# "cp310-manylinux_x86_64"
# ]
[tool.cibuildwheel.container-engine]
# pass command line options to 'docker run'
name = "docker"
create-args = [
"--runtime=nvidia",
"--gpus", "all",
"--privileged",
"-v","/cache",
"-v","/var/run/docker.sock:/var/run/docker.sock",
]
### AIDGE DEPENDENCIES DECLARATION
[tool.cibuildwheel.environment]
# These variables are here for debug purpose but their values when called from CI are set in .gitlab-ci.yml
BUILD_WITH_CUDA=1
AIDGE_DEPENDENCIES = "aidge_core aidge_backend_cpu" # format => "dep_1 dep_2 ... dep_n"
AIDGE_INSTALL="/AIDGE_INSTALL_CIBUILDWHEEL"
ARCH="x86_64"
CUDNN_VERSION="9"
CUDA_MAJOR_VERSION="11"
CUDA_MINOR_VERSION="8"
DOCKER_HOST="unix:///var/run/docker.sock"
SEARCH_PATH="/home/ubuntu/aidge/aidge" # debug path
# these two following variables are set within CMakeLists.txt when calling cibuildwheel from CI
LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH"
PATH="/usr/local/cuda/bin:$PATH"
[tool.cibuildwheel.linux]
before-build = [
"yum repolist -v",
"yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo",
"export CUDA_TOOLKIT_VERSION=$CUDA_MAJOR_VERSION-$CUDA_MINOR_VERSION",
"echo '\n\n\n\n yum -y install cuda-toolkit-$CUDA_TOOLKIT_VERSION.$ARCH'",
"yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/$ARCH/cuda-rhel7.repo",
"yum clean all",
"nvidia-smi",
"echo '\n\n\n\n yum -y install cuda-toolkit-12-5.x86_64'",
"yum -y install cuda-toolkit-12-5.x86_64",
"ls -al /usr/local",
"export PATH=$PATH:/usr/local/cuda/bin",
"yum -y install cuda-toolkit-$CUDA_TOOLKIT_VERSION.$ARCH",
"yum list available | grep cudnn",
"yum -y install libcudnn$CUDNN_VERSION-cuda-$CUDA_MAJOR_VERSION.$ARCH",
"yum -y install libcudnn$CUDNN_VERSION-devel-cuda-$CUDA_MAJOR_VERSION.$ARCH",
"export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH",
"export PATH=/usr/local/cuda/bin:$PATH",
"which nvcc",
"nvcc --version",
"echo ''",
"echo ''",
"echo 'Installing required dependencies for aidge_backend_cuda.'",
"echo ''",
"bash .gitlab/ci/cibuildwheel_build_deps_before_build_wheel.sh /host"
"echo '\n\n\n\nInstalling required dependencies for aidge_backend_cuda.\n\n'",
"bash .gitlab/ci/cibuildwheel_build_deps_before_build_wheel.sh /host/$SEARCH_PATH"
]
before-test = [
"sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*",
"sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*",
"yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo",
before-test= [
"export CUDA_TOOLKIT_VERSION=$CUDA_MAJOR_VERSION-$CUDA_MINOR_VERSION",
"echo '\n\n\n\n yum -y install cuda-toolkit-$CUDA_TOOLKIT_VERSION.$ARCH'",
"yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/$ARCH/cuda-rhel7.repo",
"yum clean all",
"echo '\n\n\n\n yum -y install cuda-toolkit-11-8.x86_64'",
"yum -y install cuda-toolkit-11-8.x86_64",
"ls -al /usr/local",
"export PATH=$PATH:/usr/local/cuda/bin",
"yum -y install cuda-toolkit-$CUDA_TOOLKIT_VERSION.$ARCH",
"yum list available | grep cudnn",
"yum -y install libcudnn$CUDNN_VERSION-cuda-$CUDA_MAJOR_VERSION.$ARCH",
"yum -y install libcudnn$CUDNN_VERSION-devel-cuda-$CUDA_MAJOR_VERSION.$ARCH",
"export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH",
"export PATH=/usr/local/cuda/bin:$PATH",
"nvcc --version",
"bash .gitlab/ci/cibuildwheel_build_deps_before_build_wheel.sh /host"
"echo '\n\n\n\nInstalling required dependencies for aidge_backend_cuda.\n\n'",
"bash .gitlab/ci/cibuildwheel_build_deps_before_build_wheel.sh /host/$SEARCH_PATH"
]
[tool.cibuildwheel.windows]
before-build = [
......
......@@ -80,6 +80,7 @@ class CMakeBuild(build_ext):
"-DPYBIND=ON",
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
"-DCOVERAGE=OFF",
"-DCMAKE_CUDA_ARCHITECTURES=native",
]
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment