From ebcaef73ae91521ef0a3077047d55179242dd9ae Mon Sep 17 00:00:00 2001 From: Klaus Reuter <khr@mpcdf.mpg.de> Date: Thu, 21 Jul 2022 11:21:52 +0200 Subject: [PATCH] extend to cuda example --- .gitlab-ci.yml | 34 +++++++++++++++++++++++++++++++++- test_cuda.cu | 10 ++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 test_cuda.cu diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ea10cda..251e8fd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ python_test_numpy: image: python:3.9 tags: - - docker + - cloud cache: key: "python39_pip_cache_20220731" paths: @@ -12,3 +12,35 @@ python_test_numpy: - pip install numpy==1.22.4 script: - python test_numpy.py + +stages: + - build + - test + +cuda_build_on_cpu_runner: + image: gitlab-registry.mpcdf.mpg.de/mpcdf/module-image + tags: + - cloud + stage: build + cache: + key: "$CI_COMMIT_SHA" + paths: + - bin + script: + - module load cuda/11.4 + - mkdir -p bin + - nvcc -o bin/test_cuda.exe test_cuda.cu + +cuda_test_on_gpu_runner: + image: gitlab-registry.mpcdf.mpg.de/mpcdf/module-image + tags: + - cloud-gpu + stage: test + cache: + key: "$CI_COMMIT_SHA" + paths: + - bin + script: + - module load cuda/11.4 + - ./bin/test_cuda.exe + diff --git a/test_cuda.cu b/test_cuda.cu new file mode 100644 index 0000000..24928f9 --- /dev/null +++ b/test_cuda.cu @@ -0,0 +1,10 @@ +#include <cstdio> + +__global__ void cuda_hello(){ + printf("Hello World from GPU!\n"); +} + +int main() { + cuda_hello<<<1,1>>>(); + return 0; +} -- GitLab