Syncing datasets across clusters¶
cluv sync can also replicate datasets to every cluster listed in your Cluv config.
Configure dataset sync in pyproject.toml¶
Add data_source and datasets_path under [tool.cluv]:
[tool.cluv]
# Source cluster and source path (`hostname:/path`).
data_source = "mila:/network/datasets/cifar10.var/cifar10_torchvision"
# Destination path used on each cluster (can use env vars like $SCRATCH).
datasets_path = "$SCRATCH/datasets/cifar10"
data_sourceis where Cluv pulls the dataset from.datasets_pathis where Cluv stores it on each cluster, except the source cluster (see Run sync).
You can override datasets_path per cluster:
Using a local path as the data source¶
If your dataset is already on the machine where you run cluv sync, you can point
data_source directly at a local path (no hostname: prefix):
[tool.cluv]
# Local path — no hostname prefix.
data_source = "/data/datasets/cifar10"
# Destination path on each cluster.
datasets_path = "$SCRATCH/datasets/cifar10"
Cluv will skip the remote-pull step and push the local directory straight to every configured cluster.
Login to clusters (including the source)¶
Before syncing, create reusable SSH connections:
If your source is mila:..., make sure the mila connection exists (for example cluv login mila).
Run sync¶
With dataset sync enabled (default), Cluv will:
- Pull data from
data_sourceto thedatasets_pathof the machine where you run Cluv (remote source only). - Push that dataset to each target cluster at its configured
datasets_path.
Cluv skips the copies that aren't needed:
- It doesn't push the data to the source cluster. Jobs there read the data at the
data_sourcepath directly: on the source cluster,cluv.job.get_datasets_path()returns that path instead ofdatasets_path. - It only pulls the data when a target other than the source cluster needs it. The cluster where you
run Cluv counts as a target when you name it, when you run
cluv syncwithout naming any cluster, or when you runcluv submit first.
For example, with data_source = "mila:/network/datasets/imagenet":
cluv submit mila, run from your laptop or from narval, copies no data.cluv submit narval, run on narval, pulls the data to narval.cluv sync narval, run on mila, pushes the data from/network/datasets/imagenetto narval.
Optional: skip dataset replication for one run¶
If you need to skip the dataset replication step, specify: