The default install location for cmdstan is $HOME/.cmdstan
.
In a singularity container, I can install cmdstan somewhere else (e.g., /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:
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 e.g., -B /scratch:/opt/cmdstan
.
This option is particularly useful if you want to have access to the generated files outside of the running container.
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.