{"id":470,"date":"2022-01-11T20:47:50","date_gmt":"2022-01-11T20:47:50","guid":{"rendered":"https:\/\/ni.cmu.edu\/computing\/?post_type=ht_kb&#038;p=470"},"modified":"2022-01-11T21:13:13","modified_gmt":"2022-01-11T21:13:13","slug":"singularity-containers","status":"publish","type":"ht_kb","link":"https:\/\/ni.cmu.edu\/computing\/knowledge-base\/singularity-containers\/","title":{"rendered":"Singularity Linux Container Platform"},"content":{"rendered":"<p>Singularity containers provide an application virtualization layer for our users. There are a few singularity images located on mind ( \/containers\/images\/ ) that can help users get started.<\/p>\n<h5>Here is some information on how to build a singularity image from an image on Docker Hub(provided by Eli Bulger in Dr. Barbara Shinn-Cunningham&#8217;s lab).<\/h5>\n<blockquote><p><b>Start an interactive session:<\/b><br \/>\n<code>srun -p cpu --cpus-per-task=1 --mem=10GB --time=4:00:00 --pty bash<\/code><br \/>\n<b>Load singularity::<\/b><br \/>\n<code>module load singularity<\/code><br \/>\n<b>Create a directory to store your singularity image:<\/b><br \/>\n<code>mkdir \/user_data\/\/my_images<\/code><br \/>\n<b>Build the singularity image you desire. The commands typically follow the naming scheme shown below::<\/b><br \/>\n<code>singularity build [file_name] [docker_file]<\/code><br \/>\n<b>Example:<\/b><br \/>\n<code>singularity build \/user_data\/\/my_images\/fmriprep-.simg docker:\/\/poldracklab\/fmriprep<\/code><br \/>\n<b>Your image should build, then you are good to go!<\/b><\/p><\/blockquote>\n<h5>Example using a mrtrix3 and fsl 1.0 singularity image built by David. It is located on the mind cluster in \/containers\/images\/ and simple a test script.<\/h5>\n<pre>[dpane@mind ~]$ srun -p cpu --cpus-per-task=1 --mem=10GB --time=4:00:00 --pty bash\r\n[dpane@mind-0-12 ~]$ module load singularity\r\n[dpane@mind-0-12 ~]$ singularity exec --nv \/containers\/images\/ubuntu-16.04-mrtrix3_fsl_v1.0.img bash\r\nINFO: Could not find any NVIDIA binaries on this host!\r\ndpane@mind-0-12:~$ pwd\r\n\/home\/dpane\r\ndpane@mind-0-12:~$ cd singularity_example\/\r\ndpane@mind-0-12:~\/singularity_example$\r\n#!\/bin\/bash\r\n\r\necho \"Beginning of my test script\"\r\nwhich fsl;\r\necho \"Inital check of what the FSLDIR is set to: $FSLDIR\"; \r\necho \"Now set FSLDIR=\/opt\/fsl\"\r\nFSLDIR=\/opt\/fsl; \r\necho \"Check the FSLDIR again: $FSLDIR\";\r\necho \"Now checking to see if we can see fsl using the command: which fsl\"\r\nwhich fsl\r\necho \"listing of \/opt\"\r\nls \/opt\r\necho \"Command: which flirt\"\r\nwhich flirt\r\necho \"Command: flirt -version\"\r\nflirt -version\r\necho \"Command: which eddy\"\r\nwhich eddy\r\necho \"Command: eddy\"\r\neddy\r\necho \"This is the end of my test script\"\r\n\r\ndpane@mind-0-12:~\/singularity_example$\r\ndpane@mind-0-12:~\/singularity_example$ .\/test.sh\r\nBeginning of my test script\r\n\/opt\/fsl\/bin\/fsl\r\nInital check of what the FSLDIR is set to:\r\nNow set FSLDIR=\/opt\/fsl\r\nCheck the FSLDIR again: \/opt\/fsl\r\nNow checking to see if we can see fsl using the command: which fsl\r\n\/opt\/fsl\/bin\/fsl\r\nlisting of \/opt\r\nfsl mrtrix3\r\nCommand: which flirt\r\n\/opt\/fsl\/bin\/flirt\r\nCommand: flirt -version\r\nFLIRT version 6.0\r\nCommand: which eddy\r\n\/opt\/fsl\/bin\/eddy\r\nCommand: eddy\r\n***************************************************\r\nThe following COMPULSORY options have not been set:\r\n--imain File containing all the images to estimate distortions for\r\n--mask Mask to indicate brain\r\n--index File containing indices for all volumes in --imain into --acqp and --topup\r\n--acqp File containing acquisition parameters\r\n--bvecs File containing the b-vectors for all volumes in --imain\r\n--bvals File containing the b-values for all volumes in --imain\r\n--out Basename for output\r\n***************************************************\r\n\r\nPart of FSL (build 500)\r\neddy\r\nCopyright(c) 2011, University of Oxford (Jesper Andersson)\r\n\r\nUsage:\r\neddy --monsoon\r\n\r\nCompulsory arguments (You MUST set one or more of):\r\n--imain File containing all the images to estimate distortions for\r\n--mask Mask to indicate brain\r\n--index File containing indices for all volumes in --imain into --acqp and --topup\r\n--acqp File containing acquisition parameters\r\n--bvecs File containing the b-vectors for all volumes in --imain\r\n--bvals File containing the b-values for all volumes in --imain\r\n--out Basename for output\r\n\r\nOptional arguments (You may optionally specify one or more of):\r\n--session File containing session indices for all volumes in --imain\r\n--topup Base name for output files from topup\r\n--flm First level EC model (linear\/quadratic\/cubic)\r\n--fwhm FWHM for conditioning filter when estimating the parameters\r\n--niter Number of iterations (default 5)\r\n--resamp Final resampling method (jac\/lsr)\r\n--repol Detect and replace outlier slices\r\n-v,--verbose switch on diagnostic messages\r\n-h,--help display this message\r\n\r\nThis is the end of my test script\r\ndpane@mind-0-12:~\/singularity_example$\r\ndpane@mind-0-12:~\/singularity_example$\r\ndpane@mind-0-12:~\/singularity_example$\r\ndpane@mind-0-12:~\/singularity_example$ exit\r\nexit\r\n[dpane@mind-0-12 ~]$ exit\r\nexit\r\n[dpane@mind ~]$<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Singularity containers provide an application virtualization layer for our users. There are a few singularity images located on mind ( \/containers\/images\/ ) that can help users get started. Here is some information on how to build a singularity image from an image on Docker Hub(provided by Eli Bulger in Dr&#8230;.<\/p>\n","protected":false},"author":1,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[11],"ht-kb-tag":[],"class_list":["post-470","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-software"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/ht-kb\/470","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/comments?post=470"}],"version-history":[{"count":15,"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/ht-kb\/470\/revisions"}],"predecessor-version":[{"id":485,"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/ht-kb\/470\/revisions\/485"}],"wp:attachment":[{"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/media?parent=470"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/ht-kb-category?post=470"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/ht-kb-tag?post=470"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}