Skip to content

Commit bb33967

Browse files
Add Guidance for GCS Fuse for Compilation Cache in JAX
PiperOrigin-RevId: 845321019
1 parent 06d576b commit bb33967

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

docs/persistent_compilation_cache.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,34 @@ Cloud Storage (GCS) bucket. We recommend the following configuration:
132132

133133
* All encryption policies are supported.
134134

135+
It is **recommended** to use
136+
[Google Cloud Storage Fuse](https://cloud.google.com/storage/docs/cloud-storage-fuse)
137+
to mount the GCS bucket as a local directory. This is because when running JAX
138+
in a multi-node setup, multiple nodes might try to write to the cache
139+
simultaneously, leading to GCS rate-limit errors. GCSFuse handles this by
140+
ensuring that only one process can write to a file at a time, preventing these
141+
errors.
142+
143+
To set up GCSFuse, follow instructions for
144+
[GCE](https://cloud.google.com/storage/docs/cloud-storage-fuse/mount-bucket) or
145+
[GKE](https://cloud.google.com/kubernetes-engine/docs/how-to/cloud-storage-fuse-csi-driver-setup).
146+
For better performance, enable file caching
147+
([GCE](https://cloud.google.com/storage/docs/cloud-storage-fuse/file-caching) and
148+
[GKE](https://cloud.google.com/kubernetes-engine/docs/how-to/cloud-storage-fuse-csi-driver-perf#enable-and-use-file-caching)).
149+
150+
Once GCSFuse is configured, set the JAX cache directory to the GCSFuse mount
151+
point:
152+
153+
```python
154+
# Example assuming the GCS bucket is mounted at /gcs/my-bucket
155+
jax.config.update("jax_compilation_cache_dir", "/gcs/my-bucket/jax-cache")
156+
```
157+
158+
**Direct GCS access :**
159+
160+
If you choose not to use GCSFuse, you can point the cache directly to a GCS
161+
bucket.
162+
135163
Assuming that `gs://jax-cache` is the GCS bucket, set cache location as
136164
follows:
137165

0 commit comments

Comments
 (0)