From 2f236042121e20d580dd01d24729b6034d7d9e73 Mon Sep 17 00:00:00 2001 From: Matthias Diener <mdiener@illinois.edu> Date: Mon, 3 Oct 2022 15:46:25 -0500 Subject: [PATCH] Disable SVM on Nvidia CL when running pytest (#200) * disable SVM on Nvidia CL when running pytest * undo previous changes * disable in pytest actx --- arraycontext/pytest.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/arraycontext/pytest.py b/arraycontext/pytest.py index 1eceb49..f84915b 100644 --- a/arraycontext/pytest.py +++ b/arraycontext/pytest.py @@ -100,8 +100,21 @@ class _PytestPyOpenCLArrayContextFactoryWithClass(PytestPyOpenCLArrayContextFact # On some implementations (notably Intel CPU), holding a reference # to a queue does not keep the context alive. ctx, queue = self.get_command_queue() + + alloc = None + + if queue.device.platform.name == "NVIDIA CUDA": + from pyopencl.tools import ImmediateAllocator + alloc = ImmediateAllocator(queue) + + from warnings import warn + warn("Disabling SVM due to memory leak " + "in Nvidia CL when running pytest. " + "See https://github.com/inducer/arraycontext/issues/196") + return self.actx_class( queue, + allocator=alloc, force_device_scalars=self.force_device_scalars) def __str__(self): @@ -141,7 +154,19 @@ class _PytestPytatoPyOpenCLArrayContextFactory(PytestPyOpenCLArrayContextFactory # On some implementations (notably Intel CPU), holding a reference # to a queue does not keep the context alive. ctx, queue = self.get_command_queue() - return self.actx_class(queue) + + alloc = None + + if queue.device.platform.name == "NVIDIA CUDA": + from pyopencl.tools import ImmediateAllocator + alloc = ImmediateAllocator(queue) + + from warnings import warn + warn("Disabling SVM due to memory leak " + "in Nvidia CL when running pytest. " + "See https://github.com/inducer/arraycontext/issues/196") + + return self.actx_class(queue, allocator=alloc) def __str__(self): return ("<PytatoPyOpenCLArrayContext for <pyopencl.Device '%s' on '%s'>>" % -- GitLab