From dd7717a76a0abc46ed280bb93e97d414c7beaf39 Mon Sep 17 00:00:00 2001 From: Kaushik Kulkarni Date: Thu, 23 Apr 2020 11:41:56 -0500 Subject: [PATCH] port Subset to cuda --- pyop2/gpu/cuda.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pyop2/gpu/cuda.py b/pyop2/gpu/cuda.py index 93499bbab..96e58ef19 100644 --- a/pyop2/gpu/cuda.py +++ b/pyop2/gpu/cuda.py @@ -100,6 +100,17 @@ def _kernel_args_(self): return (m_gpu,) +class Subset(Subset): + """ + ExtrudedSet for GPU. + """ + @cached_property + def _kernel_args_(self): + m_gpu = cuda.mem_alloc(int(self._indices.nbytes)) + cuda.memcpy_htod(m_gpu, self._indices) + return self._superset._kernel_args_ + (m_gpu, ) + + class Dat(petsc_Dat): """ Dat for GPU. @@ -385,7 +396,7 @@ def argtypes(self): def argshapes(self): argshapes = ((), ()) if self._iterset._argtypes_: - # TODO: verify that this bogus value doesn't affect anyone. + # FIXME: Do not put in a bogus value argshapes += ((), ) for arg in self._args: @@ -605,7 +616,7 @@ def insn_needs_atomic(insn): raise ValueError("gpu_strategy can be 'scpt'," " 'user_specified_tile' or 'auto_tile'.") elif program.name in ["wrap_zero", "wrap_expression_kernel", - "wrap_pyop2_kernel_uniform_extrusion", + "wrap_expression", "wrap_pyop2_kernel_uniform_extrusion", "wrap_form_cell_integral_otherwise", ]: from pyop2.gpu.snpt import snpt_transform