Skip to content
Snippets Groups Projects
Commit 3e00ddfd authored by Martin Bauer's avatar Martin Bauer
Browse files

demo notebook & fixes in gitlab-ci.yml

parent 4fa8a3b6
Branches
Tags
No related merge requests found
...@@ -3,7 +3,7 @@ from sympy.utilities.codegen import CCodePrinter ...@@ -3,7 +3,7 @@ from sympy.utilities.codegen import CCodePrinter
from pystencils.ast import Node from pystencils.ast import Node
def printCCode(astNode): def generateC(astNode):
""" """
Prints the abstract syntax tree as C function Prints the abstract syntax tree as C function
""" """
...@@ -11,7 +11,7 @@ def printCCode(astNode): ...@@ -11,7 +11,7 @@ def printCCode(astNode):
return printer(astNode) return printer(astNode)
def printCudaCode(astNode): def generateCUDA(astNode):
printer = CBackend(cuda=True) printer = CBackend(cuda=True)
return printer(astNode) return printer(astNode)
...@@ -60,7 +60,7 @@ class CBackend: ...@@ -60,7 +60,7 @@ class CBackend:
self.sympyPrinter = CustomSympyPrinter() self.sympyPrinter = CustomSympyPrinter()
def __call__(self, node): def __call__(self, node):
return self._print(node) return str(self._print(node))
def _print(self, node): def _print(self, node):
for cls in type(node).__mro__: for cls in type(node).__mro__:
......
from pystencils.cpu.kernelcreation import createKernel, addOpenMP from pystencils.cpu.kernelcreation import createKernel, addOpenMP
from pystencils.cpu.cpujit import makePythonFunction from pystencils.cpu.cpujit import makePythonFunction
from pystencils.backends.cbackend import printCCode from pystencils.backends.cbackend import generateC
...@@ -2,7 +2,7 @@ import os ...@@ -2,7 +2,7 @@ import os
import subprocess import subprocess
from ctypes import cdll, c_double, c_float, sizeof from ctypes import cdll, c_double, c_float, sizeof
from tempfile import TemporaryDirectory from tempfile import TemporaryDirectory
from pystencils.backends.cbackend import printCCode from pystencils.backends.cbackend import generateC
import numpy as np import numpy as np
...@@ -67,7 +67,7 @@ def compileAndLoad(kernelFunctionNode): ...@@ -67,7 +67,7 @@ def compileAndLoad(kernelFunctionNode):
print('#include <iostream>', file=sourceFile) print('#include <iostream>', file=sourceFile)
print("#include <cmath>", file=sourceFile) print("#include <cmath>", file=sourceFile)
print('extern "C" { ', file=sourceFile) print('extern "C" { ', file=sourceFile)
print(printCCode(kernelFunctionNode), file=sourceFile) print(generateC(kernelFunctionNode), file=sourceFile)
print('}', file=sourceFile) print('}', file=sourceFile)
compilerCmd = [CONFIG['compiler']] + CONFIG['flags'].split() compilerCmd = [CONFIG['compiler']] + CONFIG['flags'].split()
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment