Commit ac358af3 authored by Niklas Eiling's avatar Niklas Eiling
Browse files

CI: prepare remote execution of CUDA in the CI

cmake now links CUDA applications dynamically to the runtime API
all cricket dependencies and cricket itself are now installed in Dockerfile.dev
add new targets to .gitlab-ci.yml for CUDA tests
parent 597ff4b6
......@@ -19,6 +19,7 @@ stages:
docker:
stage: prepare
script:
- cp -r ~/.ssh .
- docker build
--file Packaging/Docker/Dockerfile.dev
--tag ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
......@@ -34,7 +35,7 @@ docker:
- shell
- linux
build:linux:
.build:linux:
stage: build
script:
- mkdir -p build
......@@ -70,7 +71,7 @@ build:linux-cuda:
tags:
- docker
build:windows:
.build:windows:
stage: build
script:
- New-Item -ItemType Directory -Force -Path build
......@@ -125,7 +126,7 @@ build:windows:
# tags:
# - docker
generate:docs:
.generate:docs:
stage: generate
script:
- make -j$(nproc) -C build docs
......@@ -140,7 +141,7 @@ generate:docs:
tags:
- docker
generate:packages:
.generate:packages:
stage: generate
script:
- make -j$(nproc) -C build package
......@@ -174,7 +175,7 @@ build:docker:
only:
- tags
test:jupyter:
.test:jupyter:
stage: test
variables:
PYTHONPATH: "build/Source/Python:Source/Python"
......@@ -189,9 +190,46 @@ test:jupyter:
paths:
- outputs/Examples/Notebooks/
.remote-gpu:
stage: test
variables:
GPU_TARGET: 'gitlab-runner@ghost'
RDIR: '/tmp/gitlab-jobs/$CI_PROJECT_NAME/$CI_JOB_ID'
CI_DIR: '$CI_BUILDS_DIR/$CI_PROJECT_PATH'
LDIR: '/cricket/bin'
TEST_FILES: ''
script:
- ls $TEST_BINARY_PATH
- ldd $TEST_BINARY_PATH/$TEST_BINARY | sed -n -E -e 's/^\s+\S+ => (\S+) \S+$/\1/p' | xargs -I % cp % $LDIR
- echo "$TEST_BINARY_PATH/$TEST_BINARY $TEST_FILES" | tr -d '\n' | xargs -r -d " " -I % cp % $LDIR
- ssh $GPU_TARGET mkdir -p $RDIR
- scp -r $LDIR/* $GPU_TARGET:$RDIR/
- ssh $GPU_TARGET "LD_LIBRARY_PATH=$RDIR:$${LD_LIBRARY_PATH} LD_PRELOAD=$RDIR/cricket-server.so $RDIR/$TEST_BINARY" &
- sleep 2
- PATH=$LDIR:$PATH LD_PRELOAD=$LDIR/libtirpc.so.3:$LDIR/cricket-client.so $LDIR/$TEST_BINARY
after_script:
#- ssh $GPU_TARGET rm -rf $RDIR
- ssh $GPU_TARGET pkill -fe -2 $RDIR/test_kernel
image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
dependencies:
- build:linux-cuda
tags:
- docker
test:cuda:
extends: .remote-gpu
variables:
TEST_BINARY: 'WSCC_9bus_mult_decoupled'
TEST_BINARY_PATH: 'build/Examples/Cxx'
TEST_FILES: '/usr/local/lib64/libvillas.so.1
Examples/CIM/grid-data/WSCC-09/WSCC-09_RX/WSCC-09_RX_DI.xml
Examples/CIM/grid-data/WSCC-09/WSCC-09_RX/WSCC-09_RX_EQ.xml
Examples/CIM/grid-data/WSCC-09/WSCC-09_RX/WSCC-09_RX_SV.xml
Examples/CIM/grid-data/WSCC-09/WSCC-09_RX/WSCC-09_RX_TP.xml'
# Stage deploy
##############################################################################
pages:
.pages:
stage: deploy
script:
- cp -r build/docs/sphinx/html/. public/sphinx
......@@ -207,7 +245,7 @@ pages:
- shell
- linux
deploy:docker:
.deploy:docker:
stage: deploy
script:
- docker push ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
......@@ -222,7 +260,7 @@ deploy:docker:
only:
- tags
deploy:packages:
.deploy:packages:
stage: deploy
script:
- rsync ${RSYNC_OPTS} build/*.rpm ${DEPLOY_USER}@${DEPLOY_HOST}:/var/www/packages/fedora/29/x86_64
......
......@@ -117,8 +117,36 @@ cmake_dependent_option(WITH_OPENMP "Enable OpenMP-based parallelisation" ON "O
cmake_dependent_option(WITH_CUDA "Enable CUDA-based parallelisation" ON "CUDA_FOUND" OFF)
if(WITH_CUDA)
# BEGIN OF WORKAROUND - enable cuda dynamic linking.
# Starting with Cmake 3.17 we can use
# set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "SHARED") instead
set( CMAKE_CUDA_FLAGS "" CACHE STRING "" )
if ( CMAKE_CUDA_FLAGS )
list(REMOVE_ITEM CMAKE_CUDA_FLAGS "-cudart static")
endif()
string(APPEND CMAKE_CUDA_FLAGS "-cudart shared")
# END OF WORKAROUND
enable_language(CUDA)
# BEGIN OF WORKAROUND - enable cuda dynamic linking.
if ( CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES )
list( REMOVE_ITEM CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "cudart_static" )
list( REMOVE_ITEM CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "cudadevrt" )
list( APPEND CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "cudart" )
endif()
if ( CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES )
list( REMOVE_ITEM CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES "cudart_static" )
list( REMOVE_ITEM CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES "cudadevrt" )
list( APPEND CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES "cudart" )
endif()
if ( CUDA_LIBRARIES )
list ( REMOVE_ITEM CUDA_LIBRARIES "${CUDA_cudart_static_LIBRARY}")
list ( APPEND CUDA_LIBRARIES "${CUDA_CUDART_LIBRARY}")
endif()
# END OF WORKAROUND
endif()
option(BUILD_SHARED_LIBS "Build shared library" OFF)
option(BUILD_EXAMPLES "Build C++ examples" ON)
......
......@@ -44,6 +44,18 @@ RUN dnf -y install https://developer.download.nvidia.com/compute/cuda/repos/fedo
ENV PATH="/usr/local/cuda/bin:${PATH}"
ENV LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}"
# CUDARPC and dependencies
RUN dnf install -y make bash git gcc autoconf libtool automake
RUN dnf install -y ncurses-devel zlib-devel binutils-devel mesa-libGL-devel libvdpau-devel mesa-libEGL-devel openssl-devel rpcbind rpcgen
ENV LD_LIBRARY_PATH="/usr/local/lib:/usr/local/lib64:${LD_LIBRARY_PATH}"
# copy gitlab-runner ssh credentials into build container
COPY --chown=root .ssh /root/.ssh
RUN git clone --recurse-submodules https://git.rwth-aachen.de/niklas.eiling/cricket.git && \
cd cricket && \
make -j 32 LOG=INFO
ENV PATH="$PWD/cricket/bin:${PATH}"
ENV LD_LIBRARY_PATH="$PWD/cricket/bin:${LD_LIBRARY_PATH}"
# Install some debuginfos
RUN dnf -y debuginfo-install \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment