diff --git a/setup.py b/setup.py index c21f3b923a7c79afe9cd4c1f6d8bf0bdfb6aef3d..400d1b9fc1d135b4a4a75dda113cf0af25d7c5cc 100644 --- a/setup.py +++ b/setup.py @@ -41,7 +41,7 @@ setup(name="sumpy", install_requires=[ "loo.py>=2017.2", - "pytools>=2013.5.6", + "pytools>=2017.6", "boxtree>=2013.1", "pytest>=2.3", "six", diff --git a/sumpy/__init__.py b/sumpy/__init__.py index c770e802e8bab11241b3f9593e5227ab7cb7d8ba..a325e3d1a90a370f7f35883f3de62f6d90486f7c 100644 --- a/sumpy/__init__.py +++ b/sumpy/__init__.py @@ -28,7 +28,7 @@ from sumpy.p2e import P2EFromSingleBox, P2EFromCSR from sumpy.e2p import E2PFromSingleBox, E2PFromCSR from sumpy.e2e import E2EFromCSR, E2EFromChildren, E2EFromParent from sumpy.version import VERSION_TEXT -from pytools.persistent_dict import PersistentDict +from pytools.persistent_dict import WriteOncePersistentDict __all__ = [ "P2P", "P2PFromCSR", @@ -37,7 +37,7 @@ __all__ = [ "E2EFromCSR", "E2EFromChildren", "E2EFromParent"] -code_cache = PersistentDict("sumpy-code-cache-v6-"+VERSION_TEXT) +code_cache = WriteOncePersistentDict("sumpy-code-cache-v6-"+VERSION_TEXT) # {{{ cache control diff --git a/sumpy/tools.py b/sumpy/tools.py index 12f385f09d79f8e67a14be7753c5c7782efdbab1..428fa2a1ba54afc1151b7874aa89bc81c2bdec35 100644 --- a/sumpy/tools.py +++ b/sumpy/tools.py @@ -394,7 +394,7 @@ class KernelCacheWrapper(object): knl = self.get_optimized_kernel(**kwargs) if CACHING_ENABLED: - code_cache[cache_key] = knl + code_cache.store_if_not_present(cache_key, knl) return knl