{"id":150136,"date":"2024-01-29T13:08:57","date_gmt":"2024-01-29T18:08:57","guid":{"rendered":"http:\/\/www.bu.edu\/tech\/?page_id=150136"},"modified":"2024-02-21T10:57:14","modified_gmt":"2024-02-21T15:57:14","slug":"scc-centos7","status":"publish","type":"page","link":"https:\/\/www.bu.edu\/tech\/support\/research\/software-and-programming\/containers\/scc-centos7\/","title":{"rendered":"SCC CentOS 7 Container"},"content":{"rendered":"<p>RCS provides a Singularity container to run jobs and programs using the CentOS 7 environment. This provides the exact set of modules, filesystem, and system libraries that were available on the SCC under CentOS 7.<\/p>\n<p><strong>Sections<\/strong><\/p>\n<ul>\n<li><a href=\"#running\">Running the CentOS 7 Singularity Container<\/a><\/li>\n<li><a href=\"#submit\">Submitting Your CentOS 7 Jobs<\/a><\/li>\n<li><a href=\"#migrate\">Migrating Conda Environments to AlmaLinux 8<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><a name=\"running\"><\/a><\/p>\n<h2>Running the CentOS 7 Singularity Container<\/h2>\n<p>The container can be run interactively, to run scripts, or as part of running jobs on the SCC via the queue.\u00a0 A script, <code><span class=\"command\">scc-centos7<\/span><\/code>, is provided to help run the container. To run the container interactively, just enter the name of the script. Here the interactive shell is started, and the file <code>\/etc\/os-release<\/code> is checked to demonstrate that the container is indeed running CentOS 7. Note that the shell prompt is different than the usual one on the SCC:<\/p>\n<pre><code><span class=\"prompt\">scc1%<\/span> <span class=\"command\">scc-centos7<\/span>\r\n<span class=\"prompt\">Singularity><\/span> <span class=\"command\">grep<\/span> \"CentOS Linux\" \/etc\/os-release\r\n<span class=\"output\">NAME=\"CentOS Linux\"\r\nPRETTY_NAME=\"CentOS Linux 7 (Core)\"\r\n<span class=\"prompt\">Singularity><\/span> <span class=\"command\">module avail<\/span> openblas\r\n\r\n------------ \/share\/module.7\/programming ------------ \r\n   openblas\/0.2.20    openblas\/0.3.7    \r\n   openblas\/0.3.13    openblas\/0.3.17 (D)\r\n\r\n  Where:\r\n   D:  Default Module\r\n\r\nIf the avail list is too long consider trying:\r\n\r\n\"module --default avail\" or \"ml -d av\" to just list the default modules.\r\n\"module overview\" or \"ml ov\" to display the number of modules for each name.\r\n\r\nUse \"module spider\" to find all possible modules and extensions.\r\nUse \"module keyword key1 key2 ...\" to search for all possible modules matching any of the \"keys\".<\/span>\r\n\r\n\r\n<span class=\"prompt\">Singularity><\/span>\r\n<span class=\"prompt\">Singularity><\/span> <span class=\"command\">exit<\/span>\r\n<\/code><\/pre>\n<p>Modules from CentOS 7 can be loaded normally when running the container, either interactively or when using the container to run a script. Any CentOS 7 modules that are not available on Alma8 will still print warning messages, but they can be ignored.<\/p>\n<p>The container can also be used to run a script. The script will execute in the CentOS 7 environment:<\/p>\n<pre class=\"code-block\"><code><span class=\"prompt\">scc1%<\/span> <span class=\"command\">scc-centos7<\/span> &lt; my_script.sh<\/code><\/pre>\n<div class=\"highlight-yellow\"><strong>Note the use of the &lt; character before the name of the script.<\/strong><\/div>\n<p>&nbsp;<\/p>\n<p><a name=\"submit\"><\/a><\/p>\n<h2>Submitting Your CentOS 7 Jobs<\/h2>\n<p>Job scripts can be run using the CentOS 7 container with the creation of an extra job script. This is best explained via an example. Here is a simple job script that runs a Python program, with 4 cores and a maximum job time of 24 hours. This job script is called <code>run_calc.qsub<\/code>:<\/p>\n<pre class=\"code-block\"><code>#!\/bin\/bash -l\r\n#$ -pe omp 4\r\n#$ -l h_rt=24:00:00\r\n\r\n<span class=\"command\">module load<\/span> python3\/3.8.10\r\n<span class=\"command\">python<\/span> run_calc.py<\/code><\/pre>\n<p>To run this using the CentOS 7 Singularity container, a second job script is created. The qsub options from the original job script are copied over, and the original script is executed by <code><span class=\"command\">scc-centos7<\/span><\/code>. This new job script is called <code>run_calc_cos7.qsub<\/code>:<\/p>\n<pre class=\"code-block\"><code>#!\/bin\/bash -l\r\n#$ -pe omp 4\r\n#$ -l h_rt=24:00:00\r\n\r\n<span class=\"command\">scc-centos7<\/span> &lt; run_calc.qsub <\/code><\/pre>\n<p>After the <code>run_calc_cos7.qsub<\/code> script has been created, it is submitted to the queue in the usual fashion:<\/p>\n<pre class=\"code-block\"><code><span class=\"prompt\">scc1%<\/span> <span class=\"command\">qsub<\/span> run_calc_cos7.qsub<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p><a name=\"migrate\"><\/a><\/p>\n<h2>Migrating Conda Environments to AlmaLinux 8<\/h2>\n<p>If you find that one of your conda environments is not functioning under Alma8, you can use the container as part of the process to re-create the conda environment under Alma8. This may correct any conda environment issues you are encountering. The steps here are similar to those used when moving a conda environment from <a href=\"https:\/\/www.bu.edu\/tech\/support\/research\/software-and-programming\/common-languages\/python\/anaconda\/#moving-env\">your home directory to your project space<\/a>.<\/p>\n<p>First, start up the CentOS 7 container interactively, and export the list of installed packages from your environment:<\/p>\n<pre class=\"code-block\"><code><span class=\"prompt\">scc1%<\/span> <span class=\"command\">scc-centos7<\/span>\r\n<span class=\"prompt\">Singularity&gt;<\/span> <span class=\"command\">module load<\/span> miniconda\r\n<span class=\"prompt\">Singularity&gt;<\/span> <span class=\"command\">conda<\/span> activate my_env1\r\n<span class=\"prompt\">(my_env1) Singularity&gt;<\/span> <span class=\"command\">conda<\/span> list --explicit &gt; my_env1_cos7_pkgs.txt\r\n<span class=\"prompt\">Singularity&gt;<\/span> <span class=\"command\">exit<\/span><\/code><\/pre>\n<p>On Alma8, you then re-create that environment:<\/p>\n<pre class=\"code-block\"><code><span class=\"prompt\">scc1%<\/span> <span class=\"command\">module load<\/span> miniconda\r\n<span class=\"prompt\">scc1%<\/span> <span class=\"command\">conda<\/span> create --name my_env2 --file my_env1_cos7_pkgs.txt\r\n<span class=\"prompt\">scc1%<\/span> <span class=\"command\">conda<\/span> activate my_env2<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>RCS provides a Singularity container to run jobs and programs using the CentOS 7 environment. This provides the exact set of modules, filesystem, and system libraries that were available on the SCC under CentOS 7. Sections Running the CentOS 7 Singularity Container Submitting Your CentOS 7 Jobs Migrating Conda Environments to AlmaLinux 8 &nbsp; Running&#8230;<\/p>\n","protected":false},"author":1692,"featured_media":0,"parent":112635,"menu_order":3,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/150136"}],"collection":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/users\/1692"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/comments?post=150136"}],"version-history":[{"count":6,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/150136\/revisions"}],"predecessor-version":[{"id":150242,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/150136\/revisions\/150242"}],"up":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/112635"}],"wp:attachment":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/media?parent=150136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}