Tutorial · Deploy
Keep the filesystem after the job ends.
The volatile core holds RAM and the node-local NVMe that the job writes to at full speed. The persistent core holds the shared SSD and HDD filesystems, and the write-back cache moves every byte there before the job ends. Afterwards you either copy the files out, or keep the store and open it on one node, the way you open a file with an I/O library.
- Time
- 45 minutes
- You need
- A Slurm cluster with node-local NVMe and a shared filesystem
- Example
- NCSA Delta
Delta's storage, and which core each one joins
Context FS has two CTE cores. The volatile core (pool 540.0) has no write-ahead log and starts empty on every start. The persistent core (pool 512.0) logs its metadata and recovers it. The write-back cache (pool 567.0) sits over both: a write lands in the volatile core and is acknowledged, and the cache flushes it to the persistent core later.
| Delta storage | Survives the job | Core | Tier path | persistence_level | score |
|---|---|---|---|---|---|
| Node memory | no | volatile 540.0 | ram::cte_ram | volatile | 1.0 |
/tmp: node-local NVMe, deleted after the job | no | volatile 540.0 | /tmp/$USER/clio/cte_nvme_tier.dat | volatile | 0.7 |
/work/nvme/<project>: SSD Lustre, shared | yes | persistent 512.0 | $SSD_STORE/node<id>/cte_ssd_tier.dat | long_term | 0.4 |
/work/hdd/<project>: HDD Lustre, shared | yes | persistent 512.0 | $HDD_STORE/node<id>/cte_hdd_tier.dat | long_term | 0.1 |
Run df -h /tmp on a compute node of your partition to see its local NVMe, and quota for your /work quotas. /work/nvme is usually much smaller than /work/hdd, and /work has no backups.
A tier's persistence_level is set in the configuration, not by its device, so a file on /tmp marked volatile is treated exactly like RAM. The persistent core refuses a volatile device. Inside each core, placement prefers the tier with the higher score: RAM before NVMe, SSD before HDD.
When data reaches the persistent core
- Periodically: the write-back cache flushes dirty copies every
flush_period_ms, when the volatile core isflush_fill_pctfull, and after everyflush_dirty_mbof new writes. - On
fsync(2): withfsync_mode: "durable", fsync returns once the file's dirty copies are flushed and synced. - On
clio-run stop: the cache flushes every dirty copy before the runtime exits, bounded by--grace-period. - Before eviction: a dirty copy is flushed before the volatile core drops it.
Anything still dirty when a node dies, or when Slurm kills the job at the walltime, is lost. The volatile core comes back empty, so the file comes back with the persistent core's older bytes.
What has to survive
The bytes on the SSD and HDD are half of a filesystem. A restart also needs the logs that say which bytes belong to which blob, file and size. All of them go to /work, under one storage root per node:
| State | Configured by | Without it, after a restart |
|---|---|---|
| Blob and tag metadata (WAL and snapshots) | clio_cte_core 512.0 → performance.metadata_log_path | the bytes persist, but nothing knows which blob they belong to |
| File sizes and pending appends | clio_cte_stream → log_path | files come back empty or truncated |
| Directory blocks | clio_cte_filesystem → metadata_log_path | the namespace is lost |
| Search index | clio_cte_indexer → index_log_path | search finds nothing until a rescan |
| Restart log | ${CLIO_STORAGE_ROOT}/restart_log.bin, set with clio-run start --disk | pools composed at run time are not re-created |
| Pool log | runtime.conf_dir → <conf_dir>/wal/pools.<node>.bin | the same |
runtime.conf_dir defaults to /tmp/clio_$USER, which Delta deletes when the job ends. clio_cte_stream's log_path defaults to unset, so file sizes do not survive a stop. It is also not expanded: ${CLIO_STORAGE_ROOT} in it stays literal. The generator below writes both out as plain paths.
Node identity is the hostfile line
Blobs are partitioned across nodes by hash, and a node's share belongs to its node id: its line number in the hostfile, counting from 0, not its hostname. CTE also names each node's tier file <path>_node<id>. So:
- A saved store must be reopened with the same number of nodes, because the hash depends on the node count.
- Name each node's directories by hostfile position (
node0,node1, ...). The next job can run on different hosts: node 2's state is whatever runtime sits on line 3 of the new hostfile.
1. Choose the paths
Replace bekn with your Delta project.
PROJ=bekn
RUN=run42
SSD_STORE=/work/nvme/$PROJ/$USER/clio-stores/$RUN # SSD tier, every log, storage roots
HDD_STORE=/work/hdd/$PROJ/$USER/clio-stores/$RUN # HDD tier
export RAM_TIER=64GB # volatile, per node
export NVME_TIER=1TB # volatile, per node, on /tmp
export SSD_TIER=200GB # persistent, per node, on /work/nvme
export HDD_TIER=2TB # persistent, per node, on /work/hddKeep SSD_TIER × nodes under your /work/nvme quota. File tiers grow in 1 GB steps, so a capacity is a cap, not an upfront allocation.
2. Generate each node's configuration
Save this as make_clio_conf.sh. It writes one node's full configuration, with every path written out:
#!/bin/bash
# Usage: make_clio_conf.sh <hostfile> <node-id> <ssd-store> <hdd-store>
# <port> <volatile-dir> <out.yaml>
set -euo pipefail
HOSTFILE=$1; ID=$2; SSD=$3/node$2; HDD=$4/node$2; PORT=$5; VOL=$6; OUT=$7
mkdir -p "$SSD/conf" "$HDD" "$VOL"
cat > "$OUT" <<EOF
networking:
port: $PORT
hostfile: "$HOSTFILE"
runtime:
num_threads: ${CLIO_THREADS:-32}
conf_dir: "$SSD/conf" # pool log; must outlive the job
compose:
- mod_name: clio_bdev
pool_name: "ram::chi_default_bdev"
pool_query: local
pool_id: "301.0"
bdev_type: ram
capacity: "${CLIO_SHM:-16GB}"
# Persistent core: SSD and HDD Lustre. Keep this list in this order in
# every job that opens the store: a tier's id is its position in it.
- mod_name: clio_cte_core
pool_name: cte_main
pool_query: local
pool_id: "512.0"
durability: persistent
storage:
- path: "$SSD/cte_ssd_tier.dat"
bdev_type: file
capacity_limit: "${SSD_TIER:-200GB}"
score: 0.4
persistence_level: "long_term"
- path: "$HDD/cte_hdd_tier.dat"
bdev_type: file
capacity_limit: "${HDD_TIER:-2TB}"
score: 0.1
persistence_level: "long_term"
dpe:
dpe_type: max_bw
targets:
neighborhood: 1
performance:
metadata_log_path: "$SSD/cte_metadata_log"
transaction_log_capacity: "32MB"
fsync_mode: "durable"
# Volatile core: RAM and node-local NVMe. Empty after every start.
- mod_name: clio_cte_core
pool_name: cte_volatile
pool_query: local
pool_id: "540.0"
durability: volatile
storage:
- path: "ram::cte_ram"
bdev_type: ram
capacity_limit: "${RAM_TIER:-64GB}"
score: 1.0
- path: "$VOL/cte_nvme_tier.dat"
bdev_type: file
capacity_limit: "${NVME_TIER:-1TB}"
score: 0.7
persistence_level: "volatile"
dpe:
dpe_type: max_bw
targets:
neighborhood: 1
- mod_name: clio_cte_replication
pool_name: clio_cte_replication
pool_query: local
pool_id: "561.0"
next_pool_id: "512.0"
replication_factor: 1
- mod_name: clio_cte_core_persist_write_back
pool_name: clio_cte_core_persist_write_back
pool_query: local
pool_id: "567.0"
next_volatile: "540.0"
next_persistent: "561.0"
fill: on_hit_count:2
evict: lru
flush_period_ms: ${CLIO_FLUSH_MS:-10000}
flush_fill_pct: 80
flush_dirty_mb: 256
flush_pool: "568.0"
fallback_to_persistent: true
- mod_name: clio_cte_core_shm_cache_writethru
pool_name: clio_cte_core_shm_cache_writethru
pool_query: local
pool_id: "568.0"
next_pool_id: "567.0"
entry_pool_id: "564.0"
md_only: true
invalidate_on_flush: true
capacity: "256M"
- mod_name: clio_cte_indexer
pool_name: clio_cte_indexer
pool_query: local
pool_id: "564.0"
next_pool_id: "568.0"
index_log_path: "$SSD/cte_indexer_index"
- mod_name: clio_cte_stream # before the filesystem
pool_name: clio_cte_stream
pool_query: local
pool_id: "565.0"
next_pool_id: "564.0"
staging_pool_id: "561.0"
log_path: "$SSD/cte_stream_log" # file sizes survive a restart
- mod_name: clio_cte_filesystem
pool_name: clio_cte_filesystem
pool_query: local
pool_id: "560.0"
next_pool_id: "564.0"
stream_pool_id: "565.0"
metadata_log_path: "$SSD/cfs_namespace_log"
EOF- Two volatile tiers
- RAM absorbs write bursts and the local NVMe takes over when RAM is full. Neither is trusted to keep data. When both are full,
fallback_to_persistent: truewrites straight to Lustre instead of failing the write. flush_period_ms- How long data may sit only in the volatile core. Shorter is safer and keeps the final stop short. Longer lets short-lived files (scratch, overwritten checkpoints) die in RAM without reaching Lustre, but loses more if the job is killed before the stop.
replication_factor: 1- One durable copy per blob, the ext4 contract. Use 2 or more, with
targets.failover_to_successor: trueon the persistent core, if the filesystem must stay readable while a node is down. It multiplies the/workfootprint. - Order
- Each
composeentry must come after every pool it names.
The chain is the same as the default configuration's: indexer → shm cache → write-back cache → volatile core, and replication → persistent core. See Compose data operators for each layer.
3. Start it in a Slurm job
The job script writes the hostfile, generates each node's configuration from its position in it, starts one runtime per node with its storage root on /work, and mounts the filesystem on every node.
#!/bin/bash
#SBATCH --account=bekn-delta-cpu
#SBATCH --partition=cpu
#SBATCH --nodes=4
#SBATCH --ntasks-per-node=1
#SBATCH --exclusive
#SBATCH --time=02:00:00
#SBATCH --signal=B:USR1@900 # 15 min warning before the walltime
#SBATCH --output=logs/%j.out
set -euo pipefail
PROJ=bekn; RUN=run42
SSD_STORE=/work/nvme/$PROJ/$USER/clio-stores/$RUN
HDD_STORE=/work/hdd/$PROJ/$USER/clio-stores/$RUN
VOL=/tmp/$USER/clio # volatile tier and the node's config
MNT=/tmp/$USER/clio-fs
PORT=9413
export RAM_TIER=64GB NVME_TIER=1TB SSD_TIER=200GB HDD_TIER=2TB
mkdir -p "$SSD_STORE" "$HDD_STORE"
HOSTFILE=$SSD_STORE/hostfile
# A later job writes its own hostnames here; only the line count must match.
scontrol show hostnames "$SLURM_JOB_NODELIST" > "$HOSTFILE"
# One runtime per node. Its id is its line in the hostfile; its storage
# root (restart log) is that node's directory on /work/nvme.
srun --overlap --ntasks-per-node=1 bash -c '
ID=$(( $(grep -nx "$(hostname -s)" '"$HOSTFILE"' | cut -d: -f1) - 1 ))
./make_clio_conf.sh '"$HOSTFILE"' $ID '"$SSD_STORE"' '"$HDD_STORE"' \
'"$PORT"' '"$VOL"' '"$VOL"'/clio.yaml
CLIO_SERVER_CONF='"$VOL"'/clio.yaml \
exec clio-run start --no-viz --disk '"$SSD_STORE"'/node$ID
' &
RUNTIMES=$!
sleep 20 # wait for every node to come up
# Mount on every node as a client of its runtime. Keep the FUSE daemon in
# the foreground (-f): Slurm kills a step's leftover processes.
srun --overlap --ntasks-per-node=1 bash -c '
mkdir -p '"$MNT"'
CLIO_SERVER_CONF='"$VOL"'/clio.yaml CLIO_WITH_RUNTIME=0 \
exec clio_cte_fuse '"$MNT"' -f
' &
MOUNTS=$!
sleep 5clio-run start always recovers. If the stores already hold a filesystem from an earlier job, this same script reopens it; if not, it starts empty. Only clio-run start --fresh discards a node's state.
Mount with CLIO_WITH_RUNTIME=0. With 1, the FUSE daemon would become the runtime itself, and an in-process runtime does not recover (see below).
4. Run the workload, then stop before the job ends
The volatile core holds everything written since the last flush. A scancel, a node crash or the walltime kill skips the final flush. Unmount and stop inside the job:
shutdown_clio() {
# 1. Unmount, so no new writes arrive and open files are closed.
srun --overlap --ntasks-per-node=1 fusermount3 -u "$MNT" || true
wait "$MOUNTS" || true
# 2. Stop: the write-back cache flushes RAM and /tmp NVMe data to /work.
srun --overlap --ntasks-per-node=1 bash -c \
"CLIO_SERVER_CONF=$VOL/clio.yaml clio-run stop --grace-period 600000"
wait "$RUNTIMES" || true
}
trap shutdown_clio USR1 # walltime warning from #SBATCH --signal
srun --overlap --ntasks-per-node=32 ./my_simulation --output "$MNT/out"
shutdown_clioSize --grace-period (in ms; the default is 5000 ms) to the dirty data that can be in the volatile core when the stop starts, divided by each node's write bandwidth to /work. While Lustre keeps up, that is about one flush period of writes. When the application writes faster than Lustre absorbs, the backlog grows into the NVMe tier, up to RAM_TIER + NVME_TIER per node: a full 1 TB NVMe tier at 1 GB/s takes about 17 minutes. Lower NVME_TIER if that is more than the job can spend at its end, and set the --signal lead time larger than the grace period plus the unmount.
Files the workload fsyncs are durable without the stop. The stop still matters for everything else.
5. Keep it after the job
After the stop, the store is entirely on /work; the local NVMe is wiped when the job ends. Choose what to keep:
| A. Stage out plain files | B. Keep the CTE store | |
|---|---|---|
| What is kept | ordinary files and directories | the store itself, on /work/nvme and /work/hdd |
| End-of-job cost | copy every byte through the mount | the stop only |
| Read later with | anything (h5py, cat, ...) | CLIO Core, with the same node count |
| Keeps tiers, tags and the search index | no | yes |
A. Stage out plain files
Copy out of the mount before stopping. The copy needs no CLIO Core to read:
srun --overlap -N 1 -n 1 rsync -a "$MNT/out/" "/work/hdd/$PROJ/$USER/results/$RUN/"
shutdown_clioEvery node's mount shows the same namespace, so for large outputs run one rsync per subtree on several nodes. If you will not reopen the store, delete $SSD_STORE and $HDD_STORE afterwards to free the quota.
B. Keep the CTE store
The stop is all the end of the job needs. The two stores then hold:
/work/nvme/bekn/$USER/clio-stores/run42/ # SSD
├── hostfile # its line count is the store's node count
├── node0/
│ ├── restart_log.bin # storage root (--disk)
│ ├── conf/wal/pools.0.bin # pool log
│ ├── cte_ssd_tier.dat_node0 # SSD tier bytes
│ ├── cte_metadata_log* # blob and tag WAL, snapshots
│ ├── cte_stream_log.* # file sizes
│ ├── cfs_namespace_log.dirs.* # directory blocks
│ └── cte_indexer_index*
├── node1/ ...
└── node3/ ...
/work/hdd/bekn/$USER/clio-stores/run42/ # HDD
├── node0/cte_hdd_tier.dat_node0
└── node1/ ...Reopen it in a later job by running the step 3 script with the same RUN and node count; the hosts can differ. Keep these the same in every job that opens the store:
- the number of nodes;
- the order of the persistent core's
storagelist; - the absolute paths of the SSD and HDD tiers, the logs and each node's
--disk.
The volatile core's paths and sizes may change between jobs; it is empty after every start anyway.
6. Open the store on one node like an I/O library
For method A the outputs are plain files. For method B, start as many runtimes on one node as the store has nodes, one per saved node, each on its own port, and reach the filesystem through any client. Use an interactive job, not a login node:
srun --account=bekn-delta-cpu --partition=cpu-interactive \
--nodes=1 --exclusive --time=01:00:00 --pty bashStart one runtime per saved node
A hostfile entry may be host:port; each runtime takes the line whose port matches its own. A runtime binds port, port+1 and port+3, so space the ports at least 4 apart:
PROJ=bekn; RUN=run42
SSD_STORE=/work/nvme/$PROJ/$USER/clio-stores/$RUN
HDD_STORE=/work/hdd/$PROJ/$USER/clio-stores/$RUN
N=$(wc -l < "$SSD_STORE/hostfile") # the saved store's node count
H=/tmp/$USER/clio-reader
mkdir -p $H
: > $H/hostfile
for i in $(seq 0 $((N-1))); do
echo "$(hostname -s):$((9413 + 10*i))" >> $H/hostfile
done
# N runtimes share this node: smaller volatile tiers. The persistent tier
# sizes stay as they were in the job.
export RAM_TIER=4GB NVME_TIER=16GB CLIO_SHM=2GB CLIO_THREADS=4
export SSD_TIER=200GB HDD_TIER=2TB
for i in $(seq 0 $((N-1))); do
./make_clio_conf.sh $H/hostfile $i "$SSD_STORE" "$HDD_STORE" \
$((9413 + 10*i)) $H/vol$i $H/node$i.yaml
CLIO_SERVER_CONF=$H/node$i.yaml nohup clio-run start --no-viz \
--disk "$SSD_STORE/node$i" > $H/node$i.log 2>&1 &
done
sleep 20Runtime i recovers node$i of both stores. The clients below use runtime 0 (its config names port 9413) and reach the others through it.
Mount it, for any program
mkdir -p $H/mnt
CLIO_SERVER_CONF=$H/node0.yaml CLIO_WITH_RUNTIME=0 clio_cte_fuse $H/mnt -f &
ls $H/mnt/out
python analyze.py $H/mnt/out/step_100.h5Link it into your program
Without a mount, preload the POSIX adapter. Paths that start with clio:: go to Context FS and the rest to the kernel. The marker is stripped, so the file written at $MNT/out/step_100.dat in the job is clio::/out/step_100.dat:
CLIO_SERVER_CONF=$H/node0.yaml CLIO_WITH_RUNTIME=0 \
LD_PRELOAD=libclio_cte_posix.so ./my_reader clio::/out/step_100.datlibclio_cte_stdio.so does the same for fopen and fread. For HDF5, use the VOL or VFD connector.
Call the CTE directly
Code that works with tags and blobs links clio::cte::core_client and attaches as a client. See the CTE API reference.
#include <clio_cte/core/core_client.h>
int main() {
// Attach to the running runtimes; do not start one in-process.
if (!clio::run::CLIO_INIT(clio::run::RuntimeMode::kClient, false)) return 1;
if (!clio::cte::core::CLIO_CTE_CLIENT_INIT()) return 1;
clio::cte::core::Tag tag("my_dataset");
for (const std::string &name : tag.GetContainedBlobs()) {
std::vector<char> buf(tag.GetBlobSize(name));
tag.GetBlob(name, buf.data(), buf.size());
// ... analyze buf ...
}
clio::run::CLIO_RUNTIME_FINALIZE();
return 0;
}An in-process runtime starts fresh
CLIO_WITH_RUNTIME=1, or CLIO_INIT(kClient, true), makes the process the runtime when none is running. That runtime starts with is_restart = false, like clio-run start --fresh: it clears the pool log and does not recover the store. Never point it at a saved store.
A store saved from a single-node job can be opened by one program that embeds the runtime, with nothing else started. Set CLIO_STORAGE_ROOT to the node's directory and pass is_restart = true:
// Become the runtime (or attach to a running one) and recover the state
// named by $CLIO_SERVER_CONF and $CLIO_STORAGE_ROOT.
clio::run::CLIO_INIT(clio::run::RuntimeMode::kClient,
/*default_with_runtime=*/true, /*is_restart=*/true);A store from an N-node job needs all N runtimes, so use the daemons above.
Shut down
fusermount3 -u $H/mnt
for i in $(seq 0 $((N-1))); do
CLIO_SERVER_CONF=$H/node$i.yaml clio-run stop --grace-period 600000
doneWrites made here land in the same store, so the next multi-node job sees them. Stop before the interactive job ends: this node's /tmp goes with it.
Check that the store survived
# in the job, before shutdown_clio
(cd "$MNT" && find out -type f -print0 | xargs -0 sha256sum) > "$SSD_STORE/manifest.sha256"
# after reopening
(cd $H/mnt && sha256sum -c "$SSD_STORE/manifest.sha256")Troubleshooting
| Symptom | Likely cause |
|---|---|
| Files have the right size but old or zero contents | Their newest bytes were still dirty in the volatile core when the job ended. Raise the --signal lead time or --grace-period, lower flush_period_ms or NVME_TIER. |
| Files come back empty or truncated, directory listing intact | clio_cte_stream's log_path was unset, on /tmp, or written with ${...}. |
| Directory listing empty after a restart | A metadata_log_path was unset or on /tmp, or the store was opened with --fresh or by an in-process runtime. |
| Some files read back, others fail | The store was reopened with a different node count, a node's directory was given to a different hostfile line, or the storage list was reordered. |
Writes slow to Lustre speed while /tmp has room | The volatile core is full of dirty data the flush has not caught up with, and fallback_to_persistent sends new writes to Lustre. |
| Runtime 1, 2, ... fail to start on the reader node | Ports too close: each needs port, port+1 and port+3 free. |