Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added basic support for surfaces and textures for CUDA. #45

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions sailfish/backend_cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ def to_buf_async(self, cl_buf, stream=None):
def from_buf_async(self, cl_buf, stream=None):
cuda.memcpy_dtoh_async(self.buffers[cl_buf], cl_buf, stream)

def get_texture(self, prog, texture_name):
return prog.get_texref(texture_name)

def get_surface(self, prog, surface_name):
return prog.get_surfref(surface_name)

def build(self, source):
if self.options.cuda_nvcc_opts:
import shlex
Expand Down
6 changes: 6 additions & 0 deletions sailfish/backend_dummy.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ def to_buf_async(self, *args):
def from_buf_async(self, *args):
pass

def get_texture(self, prog, texture_name):
pass

def get_surface(self, prog, surface_name):
pass

def get_defines(self):
return {
'warp_size': 32,
Expand Down
6 changes: 6 additions & 0 deletions sailfish/backend_opencl.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ def get_reduction_kernel(self, reduce_expr, map_expr, neutral, *args):
arguments=', '.join(arguments))
return lambda : kernel(*arrays).get()

def get_surface(self, name):
raise NotImplementedError()

def get_texture(self, name):
raise NotImplementedError()

def sync(self):
self.default_queue.finish()

Expand Down
6 changes: 6 additions & 0 deletions sailfish/subdomain_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,12 @@ def exec_kernel(self, name, args, args_format, needs_iteration=False,
self.backend.run_kernel(kernel, self._kernel_grid_full if grid is None
else grid)

def get_surface(self, name):
return self.backend.get_surface(self.module, name)

def get_texture(self, name):
return self.backend.get_texture(self.module, name)

def step(self, sync_req):
self._step_boundary(sync_req)
self._step_bulk(sync_req)
Expand Down