Skip to content

Commit

Permalink
Various loopy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjward committed Nov 29, 2024
1 parent 6d6a671 commit 8bfb94d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
--install defcon \
--install gadopt \
--install asQ \
--package-branch loopy connorjward/merge-upstream \
--package-branch loopy connorjward/revert-hack-for-firedrake \
|| (cat firedrake-install.log && /bin/false)
- name: Install test dependencies
run: |
Expand Down
6 changes: 4 additions & 2 deletions pyop2/codegen/rep2loopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,12 @@ def __init__(self, name=None, arg_id_to_dtype=None,
arg_id_to_descr=None, name_in_target=None):
if name is not None:
assert name == self.name

name_in_target = name_in_target if name_in_target else self.name
super(LACallable, self).__init__(self.name,
arg_id_to_dtype=arg_id_to_dtype,
arg_id_to_descr=arg_id_to_descr)
self.name_in_target = name_in_target if name_in_target else self.name
arg_id_to_descr=arg_id_to_descr,
name_in_target=name_in_target)

@abc.abstractproperty
def name(self):
Expand Down
2 changes: 1 addition & 1 deletion pyop2/compilation.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ def check_source_hashes(compiler, jitmodule, extension, comm):
output = Path(configuration["cache_dir"]).joinpath("mismatching-kernels")
srcfile = output.joinpath(f"src-rank{icomm.rank}.{extension}")
if icomm.rank == 0:
output.mkdir(exist_ok=True)
output.mkdir(parents=True, exist_ok=True)
icomm.barrier()
with open(srcfile, "w") as fh:
fh.write(jitmodule.code_to_compile)
Expand Down
8 changes: 3 additions & 5 deletions pyop2/local_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,11 @@ def cache_key(self):
def _immutable_cache_key(self):
# We need this function because self.accesses is mutable due to legacy support
if isinstance(self.code, lp.TranslationUnit):
key_hash = hashlib.sha256()
self.code.update_persistent_hash(key_hash, LoopyKeyBuilder())
code = key_hash.hexdigest()
code_key = LoopyKeyBuilder()(self.code)
else:
code = self.code
code_key = self.code

key = (code, self.name, self.cpp, self.flop_count,
key = (code_key, self.name, self.cpp, self.flop_count,
self.headers, self.include_dirs, self.ldargs, sorted(self.opts.items()),
self.requires_zeroed_output_arguments, self.user_code, version.__version__)
return hashlib.md5(str(key).encode()).hexdigest()
Expand Down

0 comments on commit 8bfb94d

Please sign in to comment.