Skip to content

Commit 00b880d

Browse files
authored
[docs only] Clean up singularity docs
1 parent aa9e24d commit 00b880d

File tree

1 file changed

+36
-13
lines changed

1 file changed

+36
-13
lines changed

docs/installation.rst

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,29 @@ Singularity Container
6767
=====================
6868

6969
For security reasons, many HPCs (e.g., TACC) do not allow Docker containers, but do allow `Singularity <https://github.com/singularityware/singularity>`_ containers.
70+
71+
Preparing a Singularity image (Singualrity version >= 2.5)
72+
----------------------------------------------------------
73+
If the version of Singularity on your HPC is modern enough you can create Singularity image directly on the HCP.
74+
This is as simple as
75+
76+
$ singularity build /my_images/fmriprep-<version>.simg docker://poldracklab/mriqc:<version>
77+
78+
Where ``<version>`` should be replaced with the desired version of FMRIPREP that you want to download.
79+
80+
81+
Preparing a Singularity image (Singualrity version < 2.5)
82+
---------------------------------------------------------
7083
In this case, start with a machine (e.g., your personal computer) with Docker installed.
7184
Use `docker2singularity <https://github.com/singularityware/docker2singularity>`_ to create a singularity image. You will need an active internet connection and some time. ::
7285

7386
$ docker run --privileged -t --rm \
7487
-v /var/run/docker.sock:/var/run/docker.sock \
7588
-v D:\host\path\where\to\output\singularity\image:/output \
7689
singularityware/docker2singularity \
77-
poldracklab/fmriprep:latest
90+
poldracklab/fmriprep:<version>
7891

92+
Where ``<version>`` should be replaced with the desired version of FMRIPREP that you want to download.
7993

8094
Beware of the back slashes, expected for Windows systems.
8195
For \*nix users the command translates as follows: ::
@@ -84,39 +98,48 @@ For \*nix users the command translates as follows: ::
8498
-v /var/run/docker.sock:/var/run/docker.sock \
8599
-v /absolute/path/to/output/folder:/output \
86100
singularityware/docker2singularity \
87-
poldracklab/fmriprep:latest
101+
poldracklab/fmriprep:<version>
88102

89103

90104
Transfer the resulting Singularity image to the HPC, for example, using ``scp``. ::
91105

92-
$ scp poldracklab_fmriprep_latest-*.img [email protected]:/path/to/downloads
106+
$ scp poldracklab_fmriprep*.img [email protected]:/my_images
107+
108+
Running a Singularity Image
109+
---------------------------
93110

94111
If the data to be preprocessed is also on the HPC, you are ready to run fmriprep. ::
95112

96-
$ singularity run --clearenv path/to/singularity/image.img \
113+
$ singularity run --clearenv /my_images/fmriprep-1.1.2.simg \
97114
path/to/data/dir path/to/output/dir \
98115
participant \
99116
--participant-label label
100117

101-
For example: ::
102-
103-
$ singularity run --clearenv ~/poldracklab_fmriprep_latest-2016-12-04-5b74ad9a4c4d.img \
104-
/work/04168/asdf/lonestar/ $WORK/lonestar/output \
105-
participant \
106-
--participant-label 387 --nthreads 16 -w $WORK/lonestar/work \
107-
--omp-nthreads 16
108-
109118
.. note::
110119

111120
Singularity by default `exposes all environment variables from the host inside the container <https://github.com/singularityware/singularity/issues/445>`_.
112121
Because of this your host libraries (such as nipype) could be accidentally used instead of the ones inside the container - if they are included in PYTHONPATH.
113-
To avoid such situation we recommend using the ``--clearenv`` singualrity flag in production use. For example: ::
122+
To avoid such situation we recommend using the ``--clearenv`` singularity flag in production use. For example: ::
114123

115124
$ singularity run --clearenv ~/poldracklab_fmriprep_latest-2016-12-04-5b74ad9a4c4d.img \
116125
/work/04168/asdf/lonestar/ $WORK/lonestar/output \
117126
participant \
118127
--participant-label 387 --nthreads 16 -w $WORK/lonestar/work \
119128
--omp-nthreads 16
129+
130+
.. note::
131+
132+
Depending on how Singualrity is configured on your cluster it might or might not automatically bind (mount or expose)
133+
host folders to the container.
134+
If this is not done automatically you will need to bind the necessary folders using the ``-B <host_folder>:<container_folder``
135+
Singularity flag.
136+
For example: ::
137+
138+
$ singularity run --clearenv -B /work:/work ~/poldracklab_fmriprep_latest-2016-12-04-5b74ad9a4c4d.simg \
139+
/work/my_dataset/ /work/my_dataset/derivatives/fmriprep \
140+
participant \
141+
--participant-label 387 --nthreads 16 \
142+
--omp-nthreads 16
120143

121144
Manually Prepared Environment
122145
=============================

0 commit comments

Comments
 (0)