Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Commit

Permalink
port Subset to cuda
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushikcfd committed Apr 23, 2020
1 parent b72d95f commit dd7717a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions pyop2/gpu/cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit dd7717a

Please sign in to comment.