From 8e1a04ec0476ca7554ea8642fcfcd26f9f9a0466 Mon Sep 17 00:00:00 2001 From: Jiacheng Xu <13862180016@163.com> Date: Wed, 21 Oct 2026 14:13:59 +0800 Subject: [PATCH 1/2] Fix DDLA device error checks Use the external ddla::DEVICE_CHECK function exposed by DDLA v0.0.4. The LibRI macro rename in 123517d incorrectly changed these calls as well. --- include/RI/global/gpu/GPU_Backend.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/RI/global/gpu/GPU_Backend.h b/include/RI/global/gpu/GPU_Backend.h index ac96458..17301e9 100644 --- a/include/RI/global/gpu/GPU_Backend.h +++ b/include/RI/global/gpu/GPU_Backend.h @@ -107,7 +107,7 @@ inline void validate_local_gpu_count(const MPI_Comm& communicator) int device_count = 0; #ifdef __DDLA_RI - ddla::DEVICE_CHECK_RI(ddla::deviceGetDeviceCount(&device_count)); + ddla::DEVICE_CHECK(ddla::deviceGetDeviceCount(&device_count)); #elif defined(__MAGMA_RI) device_count = Magma_Wrapper::magma_get_size(); #endif @@ -174,7 +174,7 @@ inline void allocate(T** pointer, std::size_t count) return; } #ifdef __DDLA_RI - ddla::DEVICE_CHECK_RI(ddla::deviceMalloc(pointer, count * sizeof(T))); + ddla::DEVICE_CHECK(ddla::deviceMalloc(pointer, count * sizeof(T))); #elif defined(__MAGMA_RI) MAGMA_CHECK_RI(magma_malloc(reinterpret_cast(pointer), count * sizeof(T))); #endif @@ -186,7 +186,7 @@ inline void free(T* pointer) if (pointer == nullptr) return; #ifdef __DDLA_RI - ddla::DEVICE_CHECK_RI(ddla::deviceFree(pointer)); + ddla::DEVICE_CHECK(ddla::deviceFree(pointer)); #elif defined(__MAGMA_RI) MAGMA_CHECK_RI(magma_free(pointer)); #endif @@ -199,7 +199,7 @@ inline void upload( if (count == 0) return; #ifdef __DDLA_RI - ddla::DEVICE_CHECK_RI(deviceMemcpyAsync( + ddla::DEVICE_CHECK(deviceMemcpyAsync( device_data, host_data, count * sizeof(T), ddla::deviceMemcpyHostToDevice, stream(queue))); #elif defined(__MAGMA_RI) @@ -215,7 +215,7 @@ inline void download( if (count == 0) return; #ifdef __DDLA_RI - ddla::DEVICE_CHECK_RI(deviceMemcpyAsync( + ddla::DEVICE_CHECK(deviceMemcpyAsync( host_data, device_data, count * sizeof(T), ddla::deviceMemcpyDeviceToHost, stream(queue))); #elif defined(__MAGMA_RI) @@ -229,7 +229,7 @@ inline void memset(void* pointer, int value, std::size_t bytes, Queue queue) if (bytes == 0) return; #ifdef __DDLA_RI - ddla::DEVICE_CHECK_RI(deviceMemsetAsync( + ddla::DEVICE_CHECK(deviceMemsetAsync( pointer, value, bytes, stream(queue))); #elif defined(__MAGMA_RI) MAGMA_CHECK_RI(magma_memset(pointer, value, bytes)); @@ -239,7 +239,7 @@ inline void memset(void* pointer, int value, std::size_t bytes, Queue queue) inline void sync(Queue queue) { #ifdef __DDLA_RI - ddla::DEVICE_CHECK_RI( + ddla::DEVICE_CHECK( ddla::deviceStreamSynchronize(stream(queue))); #elif defined(__MAGMA_RI) magma_queue_sync(queue); From e2f92bcb4d5919b0b9778d282a58b219547b09cd Mon Sep 17 00:00:00 2001 From: Jiacheng Xu <13862180016@163.com> Date: Wed, 21 Oct 2026 14:14:00 +0800 Subject: [PATCH 2/2] Update GPU contraction cleanup calls Follow the cleanup API split from 6ce3c84, releasing locks and removing empty result entries through the same helpers as the CPU paths. --- include/RI/ri/LRI-cal_loop3_GPU.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/RI/ri/LRI-cal_loop3_GPU.hpp b/include/RI/ri/LRI-cal_loop3_GPU.hpp index ef38254..d2b220f 100644 --- a/include/RI/ri/LRI-cal_loop3_GPU.hpp +++ b/include/RI/ri/LRI-cal_loop3_GPU.hpp @@ -2690,7 +2690,8 @@ void LRI::cal_loop3_GPU( LRI_Cal_Aux::add_Ds_omp_wait_map(Ds_result_thread, Ds_result, lock_Ds_result_add_map, fac_add_Ds); } // end #pragma omp parallel - LRI_Cal_Aux::destroy_lock_result(lock_Ds_result_add_map, Ds_result); + LRI_Cal_Aux::destroy_lock(lock_Ds_result_add_map); + LRI_Cal_Aux::destroy_Ds_result(Ds_result); #ifdef __MKL_RI mkl_set_num_threads(mkl_threads); #endif