OARS-SAFS / resources

Open and Reproducible Science Resources
17 stars 0 forks source link

singularity #16

Closed nclowell closed 3 years ago

nclowell commented 3 years ago

Does anyone have experience using singularity containers on hyak and have time to chat with me, @EleniLPetrou and @ctarpey? We're trying to get started on our klone node and could use help!

kubu4 commented 3 years ago

Send an email to UW IT. They'll help, plus they are the only ones who are allowed to deploy a Singularity container for your usage on oix (once you have the designated Singularity file ready).

EDITED: fixed typo

nclowell commented 3 years ago

Thanks for your quick reply @kubu4!

We've been meeting with Nam Pho from UW-IT and he implied that we could pull any Singularity container from Singularity Hub - is that consistent with what you heard?

Nam also implied that we'd be able to pull a container for anything we needed, and we're finding quickly that that's not the case.

kubu4 commented 3 years ago

Hmmm, interesting. I was just going off of the Singularity instructions I've previously read on the Mix Wiki.

What are the issues you're running into in regards to pulling containers?

nclowell commented 3 years ago

We're not having any issues pulling containers, we're just not finding already available containers on Singularity Hub that have all the software that we need for particular jobs. (This is for our lab's new hyak klone node, I personally have everything I need when using y'all's node). For example, the simuPOP module in python, Baypass, and others. So we're looking into creating our own and that looks like a very steep learning curve. We're hoping to find someone willing to do a little hand holding!

kubu4 commented 3 years ago

(This is for our lab's new hyak klone node, I personally have everything I need when using y'all's node).

Can you expand on this? If you have everything you need there, why can't that be duplicated on your node?

I see that they are "encouraging" Singularity usage on the new Klone nodes, but you're not required to do it that way.

I've set up Docker dockerfiles before, which are very similar to Singularity recipes. It's all very tedious, as you basically have to enter all the commands necessary to acquire software, unpack the software, and build the software. Although, if you will have to do this anyway to install the software on your Klone node, then it would probably be best to save all the commands to a text file, which can be "easily" converted to a Singularity recipe (add the appropriate headers to different sections of the text file). Despite the initial tedium and struggles, after it's all said and done, you'll have an easy-to-use, and perfectly reproducible, environment ready to go! So, it could be worth the effort...

nclowell commented 3 years ago

(This is for our lab's new hyak klone node, I personally have everything I need when using y'all's node).

Can you expand on this? If you have everything you need there, why can't that be duplicated on your node?

I personally have everything I need on y'all's node but there are some packages my lab mates need that aren't on there. And we always had your help installing software. I was under the impression that installing software on hyak was trickier than a local machine. If that's not the case, we can definitely go that route if Singularity proves too difficult. Can you comment on whether there's anything different about installing software on hyak compared to a local machine?

I see that they are "encouraging" Singularity usage on the new Klone nodes, but you're not required to do it that way.

I've set up Docker dockerfiles before, which are very similar to Singularity recipes. It's all very tedious, as you basically have to enter all the commands necessary to acquire software, unpack the software, and build the software. Although, if you will have to do this anyway to install the software on your Klone node, then it would probably be best to save all the commands to a text file, which can be "easily" converted to a Singularity recipe (add the appropriate headers to different sections of the text file). Despite the initial tedium and struggles, after it's all said and done, you'll have an easy-to-use, and perfectly reproducible, environment ready to go! So, it could be worth the effort...

Thanks for this! I stayed up all night looking into sandboxes and recipes and it looks like the learning curve will be steep, but we'll figure it out.

kubu4 commented 3 years ago

I was under the impression that installing software on hyak was trickier than a local machine.

Only Python stuff. The primary reason is that Python defaults to trying to install packages "system-wide". Those "system-wide" locations are lockdown by UW IT for important security/stability reasons. To complicate things, the other option with Python installs is to install just for the user. The main issue with this is that it consumes the little space allocated on Mox login nodes and makes it impossible for other users in the group to access the packages; which means everyone has to install the packages themselves.

I've recently realized that the easiest way to handle this is by establishing an Anaconda environment. This allows easy installation of Python packages without the limitations described above. This assumes that you install Anaconda/Miniconda in a location shared by your group (e.g. /gscratch/srlab/programs/).

recipes and it looks like the learning curve will be steep

It seems steep, but it's really more tedious (at least for what you'll want). The primary thing you'll want from the recipe is to download, unpack, and install packages. You don't really need all of the other fluff (e.g. headers/sections like %files, %test, %labels). The initial setup/testing will take awhile, but once you have it all set, you'll build the container and then it's available to anyone at any time. Plus, it's portable. Meaning, you can just take a copy of the container (image) to another computer (which has Singularity installed) and start using it immediately just like you were on Mox.

Here's a Dockerfile I put together a number of years ago you can check out as an example that's more geared towards bioinformatics usage, instead of computer coding stuff:

https://github.com/RobertsLab/code/blob/master/dockerfiles/Dockerfile.bio

It definitely took a fair amount of time to get set up, but it works and is cool. But, (other than me), I don't think anyone every used it. LOL. Ugh.

Anyway, I'm happy to assist with stuff when I have time, if you so desire.

kubu4 commented 3 years ago

Here's a Dockerfile I put together

The reason I shared this example was to demonstrate what you're Singularity recipe might end up looking like (specifically, commands needed to download and install software).

kubu4 commented 3 years ago

The example was to also demonstrate that the bulk of the Dockerfile is just commands for downloading, unpacking, and installing software. You wouldn't much of anything else for a Singularity recipe, either.

nclowell commented 3 years ago

Thank so much for that clarification @kubu4, especially about conda for python packages on hyak! I had assumed that wasn't an option, but we'll give that a try for packages that have conda installs.

And thanks too for the deets on building singularity containers, that does sound consistent with what we've gathered this week from our dorky youtube video watching :nerd_face: