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: ...@@ -13,7 +13,7 @@ stages:
include: include:
- project: 'eclipse/aidge/gitlab_shared_files' - project: 'eclipse/aidge/gitlab_shared_files'
ref: 'fix_cuda_release' ref: 'main'
file: file:
# choose which jobs to run by including the corresponding files. # choose which jobs to run by including the corresponding files.
- '.gitlab/ci/ubuntu_cpp.gitlab-ci.yml' - '.gitlab/ci/ubuntu_cpp.gitlab-ci.yml'
...@@ -25,3 +25,40 @@ include: ...@@ -25,3 +25,40 @@ include:
# - '.gitlab/ci/windows_python.gitlab-ci.yml' # - '.gitlab/ci/windows_python.gitlab-ci.yml'
# - '.gitlab/ci/release/cibuildwheel_windows.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) ...@@ -42,13 +42,6 @@ if(CMAKE_COMPILER_IS_GNUCXX AND COVERAGE)
Include(CodeCoverage) Include(CodeCoverage)
endif() 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 # Find system dependencies
############################################## ##############################################
...@@ -67,6 +60,13 @@ endif() ...@@ -67,6 +60,13 @@ endif()
########## ##########
# CUDA # 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) find_package(CUDAToolkit REQUIRED)
if(NOT DEFINED CMAKE_CUDA_STANDARD) if(NOT DEFINED CMAKE_CUDA_STANDARD)
set(CMAKE_CUDA_STANDARD 14) set(CMAKE_CUDA_STANDARD 14)
...@@ -76,6 +76,10 @@ if(NOT DEFINED CMAKE_CUDA_ARCHITECURE) ...@@ -76,6 +76,10 @@ if(NOT DEFINED CMAKE_CUDA_ARCHITECURE)
set(CMAKE_CUDA_ARCHITECTURE native) set(CMAKE_CUDA_ARCHITECTURE native)
endif() 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 STANDARD : ${CMAKE_CUDA_STANDARD}")
message(STATUS "CUDA ARCHITECTURE : ${CMAKE_CUDA_ARCHITECTURES}") message(STATUS "CUDA ARCHITECTURE : ${CMAKE_CUDA_ARCHITECTURES}")
......
...@@ -7,7 +7,7 @@ dependencies = [ ...@@ -7,7 +7,7 @@ dependencies = [
requires-python = ">= 3.7" requires-python = ">= 3.7"
readme = "README.md" readme = "README.md"
license = { file = "LICENSE" } license = { file = "LICENSE" }
classifiers = [ classifiers = [
"Development Status :: 2 - Pre-Alpha", "Development Status :: 2 - Pre-Alpha",
"Programming Language :: Python :: 3" "Programming Language :: Python :: 3"
] ]
...@@ -39,8 +39,6 @@ build-backend = "setuptools.build_meta" ...@@ -39,8 +39,6 @@ build-backend = "setuptools.build_meta"
[tool.cibuildwheel] [tool.cibuildwheel]
build-frontend = "build" build-frontend = "build"
test-requires = "pytest" 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" test-command = "pytest {project}/aidge_backend_cuda/unit_tests"
# uncomment to run cibuildwheel locally on selected distros # uncomment to run cibuildwheel locally on selected distros
# build=[ # build=[
...@@ -48,39 +46,64 @@ test-command = "pytest {project}/aidge_backend_cuda/unit_tests" ...@@ -48,39 +46,64 @@ test-command = "pytest {project}/aidge_backend_cuda/unit_tests"
# "cp39-manylinux_x86_64", # "cp39-manylinux_x86_64",
# "cp310-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 ### AIDGE DEPENDENCIES DECLARATION
[tool.cibuildwheel.environment] [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 BUILD_WITH_CUDA=1
AIDGE_DEPENDENCIES = "aidge_core aidge_backend_cpu" # format => "dep_1 dep_2 ... dep_n" AIDGE_DEPENDENCIES = "aidge_core aidge_backend_cpu" # format => "dep_1 dep_2 ... dep_n"
AIDGE_INSTALL="/AIDGE_INSTALL_CIBUILDWHEEL" 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] [tool.cibuildwheel.linux]
before-build = [ before-build = [
"yum repolist -v", "export CUDA_TOOLKIT_VERSION=$CUDA_MAJOR_VERSION-$CUDA_MINOR_VERSION",
"yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo", "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", "yum clean all",
"nvidia-smi", "yum -y install cuda-toolkit-$CUDA_TOOLKIT_VERSION.$ARCH",
"echo '\n\n\n\n yum -y install cuda-toolkit-12-5.x86_64'", "yum list available | grep cudnn",
"yum -y install cuda-toolkit-12-5.x86_64", "yum -y install libcudnn$CUDNN_VERSION-cuda-$CUDA_MAJOR_VERSION.$ARCH",
"ls -al /usr/local", "yum -y install libcudnn$CUDNN_VERSION-devel-cuda-$CUDA_MAJOR_VERSION.$ARCH",
"export PATH=$PATH:/usr/local/cuda/bin", "export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH",
"export PATH=/usr/local/cuda/bin:$PATH",
"which nvcc",
"nvcc --version", "nvcc --version",
"echo ''", "echo '\n\n\n\nInstalling required dependencies for aidge_backend_cuda.\n\n'",
"echo ''", "bash .gitlab/ci/cibuildwheel_build_deps_before_build_wheel.sh /host/$SEARCH_PATH"
"echo 'Installing required dependencies for aidge_backend_cuda.'",
"echo ''",
"bash .gitlab/ci/cibuildwheel_build_deps_before_build_wheel.sh /host"
] ]
before-test = [ before-test= [
"sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*", "export CUDA_TOOLKIT_VERSION=$CUDA_MAJOR_VERSION-$CUDA_MINOR_VERSION",
"sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*", "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/x86_64/cuda-rhel7.repo", "yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/$ARCH/cuda-rhel7.repo",
"yum clean all", "yum clean all",
"echo '\n\n\n\n yum -y install cuda-toolkit-11-8.x86_64'", "yum -y install cuda-toolkit-$CUDA_TOOLKIT_VERSION.$ARCH",
"yum -y install cuda-toolkit-11-8.x86_64", "yum list available | grep cudnn",
"ls -al /usr/local", "yum -y install libcudnn$CUDNN_VERSION-cuda-$CUDA_MAJOR_VERSION.$ARCH",
"export PATH=$PATH:/usr/local/cuda/bin", "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", "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] [tool.cibuildwheel.windows]
before-build = [ before-build = [
......
...@@ -80,6 +80,7 @@ class CMakeBuild(build_ext): ...@@ -80,6 +80,7 @@ class CMakeBuild(build_ext):
"-DPYBIND=ON", "-DPYBIND=ON",
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON", "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
"-DCOVERAGE=OFF", "-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