Singularity

The pulsar group servers (dogmatix0/1 and miraculix/miraculix2) used to have Docker installed. Since Docker needs root permissions to execute, and therefore a security hazard, the service was discontinued on the group servers. Instead, we have decided to use the Singularity container, which can be also be used to run previously built Docker containers without the need for root privileges.

Here is a short how-to on getting access to PSRCHIVE/DSPSR based on a previously build Docker container.

  • If you are in a hurry and have to use psrchive/dspsr, use a prebuilt Singularity container:

singularity shell -B /fpra/timing/01 /homes/ramesh/dspsr_202111.sif

  • In the above -B /fpra/timing/01 is the directory that needs to visible inside singularity.
  • Access all other commands/utilities as you normally do:
 ramesh@dogmatix0 ~ $ singularity shell -B /fpra/timing/01 /homes/ramesh/dspsr_202111.sif 
 bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
 Singularity dspsr_202111.sif:~> pwd
 /homes/ramesh
 Singularity dspsr_202111.sif:~> cd /fpra/timing/01/MAGNETARS/
 Singularity dspsr_202111.sif:/fpra/timing/01/MAGNETARS> cd J1818-1607/PSRIX0/20200314/search/
 Singularity dspsr_202111.sif:/fpra/timing/01/MAGNETARS/J1818-1607/PSRIX0/20200314/search> vap -c "freq bw" 2020-03-14-06:37:20.ar
 filename   freq   bw
 2020-03-14-06:37:20.ar   1358.926   -250.000
 Singularity dspsr_202111.sif:/fpra/timing/01/MAGNETARS/J1818-1607/PSRIX0/20200314/search>

Note that the container above has only tempo2.

Using a docker container under Singularity

  • Make sure that a prebuilt Docker container exists on Dockerhub
  • Build a singularity image by:
  singularity build dspsr_202111.sif docker://bhcpsr/dspsr:202111
  • The above will create a singularity image dspsr_202111.sif in the current directory.
  • If the build above fails with no space left on device error, remove files that are like /var/tmp/docker-tar066320373.

Vivek's docker/singularity containers

The instructions to use Vivek's container are given here: https://github.com/vivekvenkris/pulsar_docker

Henning's Notes

A while back Henning gave a tutorial on using singularity. The PDF document is here

Using PRESTO

The following is based on a docker container built with the Dockerfile contained in the PRESTO package.

 git clone https://github.com/scottransom/presto.git
 cd presto
 docker build . --tag presto:r4.0   

The above image was pushed to bhcpsr's Dockerhub and this can be readily accessed within Singularity:

 paf0:~> setenv SINGULARITY_TMPDIR /media/titan0/sing
 paf0:~> singularity shell -e -B /media/titan0/ docker://bhcpsr/presto:r4.0
 

If you have trouble getting your display to work, try setting the DISPLAY environment variable (as set before firing up the container) and copy $HOME/.Xauthority file to the home directory within the Singularity container.

Docker on Mac

The recent Macs with the Apple M1/M2/M3 chips might have issues when the installed docker version is not updated. Check for new release here: https://docs.docker.com/desktop/release-notes/. On 08 May 2024, version 4.30.0 worked fine on Sonoma 14.4.1.

Remove the old docker by navigating to Applications folder, and drag-n-drop docker app to the recycle bin.If there are issues in removing the docker app, stop any docker processes using the activity monitor tool (found in the Utilities folder which is listed in Applications).

Now when invoking docker from command line, make sure to use –platform linux/amd64, as in the example below:

docker run -ti --rm --platform linux/amd64 -v /Users/rameshkaruppusamy/DOCK:/data --name="dspsr" --hostname="dspsr" bhcpsr/dspsr:202111.1 bash
root@dspsr:~# export DISPLAY=134.104.30.131:0
root@dspsr:~# pav -DFTp /data/2020-03-20-20\:18\:35.0024.p.calibP

To get X11-forwarding to work properly, install xQuartz. Make sure that you enable "Allow connections from network clients" found under Security tab in xQuartz's settings. Make sure that you allow other clients to connect to xQuartz X11 server with xhost + on a terminal before invoking your container. The DISPLAY variable is set to the current IP of the Mac. Check this with ifconfig | grep inet on a terminal and choose the right IP address.

 
computing/singularity.txt · Last modified: 2024/05/08 14:54 by ramesh     Back to top