简体   繁体   中英

How to use cmdstan in a singularity (apptainer) container?

The default install location for cmdstan is $HOME/.cmdstan .

In a singularity container, I can install cmdstan somewhere else (eg, /opt/cmdstan ).

The problem is cmdstan sometime requires writing permission during compiling models but I don't have the permission for /opt/cmdstan in the singularity container.

Where should I install cmdstan in a container, and how should I solve this permission problem especially when I use HPC?

Keeping it /opt/cmdstan seems a good place. As far as the writing issue goes, you have two main choices:

  1. Write to the host OS

This is simplest option if you can control or know where the writing happens. Since $PWD is one of the system-defined auto mount directories , you can just write there.

If you know instead that they are written to /opt/cmdstan/cache , you can explicitly mount a directory from the host OS with eg, -B /scratch:/opt/cmdstan .

This option is particularly useful if you want to have access to the generated files outside of the running container.

  1. Use a tmpfs overlay

If you don't know where the files are being generated and/or don't care what they are, you can you use the --writable-tmpfs flag with your singularity command.

A limitation here is that the size of the overlay is the size of /dev/shm on the host OS. This can sometimes be smaller than expected (I've noticed as low as 32-64MB in some cloud VMs), which will cause the writes to fail complaining about no disk space when there is still space on the host partition.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM