diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1c2606707d16cd401e575354a1cbb99a11451ff8..ab168fa457ad6b2fb472ecc8aae883882c956713 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -40,9 +40,10 @@ release:pip:ubuntu: DOCKER_HOST='unix:///var/run/docker.sock' ARCH='x86_64' CUDNN_VERSION='9' - CUDA_MAJOR_VERSION='11' - CUDA_MINOR_VERSION='8' + CUDA_MAJOR_VERSION='12' + CUDA_MINOR_VERSION='4' SEARCH_PATH='/home/ubuntu/builds/$CI_RUNNER_SHORT_TOKEN/$CI_CONCURRENT_ID' + CIBW_REPAIR_WHEEL_COMMAND='' parallel: matrix: diff --git a/.gitlab/ci/cibuildwheel_build_deps_before_build_wheel.sh b/.gitlab/ci/cibuildwheel_build_deps_before_build_wheel.sh index 4f74488ae41714a4ce03ba7514bf93842768c5ae..c702c0da2cff2e17ea6bc61b5ccbd29a7e389e94 100755 --- a/.gitlab/ci/cibuildwheel_build_deps_before_build_wheel.sh +++ b/.gitlab/ci/cibuildwheel_build_deps_before_build_wheel.sh @@ -17,6 +17,7 @@ else -name "$repo" \ -not -path "*/install/*" \ -not -path "*/.git/*" \ + -not -path "*/.mypy_cache/*" \ -not -path "*/miniconda/*" \ -not -path "*/conda/*" \ -not -path "*/.local/*" \ diff --git a/CMakeLists.txt b/CMakeLists.txt index bea1b398ced94f3ec4da97b5db6237fd9882d87d..7a013f1bd78fa082570963510715154b6578e390 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,11 +28,11 @@ set(module_name _${CMAKE_PROJECT_NAME}) # target name ############################################## # Define options -option(PYBIND "python binding" OFF) -option(WERROR "Warning as error" OFF) -option(TEST "Enable tests" ON) -option(COVERAGE "Enable coverage" OFF) -option(ENABLE_ASAN "Enable ASan (AddressSanitizer) for runtime analysis of memory use (over/underflow, memory leak, ...)" OFF) +option(PYBIND "python binding (Default: OFF)" OFF) +option(WERROR "Warning as error (Default: OFF)" OFF) +option(TEST "Enable tests (Default: ON)" ON) +option(COVERAGE "Enable coverage (Default: OFF)" OFF) +option(ENABLE_ASAN "Enable ASan (AddressSanitizer) for runtime analysis of memory use (over/underflow, memory leak, ...) (Default: OFF)" OFF) ############################################## # Import utils CMakeLists @@ -60,14 +60,14 @@ endif() ########## # CUDA -if(NOT $ENV{AIDGE_INSTALL} STREQUAL "") +if(NOT $ENV{CIBUILDWHEEL} 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 12 REQUIRED) if(NOT DEFINED CMAKE_CUDA_STANDARD) set(CMAKE_CUDA_STANDARD 14) set(CMAKE_CUDA_STANDARD_REQUIRED ON) @@ -97,7 +97,7 @@ if (PYBIND) # Handles Python + pybind11 headers dependencies include(PybindModuleCreation) # creates a target of the same name as CMAKE_PROJECT_NAME - generate_python_binding(${CMAKE_PROJECT_NAME} ${module_name}) # the python bindings module has the same name as the project. + generate_python_binding(${CMAKE_PROJECT_NAME} ${module_name}) # the python bindings module has the same name as the project. target_link_libraries(${module_name} PUBLIC @@ -110,9 +110,10 @@ endif() target_link_libraries(${module_name} PUBLIC _aidge_core # _ is added because we link the target not the project - CUDA::cudart + PRIVATE CUDA::cublas cudnn + CUDA::cudart ) if( ${ENABLE_ASAN} ) diff --git a/README.md b/README.md index 09e16ed4f48371ff11093aa69a17c576c2b8d173..835aa2a36f5fe362b297049cb30ac5371f2cea0c 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ You can find in this folder the library that implements the CUDA operators. ## Installation ### Dependencies +- [CUDA ToolKit 12.4](https://developer.nvidia.com/cuda-12-4-0-download-archive) +- [CUDnn9](https://developer.nvidia.com/cudnn-downloads) make sure to install the CUDA 12 compatible version - `GCC` - `Make`/`Ninja` - `CMake` diff --git a/cmake/PybindModuleCreation.cmake b/cmake/PybindModuleCreation.cmake index 8f386bef59ed86dfa366eca5d4fccae24b28d24e..69b5f7d9a3b989387a10b8abb50ae36fc0f31b29 100644 --- a/cmake/PybindModuleCreation.cmake +++ b/cmake/PybindModuleCreation.cmake @@ -20,6 +20,18 @@ function(generate_python_binding pybind_module_name target_to_bind) file(GLOB_RECURSE pybind_src_files "python_binding/*.cpp") pybind11_add_module(${pybind_module_name} MODULE ${pybind_src_files} "NO_EXTRAS") # NO EXTRA recquired for pip install - target_include_directories(${pybind_module_name} PUBLIC "python_binding") - target_link_libraries(${pybind_module_name} PUBLIC ${target_to_bind}) + target_include_directories(${pybind_module_name} PRIVATE "python_binding") + target_link_libraries(${pybind_module_name} + PRIVATE + ${target_to_bind} + CUDA::cublas + cudnn + CUDA::cudart + ) + set_property(TARGET ${pybind_module_name} PROPERTY POSITION_INDEPENDENT_CODE ON) + set_target_properties(${pybind_module_name} PROPERTIES CUDA_SEPARABLE_COMPILATION ON) + set_target_properties(${pybind_module_name} PROPERTIES + CMAKE_SHARED_LINKER_FLAGS "-Wl,--exclude-libs,ALL" + ) + set_target_properties(${module} PROPERTIES INSTALL_RPATH "") endfunction() diff --git a/pyproject.toml b/pyproject.toml index 911af058463e100bc35453315919ec8bda3f2845..be53307e21fc57f4198e65e7af799e1e1cb1a6d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,6 +47,8 @@ test-command = "pytest {project}/aidge_backend_cuda/unit_tests" # "cp310-manylinux_x86_64" # ] +repair-wheel-command = "" + [tool.cibuildwheel.container-engine] # pass command line options to 'docker run' name = "docker" @@ -66,8 +68,8 @@ AIDGE_DEPENDENCIES = "aidge_core aidge_backend_cpu" # format => "dep_1 dep_2 ... AIDGE_INSTALL="/AIDGE_INSTALL_CIBUILDWHEEL" ARCH="x86_64" CUDNN_VERSION="9" -CUDA_MAJOR_VERSION="11" -CUDA_MINOR_VERSION="8" +CUDA_MAJOR_VERSION="12" +CUDA_MINOR_VERSION="4" 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 @@ -103,7 +105,8 @@ before-test= [ "export PATH=/usr/local/cuda/bin:$PATH", "nvcc --version", "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" + "pip install aidge-core", + "pip install aidge-backend-cpu", ] [tool.cibuildwheel.windows] before-build = [ diff --git a/unit_tests/CMakeLists.txt b/unit_tests/CMakeLists.txt index 807adc55e8c85f31f5e94013e174bf8cbc5a2320..7677257f324fea7ebb24a96c9088c0ac06cadc54 100644 --- a/unit_tests/CMakeLists.txt +++ b/unit_tests/CMakeLists.txt @@ -16,7 +16,14 @@ add_executable(tests${module_name} ${src_files}) target_link_libraries(tests${module_name} PUBLIC ${module_name}) -target_link_libraries(tests${module_name} PRIVATE Catch2::Catch2WithMain) +target_link_libraries(tests${module_name} + PRIVATE + Catch2::Catch2WithMain + CUDA::cudart + cudnn + CUDA::cublas + +) list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras) include(CTest)