From 51d143338c16a3b89d4b788cef5b1897def2144f Mon Sep 17 00:00:00 2001 From: Hans Pabst Date: Thu, 4 Apr 2024 15:49:11 +0200 Subject: [PATCH] Fixed #776 * Citation: "Setting cudaLimitPrintfFifoSize must not be performed after launching any kernel that uses the printf() device system call - in such case cudaErrorInvalidValue will be returned." * Since DeviceSetLimit is governed by ACC_API_CALL, the symbol NDEBUG must not be defined for reproducing the issue. --- src/acc/cuda_hip/acc_dev.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/acc/cuda_hip/acc_dev.cpp b/src/acc/cuda_hip/acc_dev.cpp index 99c7969c4ce..4f3613f26fd 100644 --- a/src/acc/cuda_hip/acc_dev.cpp +++ b/src/acc/cuda_hip/acc_dev.cpp @@ -45,7 +45,11 @@ extern "C" int c_dbcsr_acc_set_active_device(int device_id) { ACC_API_CALL(Free, (0)); #if defined(__CUDA) || defined(__HIP_PLATFORM_NVCC__) - ACC_API_CALL(DeviceSetLimit, (ACC(LimitPrintfFifoSize), (size_t)1000000000)); + static bool once = false; + if (!once) { + ACC_API_CALL(DeviceSetLimit, (ACC(LimitPrintfFifoSize), (size_t)1000000000)); + once = true; + } #endif return 0;