From 6f60fe4eccde4ec1d7d1a50719222024d1034876 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Mon, 15 Aug 2022 18:54:05 -0500 Subject: [PATCH] Add warning about out-of-stream cleanup --- src/cpp/cuda.hpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cpp/cuda.hpp b/src/cpp/cuda.hpp index f60bb1d9..18079ab4 100644 --- a/src/cpp/cuda.hpp +++ b/src/cpp/cuda.hpp @@ -159,9 +159,12 @@ typedef Py_ssize_t PYCUDA_BUFFER_SIZE_T; << std::endl; \ } #define CUDAPP_CATCH_CLEANUP_ON_DEAD_CONTEXT(TYPE) \ - catch (pycuda::cannot_activate_out_of_thread_context) \ - { } \ - catch (pycuda::cannot_activate_dead_context) \ + catch (pycuda::cannot_activate_out_of_thread_context &e) \ + { \ + PyErr_Warn( \ + PyExc_UserWarning, #TYPE " in out-of-thread context could not be cleaned up"); \ + } \ + catch (pycuda::cannot_activate_dead_context &e) \ { \ /* PyErr_Warn( \ PyExc_UserWarning, #TYPE " in dead context was implicitly cleaned up");*/ \ -- GitLab