Running on singularity syntax

48 views
Skip to first unread message

Ryan Wales

unread,
Apr 28, 2021, 1:12:16 PM4/28/21
to cpax_forum
Hello,

The newest version of CPAC has been added to my program's computer cluster via Singularity, but I'm unfamiliar with running Singularity images, and I'm brand new to CPAC.
I've looked at the page regarding running CPAC on Singularity, but I need some clarification about some of the paths. The CPAC image is in my home directory.
If this is the command to run a basic analysis:

singularity run \
        -B /Users/You/local_bids_data:/bids_dataset \
        -B /Users/You/some_folder:/outputs \
        -B /tmp:/tmp \
        FCP-INDI-C-PAC-master-latest.simg \
        /bids_dataset \
        /outputs \
        participant

What is the difference between lines 2 and 6 (bids dataset location) and also between 3 and 7 (output dir)? Should the input and output dirs be in my home directory or can they be anywhere that I specify?

Thanks for the help!

Best,
Ryan

Jon Clucas, MIS

unread,
Apr 29, 2021, 10:02:56 AM4/29/21
to cpax_forum
Hi Ryan,

Thanks for reaching out with your questions.

Lines 2 ‒ 4

Lines 2 ‒ 4 are telling Singularity to bind paths on your drive (the host) to mapped volumes in the container (Singularity) as in the diagram below.
bind paths.png
Docker also has some pretty thorough documentation about bind mounts, which is pretty consistent with Singularity's implementation.

Lines 6 ‒ 8

Within the container, C-PAC's commandline interface follows the BIDS app specification. Lines 6 ‒ 7 are telling C-PAC within the container where in the container to find "the directory with the input dataset formatted according to the BIDS standard" (/bids_dataset in this case) and where in the container to find "the directory where the output files should be stored" (/outputs in this case). participant tells C-PAC the level of analysis. Our documentation for running C-PAC on Docker is currently more thorough than our documentation for running C-PAC on Singularity, but besides the syntactical differences described in our "Run on Singularity", the information applies to both container environments.

Should the input and output dirs be in my home directory or can they be anywhere that I specify?

They can be mostly anywhere you specify, with the caveat that depending on how your system is set up, you may be unable to bind certain locations (networked drives, for example). "You can also provide a link to an AWS S3 bucket containing a BIDS directory as the data source."

The host paths (/Users/You/local_bids_data, /Users/You/some_folder) do need to exist, but the paths in the container (/bids_dataset, /outputs) will be created if they don't already exist.

Our cpac Python package handles all the bindings for you, so you'd just use the host paths in place of /bids_dataset, and /outputs, but you've got more flexibility to specify what you want to happen on your cluster by running Singularity directly as you're describing.

Please let us know if you need further clarification,

Jon Clucas, MIS
Associate Software Developer
Computational Neuroimaging Lab
Child Mind Institute
646.625.4319
childmind.org | Location
Reply all
Reply to author
Forward
0 new messages