Hi Igor,
Am 18.05.2018 um 02:38 schrieb Igor Yakushin:
> Hi Oliver,
>
>
>
> in principle, yes, if you also set LD_LIBRARY_PATH etc., but in the end this somehow defeats the container concept.
> Also, you may run into ugly issues if stuff from the "real" OS takes over, for example to load dynamic libraries, and you get funny incompatibilities.
>
>
>
> I am looking for a way to run singularity container like environment on systems where sysadmins are resisting installing singularity. In particular I need to run some deep learning code on OpenScience Grid and as far as I heard not all sites with GPUs there have singularity.
ahhh, OSG! This should help ;-). See below.
>
>
>
>
> So I'd advice against it - but your mileage may vary.
>
> However, you can also have Singularity run unprivileged, i.e. ship it on a shared filesystem, if you can live without the setuid root functionality (e.g. OverlayFS),
> and your kernel is modern enough to support user namespaces and has them enabled. In that case, you can use Singularity without "installing" it.
>
>
>
> How do I do it? Do I just build singularity and install it on a user account? Would --nv GPU feature work?
I think you can even have it without installing in OSG.
See:
http://opensciencegrid.org/docs/worker-node/install-singularity/
However, there you also find the information that most sites are not yet ready for user namespace containers. When using CentOS, this means version 7.4 is needed (at least) and the features needs to be enabled explicitly.
As you can see on:
http://opensciencegrid.org/docs/worker-node/install-singularity/#unprivileged-singularity
this needs a kernel commandline flag and a sysctl setting. These you could check (OS version, /proc/cmdline, sysctl -a).
However, if a site has done so, your life is easy: You can use Singularity directly from OSG's CVMFS, i.e.:
/cvmfs/
oasis.opensciencegrid.org/mis/singularity/el7-x86_64/bin/singularity
so it's already installed and maintained by them.
I sadly can not tell you whether --nv works - I don't know whether it was implemented for non-setuid root mode. But others on this list can surely answer that.
>
>
>
>
> If you really *need* to do it, and your kernel is modern enough, then you might also get away with alternatives such as runc or charliecloud, especially charliecloud is designed for this way of operation.
> They can run a sandbox image which was build with Singularity, unprivileged, if the kernel has user namespace support enabled.
>
>
> How can I find out if the kernel has such a support?
See above. Another approach is to just "try" if Singularity runs, it will tell you. That's probably easier.
Modern Kernels (I think starting from 4.3 or 4.4) have user namespace support included, unless explicitly disabled by the distribution.
>
>
>
> Without further treatment, however, you will lose some Singularity features, for example the RUN script, and Singularity's environment handling.
>
>
> The main feature I would hate to lose is --nv. Unpacking different versions of NVIDIA drivers into container the old way is so annoying...
>
>
>
>
> Another alternative, if you're open to other Linux distros, is for example to use Gentoo Prefix. Gentoo Prefix (
https://wiki.gentoo.org/wiki/Project:Prefix <
https://wiki.gentoo.org/wiki/Project:Prefix> ) can run unprivileged
> in almost any Linux / Unix environment on almost any architecture without use of container technology.
>
>
> Wow! With this, what is the advantage or disadvantage of containers? Will Gentoo installed on a user account under Linux be able to use GPU? OpenMP? MPI? Must one install NVIDIA drivers inside Prefix or it can use the ones from the host? Is Gentoo installed on one Linux portable to another linux by rsync or one has to install it from scratch on each system?
The advantage and disadvantage is that there is no isolation, i.e. no PID namespace shielding out PIDs from other users.
However, as "end user" you will probably not care ;-).
As such, you can use everything from the host, but there is no such thing as "--nv", so you need to implement that yourself (maybe hooking up
https://github.com/NVIDIA/nvidia-container-runtime works, which was written for runc initially?). Apart from that, the good thing is that several MPI versions and nvidia driver versions are packaged for Gentoo.
Concerning portability, this depends - Gentoo is a *compiled* distribution. You can choose your compiler flags either such that the result is very portable and rsyncable, or in a way which is optimized for the CPU at hand.
Cheers and hope that helps,
Oliver