Skip to content

Commit

Permalink
More robust approach: pickle if it exists, return plain if not
Browse files Browse the repository at this point in the history
Remove previous test fix for dace parsing
  • Loading branch information
Florian Deconinck committed Sep 4, 2024
1 parent 6bc1f0b commit 56e7b24
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/gt4py/cartesian/gtc/dace/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ def from_json(cls, d, sdfg=None):
# wrong format (non pickle).
# Best mitigation is to give back the object plain if it does
# not contain any pickling information
if isinstance(d, dict) and "pickle" not in d.keys():
if isinstance(d, dict) and "pickle" in d.keys():
b64string = d["pickle"]
byte_repr = base64.b64decode(b64string)
return pickle.loads(byte_repr)
else:
return d
b64string = d["pickle"]
byte_repr = base64.b64decode(b64string)
return pickle.loads(byte_repr)


class PickledDataclassProperty(PickledProperty, dace.properties.DataclassProperty):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ def dace_env():
dace.config.Config.set("compiler", "cpu", "args", value="")
dace.config.Config.set("compiler", "allow_view_arguments", value=True)
dace.config.Config.set("default_build_folder", value=str(gt_cache_path))
# Need to serialize `StencilComputation` library nodes because they contain OIR for `VerticalLoop`
dace.config.Config.set("testing", "serialize_all_fields", value=True)
yield


Expand Down

0 comments on commit 56e7b24

Please sign in to comment.