Skip to content

Commit 4375b96

Browse files
committed
ci - enable rust cuda tests again
1 parent 5afa78a commit 4375b96

2 files changed

Lines changed: 66 additions & 66 deletions

File tree

.gitlab-ci.yml

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -170,54 +170,54 @@ noether-cpu:
170170
# ----------------------------------------------------------------------------------------
171171
# Rust + CUDA
172172
# ----------------------------------------------------------------------------------------
173-
#noether-rust-qfunctions:
174-
# stage: test:gpu-and-float
175-
# tags:
176-
# - cuda
177-
# interruptible: true
178-
# before_script:
179-
# # Environment
180-
# - export COVERAGE=1 CC=gcc-14 CXX=g++-14 FC=gfortran-14 NVCC=nvcc GPU_CLANG=1
181-
# - export NPROC_POOL=1
182-
# - echo "-------------- nproc ---------------" && NPROC_CPU=$(nproc) && NPROC_GPU=$(($(nproc)<8?$(nproc):8)) && echo "NPROC_CPU" $NPROC_CPU && echo "NPROC_GPU" $NPROC_GPU
183-
# - echo "-------------- CC ------------------" && $CC --version
184-
# - echo "-------------- CXX -----------------" && $CXX --version
185-
# - echo "-------------- FC ------------------" && $FC --version
186-
# - echo "-------------- NVCC ----------------" && $NVCC --version
187-
# - echo "-------------- Rustc ---------------" && rustc --version
188-
# - echo "-------------- Clang++ -------------" && clang++ --version
189-
# - echo "-------------- GCOV ----------------" && gcov-14 --version
190-
# script:
191-
# - rm -f .SUCCESS
192-
# # Rustup
193-
# - rustup update nightly
194-
# - rustup component add rust-src --toolchain nightly
195-
# - rustup component add llvm-tools --toolchain nightly
196-
# # libCEED
197-
# - make configure OPT='-g -O0 -fno-inline -march=native -ffp-contract=fast' CUDA_DIR=/usr/local/cuda-12.9
198-
# - echo "-------------- libCEED -------------" && make info
199-
# - make clean
200-
# - make -k -j$NPROC_CPU -l$NPROC_CPU
201-
# # -- libCEED only tests
202-
# - echo "-------------- Rust QFunction tests -----"
203-
# # Note: PETSC_DIR is set by default in GitLab runner env, unsetting to isolate core tests
204-
# - export PETSC_DIR= PETSC_ARCH=
205-
# - make -k -j$((NPROC_GPU / NPROC_POOL)) JUNIT_BATCH="rust-qfunction" junit search=rustqfunction
206-
# # Report status
207-
# - touch .SUCCESS
208-
# after_script:
209-
# - |
210-
# if [ -f .SUCCESS ]; then
211-
# lcov --directory . --capture --output-file coverage.info --ignore-errors source,mismatch;
212-
# bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F interface;
213-
# bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F gallery;
214-
# bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F backends;
215-
# fi
216-
# artifacts:
217-
# paths:
218-
# - build/*.junit
219-
# reports:
220-
# junit: build/*.junit
173+
noether-rust-qfunctions:
174+
stage: test:gpu-and-float
175+
tags:
176+
- cuda
177+
interruptible: true
178+
before_script:
179+
# Environment
180+
- export COVERAGE=1 CC=gcc-14 CXX=g++-14 FC=gfortran-14 NVCC=nvcc CEED_CLANG_CUDA_CXX=clang++-22
181+
- export NPROC_POOL=1
182+
- echo "-------------- nproc ---------------" && NPROC_CPU=$(nproc) && NPROC_GPU=$(($(nproc)<8?$(nproc):8)) && echo "NPROC_CPU" $NPROC_CPU && echo "NPROC_GPU" $NPROC_GPU
183+
- echo "-------------- CC ------------------" && $CC --version
184+
- echo "-------------- CXX -----------------" && $CXX --version
185+
- echo "-------------- FC ------------------" && $FC --version
186+
- echo "-------------- NVCC ----------------" && $NVCC --version
187+
- echo "-------------- Rustc ---------------" && rustc --version
188+
- echo "-------------- Clang++ -------------" && clang++ --version
189+
- echo "-------------- GCOV ----------------" && gcov-14 --version
190+
script:
191+
- rm -f .SUCCESS
192+
# Rustup
193+
- rustup update nightly
194+
- rustup component add rust-src --toolchain nightly
195+
- rustup component add llvm-tools --toolchain nightly
196+
# libCEED
197+
- make configure OPT='-g -O0 -fno-inline -march=native -ffp-contract=fast' CUDA_DIR=/usr/local/cuda-12.9
198+
- echo "-------------- libCEED -------------" && make info
199+
- make clean
200+
- make -k -j$NPROC_CPU -l$NPROC_CPU
201+
# -- libCEED only tests
202+
- echo "-------------- Rust QFunction tests -----"
203+
# Note: PETSC_DIR is set by default in GitLab runner env, unsetting to isolate core tests
204+
- export PETSC_DIR= PETSC_ARCH=
205+
- make -k -j$((NPROC_GPU / NPROC_POOL)) JUNIT_BATCH="rust-qfunction" junit search=rustqfunction
206+
# Report status
207+
- touch .SUCCESS
208+
after_script:
209+
- |
210+
if [ -f .SUCCESS ]; then
211+
lcov --directory . --capture --output-file coverage.info --ignore-errors source,mismatch;
212+
bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F interface;
213+
bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F gallery;
214+
bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${CODECOV_ACCESS_TOKEN} -F backends;
215+
fi
216+
artifacts:
217+
paths:
218+
- build/*.junit
219+
reports:
220+
junit: build/*.junit
221221

222222

223223
# ----------------------------------------------------------------------------------------

backends/cuda/ceed-cuda-compile.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -303,16 +303,16 @@ static int CeedCompileCore_Cuda(Ceed ceed, const char *source, const bool throw_
303303
Ceed_Cuda *ceed_data;
304304

305305
CeedCallBackend(CeedGetData(ceed, &ceed_data));
306-
char *llvm_command = ceed_data->llvm_command;
306+
char *llvm_cxx = ceed_data->llvm_cxx;
307307

308308
// First check for user LLVM version
309-
if (!llvm_command) {
309+
if (!llvm_cxx) {
310310
const char *user_cxx = getenv("CEED_CLANG_CUDA_CXX");
311311
CeedDebug(ceed, "Attempting to detect user specified LLVM compiler\nUser LLVM compiler: %s\n", user_cxx);
312312

313313
// Check if valid Clang
314-
bool is_valid = true;
315-
{
314+
bool is_valid = false;
315+
if (user_cxx) {
316316
std::string command = std::string(user_cxx) + " --version 2>&1";
317317

318318
CeedDebug(ceed, "Checking user LLVM compiler...");
@@ -321,14 +321,14 @@ static int CeedCompileCore_Cuda(Ceed ceed, const char *source, const bool throw_
321321

322322
if (is_valid) {
323323
CeedDebug(ceed, "User specified LLVM compiler is valid\n");
324-
CeedCall(CeedStringAllocCopy(user_cxx, &ceed_data->llvm_command));
325-
llvm_command = ceed_data->llvm_command;
324+
CeedCall(CeedStringAllocCopy(user_cxx, &ceed_data->llvm_cxx));
325+
llvm_cxx = ceed_data->llvm_cxx;
326326
} else {
327327
CeedDebug(ceed, "Could not invoke user specified LLVM compiler\n");
328328
}
329329
}
330330
// Next query Rust for LLVM version
331-
if (!llvm_command) {
331+
if (!llvm_cxx) {
332332
command = "$(find $(rustup run " + std::string(rust_toolchain) + " rustc --print sysroot) -name llvm-link) --version";
333333
CeedDebug(ceed, "Attempting to detect Rust LLVM version\ncommand:\n$ %s", command.c_str());
334334
FILE *output_stream = popen((command + std::string(" 2>&1")).c_str(), "r");
@@ -355,7 +355,7 @@ static int CeedCompileCore_Cuda(Ceed ceed, const char *source, const bool throw_
355355
CeedDebug(ceed, "Detected Rust LLVM version: %d", llvm_version);
356356

357357
// Check if valid Clang
358-
bool is_valid = true;
358+
bool is_valid = false;
359359
std::string rust_cxx = std::string("clang++-") + std::to_string(llvm_version);
360360
{
361361
std::string command = std::string(rust_cxx) + " --version 2>&1";
@@ -366,19 +366,19 @@ static int CeedCompileCore_Cuda(Ceed ceed, const char *source, const bool throw_
366366

367367
if (is_valid) {
368368
CeedDebug(ceed, "Detected Rust LLVM compiler: %s\n", rust_cxx.c_str());
369-
CeedCall(CeedStringAllocCopy(rust_cxx.c_str(), &ceed_data->llvm_command));
370-
llvm_command = ceed_data->llvm_command;
369+
CeedCall(CeedStringAllocCopy(rust_cxx.c_str(), &ceed_data->llvm_cxx));
370+
llvm_cxx = ceed_data->llvm_cxx;
371371
}
372372
}
373-
if (!llvm_command) CeedDebug(ceed, "Could not invoke detected Rust LLVM compiler\n");
373+
if (!llvm_cxx) CeedDebug(ceed, "Could not invoke detected Rust LLVM compiler\n");
374374
}
375375
// Default to clang++
376-
if (!llvm_command) {
376+
if (!llvm_cxx) {
377377
CeedDebug(ceed, "Default LLVM compiler: clang++\n");
378-
CeedCall(CeedStringAllocCopy("clang++", &ceed_data->llvm_command));
379-
llvm_command = ceed_data->llvm_command;
378+
CeedCall(CeedStringAllocCopy("clang++", &ceed_data->llvm_cxx));
379+
llvm_cxx = ceed_data->llvm_cxx;
380380
{
381-
std::string command = std::string(llvm_command) + " --version 2>&1";
381+
std::string command = std::string(llvm_cxx) + " --version 2>&1";
382382

383383
CeedDebug(ceed, "Checking default LLVM compiler...");
384384
CeedCallSystem_Unchecked(ceed, command.c_str(), "checking default LLVM compiler", NULL);
@@ -387,9 +387,9 @@ static int CeedCompileCore_Cuda(Ceed ceed, const char *source, const bool throw_
387387

388388
// Compile wrapper kernel
389389
CeedCallCuda(ceed, cudaGetDeviceProperties(&prop, ceed_data->device_id));
390-
command = (llvm_command ? std::string(llvm_command) : std::string("clang++")) + " -flto=thin --cuda-gpu-arch=sm_" + std::to_string(prop.major) +
391-
std::to_string(prop.minor) + " --cuda-device-only -emit-llvm -S temp/kernel_" + std::to_string(build_id) +
392-
"_0_source.cu -o temp/kernel_" + std::to_string(build_id) + "_1_wrapped.ll ";
390+
command = std::string(llvm_cxx) + " -flto=thin --cuda-gpu-arch=sm_" + std::to_string(prop.major) + std::to_string(prop.minor) +
391+
" --cuda-device-only -emit-llvm -S temp/kernel_" + std::to_string(build_id) + "_0_source.cu -o temp/kernel_" +
392+
std::to_string(build_id) + "_1_wrapped.ll ";
393393
command += opts[4];
394394
CeedCallSystem(ceed, command.c_str(), "JiT kernel source");
395395
CeedCallSystem(ceed, ("chmod 0777 temp/kernel_" + std::to_string(build_id) + "_1_wrapped.ll").c_str(), "update JiT file permissions");

0 commit comments

Comments
 (0)