mirror of
https://github.com/ROCm/jax.git
synced 2025-04-19 05:16:06 +00:00
add parameter to initalize_cache function and added __init__ file
This commit is contained in:
parent
93a20eeb93
commit
86985fd4c1
13
jax/experimental/compilation_cache/__init__.py
Normal file
13
jax/experimental/compilation_cache/__init__.py
Normal file
@ -0,0 +1,13 @@
|
||||
# Copyright 2021 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
@ -20,11 +20,14 @@ from typing import Optional
|
||||
|
||||
_cache = None
|
||||
|
||||
def initialize_cache(path):
|
||||
"""Creates a global cache object. Should only be called once per process."""
|
||||
def initialize_cache(path, max_cache_size_bytes=32 * 2**30):
|
||||
"""Creates a global cache object. Should only be called once per process.
|
||||
|
||||
max_cache_sixe defaults to 32GiB.
|
||||
"""
|
||||
global _cache
|
||||
assert _cache == None, f"The cache path has already been initialized to {_cache}"
|
||||
_cache = FileSystemCache(path)
|
||||
_cache = FileSystemCache(path, max_cache_size_bytes)
|
||||
|
||||
def get_executable(xla_computation, compile_options) -> Optional[xla_client.Executable]:
|
||||
"""Returns the cached executable if present, or None otherwise."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user