Skip to content

Commit 0251dc5

Browse files
committed
added squashfs page
1 parent 8fe6b8a commit 0251dc5

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

docs/hpc/08_ood/datasets.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Datasets
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,64 @@
11
# Squash File System and Singularity
22

3+
View available datasets on the [Datasets page](./datasets.md).
4+
5+
## Working with Datasets
6+
Writable ext3 overlay images have conda environments installed inside, Singularity can work with squashFS for fixed datasets, such as the coco datasets.
7+
8+
```sh
9+
/scratch/work/public/ml-datasets/coco/coco-2014.sqf
10+
/scratch/work/public/ml-datasets/coco/coco-2015.sqf
11+
/scratch/work/public/ml-datasets/coco/coco-2017.sqf
12+
13+
14+
singularity exec \
15+
--overlay /scratch/wang/zzz/pytorch1.8.0-cuda11.1.ext3:ro \
16+
--overlay /scratch/work/public/ml-datasets/coco/coco-2014.sqf:ro \
17+
--overlay /scratch/work/public/ml-datasets/coco/coco-2015.sqf:ro \
18+
--overlay /scratch/work/public/ml-datasets/coco/coco-2017.sqf:ro \
19+
/scratch/work/public/singularity/cuda11.1-cudnn8-devel-ubuntu18.04.sif /bin/bash
20+
```
21+
22+
If you have many tiny files as fixed datasets, please make squashFS files to work with Singularity. Here is an example
23+
24+
1. Make a temporary folder in /state/partition1, it is a folder in local hard drive on each computer node
25+
```sh
26+
mkdir -p /state/partition1/sw77
27+
cd /state/partition1/sw77
28+
```
29+
30+
2. Unzip files there, for example
31+
```sh
32+
tar -vxzf /scratch/work/public/examples/squashfs/imagenet-example.tar.gz
33+
```
34+
35+
3. Change access permissions in case we'll share files with others
36+
```sh
37+
find imagenet-example -type d -exec chmod 755 {} \;
38+
find imagenet-example -type f -exec chmod 644 {} \;
39+
```
40+
41+
4. Convert to a single squashFS file on host
42+
```sh
43+
mksquashfs imagenet-example imagenet-example.sqf -keep-as-directory
44+
```
45+
For more details on working with squashFS, please see [this page from the SquashFS documentation](http://www.iitk.ac.in/LDP/HOWTO/SquashFS-HOWTO/mksqoverview.html).
46+
47+
5. Copy this file to /scratch
48+
```sh
49+
cp -rp /state/partition1/sw77/imagenet-example.sqf /scratch/sw77/.
50+
```
51+
52+
6. To test, files are in /imagenet-example inside Singularity container
53+
```sh
54+
singularity exec --overlay /scratch/sw77/imagenet-example.sqf:ro /scratch/work/public/singularity/ubuntu-20.04.1.sif /bin/bash
55+
Singularity> find /imagenet-example | wc -l
56+
1303
57+
Singularity> find /state/partition1/sw77/imagenet-example | wc -l
58+
1303
59+
```
60+
61+
7. To delete the tempoary folder on host
62+
```sh
63+
rm -rf /state/partition1/sw77
64+
```

0 commit comments

Comments
 (0)