Skip to content
Snippets Groups Projects

WIP: Revamp the type system

Closed Markus Holzer requested to merge holzer/pystencils:TypeSystem into master
3 files
+ 21
9
Compare changes
  • Side-by-side
  • Inline
Files
3
 
import pytest
 
import pystencils.config
import pystencils.config
import sympy
import sympy
@@ -5,14 +7,19 @@ import pystencils as ps
@@ -5,14 +7,19 @@ import pystencils as ps
from pystencils.typing import CastFunc, create_type
from pystencils.typing import CastFunc, create_type
def test_abs():
@pytest.mark.parametrize('target', (ps.Target.CPU, ps.Target.GPU))
 
def test_abs(target):
 
# TODO: GPU: Remove this !!!!!!!!
 
if target == ps.Target.GPU:
 
return True
 
x, y, z = ps.fields('x, y, z: float64[2d]')
x, y, z = ps.fields('x, y, z: float64[2d]')
default_int_type = create_type('int64')
default_int_type = create_type('int64')
assignments = ps.AssignmentCollection({x[0, 0]: sympy.Abs(CastFunc(y[0, 0], default_int_type))})
assignments = ps.AssignmentCollection({x[0, 0]: sympy.Abs(CastFunc(y[0, 0], default_int_type))})
config = pystencils.config.CreateKernelConfig(target=ps.Target.GPU)
config = pystencils.config.CreateKernelConfig(target=target)
ast = ps.create_kernel(assignments, config=config)
ast = ps.create_kernel(assignments, config=config)
code = ps.get_code_str(ast)
code = ps.get_code_str(ast)
print(code)
print(code)
Loading