From ca17e888f4084310291e023de9020320a50e9264 Mon Sep 17 00:00:00 2001 From: Stephan Seitz <stephan.seitz@fau.de> Date: Mon, 13 Jan 2020 10:09:32 +0100 Subject: [PATCH] Re-add code for CubicInterpolationCUDA --- pystencils/gpucuda/cudajit.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/pystencils/gpucuda/cudajit.py b/pystencils/gpucuda/cudajit.py index 28ec47d0b..eb2492f61 100644 --- a/pystencils/gpucuda/cudajit.py +++ b/pystencils/gpucuda/cudajit.py @@ -45,17 +45,20 @@ def make_python_function(kernel_function_node, argument_dict=None, custom_backen if USE_FAST_MATH: nvcc_options.append("-use_fast_math") - # Code for - # if any(t.interpolation_mode == InterpolationMode.CUBIC_SPLINE for t in textures): - # assert isdir(join(dirname(__file__), "CubicInterpolationCUDA", "code")), \ - # "Submodule CubicInterpolationCUDA does not exist" - # nvcc_options += ["-I" + join(dirname(__file__), "CubicInterpolationCUDA", "code")] - # nvcc_options += ["-I" + join(dirname(__file__), "CubicInterpolationCUDA", "code", "internal")] - - # needed_dims = set(t.field.spatial_dimensions for t in textures - # if t.interpolation_mode == InterpolationMode.CUBIC_SPLINE) - # for i in needed_dims: - # code = 'extern "C++" {\n#include "cubicTex%iD.cu"\n}\n' % i + code + # Code for CubicInterpolationCUDA + from pystencils.interpolation_astnodes import InterpolationMode + from os.path import join, dirname, isdir + + if any(t.interpolation_mode == InterpolationMode.CUBIC_SPLINE for t in textures): + assert isdir(join(dirname(__file__), "CubicInterpolationCUDA", "code")), \ + "Submodule CubicInterpolationCUDA does not exist" + nvcc_options += ["-I" + join(dirname(__file__), "CubicInterpolationCUDA", "code")] + nvcc_options += ["-I" + join(dirname(__file__), "CubicInterpolationCUDA", "code", "internal")] + + needed_dims = set(t.field.spatial_dimensions for t in textures + if t.interpolation_mode == InterpolationMode.CUBIC_SPLINE) + for i in needed_dims: + code = 'extern "C++" {\n#include "cubicTex%iD.cu"\n}\n' % i + code mod = SourceModule(code, options=nvcc_options, include_dirs=[ get_pystencils_include_path(), get_pycuda_include_path()]) -- GitLab