Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use immutabledict instead of pyrsistent, immutables #3

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions meshmode/array_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
DiscretizationEntityAxisTag)
from dataclasses import dataclass

from pyrsistent import pmap
from immutabledict import immutabledict
logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -781,15 +781,14 @@ class NotAnFEMEinsumError(ValueError):

@memoize_on_first_arg
def _get_redn_iname_to_insns(kernel):
from immutables import Map
redn_iname_to_insns = {iname: set()
for iname in kernel.all_inames()}

for insn in kernel.instructions:
for redn_iname in insn.reduction_inames():
redn_iname_to_insns[redn_iname].add(insn.id)

return Map({k: frozenset(v)
return immutabledict({k: frozenset(v)
for k, v in redn_iname_to_insns.items()})


Expand Down Expand Up @@ -1072,7 +1071,7 @@ def _get_iel_to_idofs(kernel):
raise NotImplementedError(f"Cannot fit loop nest '{insn.within_inames}'"
" into known set of loop-nest patterns.")

return pmap({iel: frozenset(idofs)
return immutabledict({iel: frozenset(idofs)
for iel, idofs in iel_to_idofs.items()})


Expand Down
Loading