Skip to content
Snippets Groups Projects

Opencl datahandling

Closed Stephan Seitz requested to merge seitz/pystencils:opencl-datahandling into master
Compare and
19 files
+ 358
56
Preferences
Compare changes
Files
19
@@ -5,6 +5,7 @@ import numpy as np
import sympy as sp
from sympy.core import S
from sympy.printing.ccode import C89CodePrinter
from pystencils.astnodes import KernelFunction, Node
from pystencils.cpu.vectorization import vec_all, vec_any
from pystencils.data_types import (
@@ -344,6 +345,9 @@ class CustomSympyPrinter(CCodePrinter):
result = super(CustomSympyPrinter, self)._print_Piecewise(expr)
return result.replace("\n", "")
def _print_Type(self, node):
return str(node)
def _print_Function(self, expr):
infix_functions = {
bitwise_xor: '^',
@@ -356,7 +360,7 @@ class CustomSympyPrinter(CCodePrinter):
return expr.to_c(self._print)
if isinstance(expr, reinterpret_cast_func):
arg, data_type = expr.args
return "*((%s)(& %s))" % (PointerType(data_type, restrict=False), self._print(arg))
return "*((%s)(& %s))" % (self._print(PointerType(data_type, restrict=False)), self._print(arg))
elif isinstance(expr, address_of):
assert len(expr.args) == 1, "address_of must only have one argument"
return "&(%s)" % self._print(expr.args[0])