Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 4ef36643 authored by hhakim's avatar hhakim
Browse files

Enable GPU C++ tests if the gitlab-runner has the cuda tag + refactor gpu_mod...

Enable GPU C++ tests if the gitlab-runner has the cuda tag + refactor gpu_mod building in a specific script + parallel building.

Enabling parallel building in ctest (eight jobs at a time).
parent 52f6d6cb
No related branches found
No related tags found
No related merge requests found
......@@ -38,10 +38,11 @@ stages:
- conda_pkgs
ctest:
variables: {SLOW_TESTS: "OFF", BUILD_MULTITHREAD: "ON", GCOV_FLAGS: "ON"} # the CDashConfScript is able to retrieve OpenMP_gomp_LIBRARY and OpenMP_INC_DIR from environment (it's necessary on macOS, so the runner's env. must be configured)
variables: {SLOW_TESTS: "OFF", BUILD_MULTITHREAD: "ON", GCOV_FLAGS: "ON", GIT_SUBMODULE_STRATEGY: recursive} # the CDashConfScript is able to retrieve OpenMP_gomp_LIBRARY and OpenMP_INC_DIR from environment (it's necessary on macOS, so the runner's env. must be configured)
coverage: '/Coverage: \d+\.\d+\%/'
script:
- ctest -O ctest.log -S ./CDashConfScript.cmake -j4 --output-junit junit_output.xml
- if echo $CI_RUNNER_TAGS | grep -w cuda; then export USE_GPU_MOD=ON; ./misc/continuous_integration/jobs/linux/build_gpu_mod.sh 11.6; export LD_LIBRARY_PATH=$PWD/gpu_mod/build-cu11.6; export CUDA_VERSIONS=cu11.6;fi # enable GPU tests if the runner is capable of
- ctest -O ctest.log -S ./CDashConfScript.cmake -j4 --output-junit junit_output.xml || echo "forcing job to continue"
- misc/continuous_integration/jobs/gcovr_report.sh
- misc/continuous_integration/jobs/junit_html_report.sh cpp_test_report
- if grep -B 1 'Outcome:.*Failed' $(ls build*/cpp_test_report.html | tail -1) | sed -ne 's%.*Test case:.*<b>\(.*\)</b>.*%\1%p'; then exit 1; else echo "all tests passed"; exit 0; fi
......@@ -57,11 +58,11 @@ ctest:
- ctest_coverage
when: always
expire_in: '6 months'
only:
# C++ tests are executed only if something was modified in C++ lib or C++ tests
changes:
- src/**/*
- misc/test/src/C++/**/*
# only:
# # C++ tests are executed only if something was modified in C++ lib or C++ tests
# changes:
# - src/**/*
# - misc/test/src/C++/**/*
ctest_python:
before_script:
......@@ -296,10 +297,6 @@ pkg_macos:
.win_build_gpu_mod: &win_build_gpu_mod
before_script:
# - move gpu_mod gpu_mod2 #del /Q /S gpu_mod\* # & rmdir gpu_mod & mkdir gpu_mod
# - mkdir gpu_mod
# - git submodule sync --recursive
# - git submodule update --init --recursive
- call misc\continuous_integration\jobs\win\build_gpu_mod.bat
pkg_win:
......@@ -326,13 +323,8 @@ pkg_win:
.build_gpu_mod: &build_gpu_mod
before_script: # TODO: loop on the two versions
- cd gpu_mod; if [[ ! -d build-cu12.1 ]]; then mkdir build-cu12.1; fi; cd build-cu12.1
- cmake -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-12.1 -DCMAKE_CUDA_COMPILER=/usr/local/cuda-12.1/bin/nvcc .. && make -j8
- cd ../..
- cd gpu_mod; if [[ ! -d build-cu11.4 ]]; then mkdir build-cu11.4; fi; cd build-cu11.4
- cmake -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.4 -DCMAKE_CUDA_COMPILER=/usr/local/cuda-11.4/bin/nvcc .. && make -j8
- cd ../..
before_script:
- ./misc/continuous_integration/jobs/linux/build_gpu_mod.sh
pkg_linux:
<<: *build_gpu_mod
......
......@@ -87,6 +87,10 @@ else() #WIN32
set(CONF_OPTIONS "${CONF_OPTIONS} -DCMAKE_INSTALL_PREFIX=C:/Users/$ENV{USERNAME}")
endif()
if((UNIX OR WIN32) AND DEFINED ENV{USE_GPU_MOD})
set(CONF_OPTIONS "${CONF_OPTIONS} -DUSE_GPU_MOD=$ENV{USE_GPU_MOD}")
endif()
set(CONF_OPTIONS "${CONF_OPTIONS} -DEXPERIMENTAL_PKG=ON -DBUILD_TESTING=ON")
#ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) # no need to empty build dir. because
......@@ -102,7 +106,7 @@ set(CTEST_CONFIGURE_COMMAND "${CMAKE_COMMAND} ${CONF_OPTIONS} ${CTEST_SOURCE_DIR
message(STATUS "CONFIGURE COMMAND: ${CTEST_CONFIGURE_COMMAND}")
CTEST_CONFIGURE() #OPTIONS ${CONF_OPTIONS} doesn't work (even with a list()) so we set the ctest_configure_command above
# no OPTIONS (arg)
CTEST_BUILD(TARGET install) #need to install for python tests (quickstart.py)
CTEST_BUILD(TARGET install FLAGS -j4) #need to install for python tests (quickstart.py)
#CTEST_BUILD()
#IF(UNIX)
......
......@@ -696,15 +696,19 @@ if(USE_GPU_MOD)
endif(UNIX)
# TODO: used versions of CUDA and include dir should be CMake variables
# do not support CUDA 9.2 on Windows (require too old version VS <= 2017)
set(CUDA_VERSIONS cu11.4)
set(CUDA_VERSIONS cu12.1;cu11.4)
if (DEFINED ENV{CUDA_VERSIONS})
set(CUDA_VERSIONS $ENV{CUDA_VERSIONS})
else()
set(CUDA_VERSIONS cu11.4)
set(CUDA_VERSIONS cu12.1;cu11.4)
endif()
foreach(CUDA_CONF IN LISTS CUDA_VERSIONS)
string(REGEX REPLACE "\\." "-${CUDA_CONF}." GPU_MOD_LIB_CUDA_CONF ${GPU_MOD_LIB})
# if ${GPU_MOD_LIB} is already a symlink, then we've already gone through it, skip
if(NOT IS_SYMLINK ${GPU_MOD_INCLUDE_DIR}/../build-${CUDA_CONF}/${GPU_MOD_LIB})
file(COPY ${GPU_MOD_INCLUDE_DIR}/../build-${CUDA_CONF}/${GPU_MOD_LIB} DESTINATION ${PROJECT_BINARY_DIR})
file(RENAME ${PROJECT_BINARY_DIR}/${GPU_MOD_LIB} ${GPU_MOD_INCLUDE_DIR}/../build-${CUDA_CONF}/${GPU_MOD_LIB_CUDA_CONF})
if (CUDA_CONF MATCHES "cu12.1")
if (CUDA_CONF MATCHES "cu12")
file(CREATE_LINK ${GPU_MOD_LIB_CUDA_CONF} ${GPU_MOD_INCLUDE_DIR}/../build-${CUDA_CONF}/${GPU_MOD_LIB} RESULT SYMLINK_OK SYMBOLIC)
install(FILES ${GPU_MOD_INCLUDE_DIR}/../build-${CUDA_CONF}/${GPU_MOD_LIB} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_EXECUTE WORLD_READ)
endif()
......
#!/usr/bin/env bash
DEFAULT_VERSIONS="11.4 12.1"
if [ $# -lt 1 ]
then
CUDA_VERSIONS="$DEFAULT_VERSIONS"
else
CUDA_VERSIONS=$*
fi
for CU_VER in $CUDA_VERSIONS
do
cd gpu_mod; if [[ ! -d build-$CU_VER ]]; then mkdir build-cu$CU_VER; fi; cd build-cu$CU_VER
cmake -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-$CU_VER -DCMAKE_CUDA_COMPILER=/usr/local/cuda-$CU_VER/bin/nvcc .. && make -j8
cd ../..
done
......@@ -2,6 +2,10 @@
#include "faust_MatButterfly.h"
#include <cstdio>
/**
* Unit tests for Faust::MatButterfly<FPP, Cpu>.
*/
typedef @TEST_FPP@ FPP;
using namespace Faust;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment