Commit 21fcd7fc authored by Martin Bauer's avatar Martin Bauer
Browse files

waLBerla codegeneration improved

- removed warnings from generated code
- made generated code string deterministic, generating the same twice
  gives binary equally files now
parent c4853e5e
......@@ -10,6 +10,8 @@ from pystencils.data_types import create_type, StructType
from pystencils.kernelparameters import FieldShapeSymbol, FieldStrideSymbol
from pystencils.stencils import offset_to_direction_string, direction_string_to_offset
from pystencils.sympyextensions import is_integer_sequence
import pickle
import hashlib
__all__ = ['Field', 'fields', 'FieldType']
......@@ -437,7 +439,7 @@ class Field:
if i >= bound:
raise ValueError("Field index out of bounds")
offset_name = "%0.10X" % (abs(hash(tuple(offsets_and_index))))
offset_name = hashlib.md5(pickle.dumps(offsets_and_index)).hexdigest()[:12]
superscript = None
symbol_name = "%s_%s" % (field_name, offset_name)
......@@ -2,7 +2,8 @@ import warnings
from collections import defaultdict, OrderedDict, namedtuple
from copy import deepcopy
from types import MappingProxyType
import pickle
import hashlib
import sympy as sp
from sympy.logic.boolalg import Boolean
from sympy.tensor import IndexedBase
......@@ -179,7 +180,7 @@ def create_intermediate_base_pointer(field_access, coordinates, previous_ptr):
if len(list_to_hash) > 0:
name += "_%0.6X" % (hash(tuple(list_to_hash)))
name += hashlib.md5(pickle.dumps(list_to_hash)).hexdigest()[:16]
name = name.replace("-", 'm')
new_ptr = TypedSymbol( + name, previous_ptr.dtype)
Supports Markdown
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