Skip to content

Commit

Permalink
Rework 16-modules lesson
Browse files Browse the repository at this point in the history
  • Loading branch information
s-sajid-ali committed Aug 27, 2024
1 parent 122cdad commit 2da235b
Show file tree
Hide file tree
Showing 15 changed files with 109 additions and 142 deletions.
29 changes: 15 additions & 14 deletions _episodes/15-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ message telling you so
## Loading and Unloading Software

To load a software module, use `module load`. In this example we will use
Python 3.
R.

Initially, Python 3 is not loaded. We can test this by using the `which`
Initially, R is not loaded. We can test this by using the `which`
command. `which` looks for programs the same way that Bash does, so we can use
it to tell us where a particular piece of software is stored.

Expand All @@ -105,13 +105,13 @@ it to tell us where a particular piece of software is stored.
```
{: .language-bash}

{% include {{ site.snippets }}/modules/missing-python.snip %}
{% include {{ site.snippets }}/modules/missing-r.snip %}

We can load the `python3` command with `module load`:
We can load the `R` command with `module load`:

{% include {{ site.snippets }}/modules/module-load-python.snip %}
{% include {{ site.snippets }}/modules/module-load-r.snip %}

{% include {{ site.snippets }}/modules/python-executable-dir.snip %}
{% include {{ site.snippets }}/modules/r-executable-dir.snip %}

So, what just happened?

Expand All @@ -134,14 +134,15 @@ there's only one difference: the different directory at the beginning. When we
ran the `module load` command, it added a directory to the beginning of our
`$PATH`. Let's examine what's there:

{% include {{ site.snippets }}/modules/python-ls-dir-command.snip %}
{% include {{ site.snippets }}/modules/r-ls-dir-command.snip %}

{% include {{ site.snippets }}/modules/python-ls-dir-output.snip %}
{% include {{ site.snippets }}/modules/r-ls-dir-output.snip %}

Taking this to its conclusion, `module load` will add software to your `$PATH`.
It "loads" software. A special note on this - depending on which version of the
`module` program that is installed at your site, `module load` will also load
required software dependencies.
required software dependencies. For instance loading the

Check failure on line 144 in _episodes/15-modules.md

View workflow job for this annotation

GitHub Actions / lint_common_files

Trailing spaces [Expected: 0 or 2; Actual: 1]

_episodes/15-modules.md:144:57 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
module `lammps/openmpi/intel/20231214` also loads:

{% include {{ site.snippets }}/modules/software-dependencies.snip %}

Expand Down Expand Up @@ -180,16 +181,16 @@ Let's examine the output of `module avail` more closely.

> ## Using Software Modules in Scripts
>
> Create a job that is able to run `python3 --version`. Remember, no software
> Create a job that is able to run `R --version`. Remember, no software
> is loaded by default! Running a job is just like logging on to the system
> (you should not assume a module loaded on the login node is loaded on a
> compute node).
>
> > ## Solution
> >
> > ```
> > {{ site.remote.prompt }} nano python-module.sh
> > {{ site.remote.prompt }} cat python-module.sh
> > {{ site.remote.prompt }} nano r-module.sh
> > {{ site.remote.prompt }} cat r-module.sh
> > ```
> > {: .language-bash}
> >
Expand All @@ -199,9 +200,9 @@ Let's examine the output of `module avail` more closely.
> > {{ site.sched.comment }} {{ site.sched.flag.qos }}
> > {% endif %}{{ site.sched.comment }} {{ site.sched.flag.time }} 00:00:30
> >
> > module load {{ site.remote.module_python3 }}
> > module load r/gcc/4.4.0
> >
> > python3 --version
> > R --version
> > ```
> > {: .output}
> >
Expand Down

This file was deleted.

16 changes: 16 additions & 0 deletions _includes/snippets_library/NYU_Greene_slurm/modules/missing-r.snip
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```
/usr/bin/which: no R in
(share/apps/singularity/bin:
/share/apps/local/bin:
/home/yourUsername/.local/bin:
/home/yourUsername/bin:
/share/apps/singularity/bin:
/share/apps/local/bin:
/usr/local/bin:
/usr/bin:
/usr/local/sbin:
/usr/sbin:
/usr/lpp/mmfs/bin:
/opt/slurm/bin:)
```
{: .output}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```
{{ site.host_prompt }} module load r/gcc/4.4.0
{{ site.host_prompt }} which R
```
{: .language-bash}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
```
/cluster/software/Python/3.8.2-GCCcore-9.3.0/bin:
/cluster/software/XZ/5.2.5-GCCcore-9.3.0/bin:
/cluster/software/bzip2/1.0.8-GCCcore-9.3.0/bin:
/cluster/software/binutils/2.34-GCCcore-9.3.0/bin:
/cluster/software/GCCcore/9.3.0/bin:/node/bin:/usr/local/bin:
/usr/bin:/usr/local/sbin:/usr/sbin:/cluster/bin:
/cluster/home/sabryr/.local/bin:/cluster/home/sabryr/bin
/share/apps/r/4.4.0/gcc/bin:
/share/apps/singularity/bin:
/share/apps/local/bin:
/home/yourUsername/.local/bin:
/home/yourUsername/bin:
/usr/local/bin:
/usr/bin:
/usr/local/sbin:
/usr/sbin:
/usr/lpp/mmfs/bin:
/opt/slurm/bin:
```
{: .output}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```
/share/apps/r/4.4.0/gcc/bin/R
```
{: .output}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```
{{ site.host_prompt }} ls /share/apps/r/4.4.0/gcc/bin
```
{: .language-bash}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```
R Rscript __run_base.bash
```
{: .output}
Original file line number Diff line number Diff line change
Expand Up @@ -6,69 +6,40 @@ software modules.
```
{: .language-bash}
```
Currently Loaded Modules:
1) StdEnv (S) 6) libreadline/8.0-GCCcore-8.2.0 (H)
2) GCCcore/8.2.0 7) XZ/5.2.4-GCCcore-8.2.0 (H)
3) bzip2/1.0.6-GCCcore-8.2.0 (H) 8) GMP/6.1.2-GCCcore-8.2.0 (H)
4) zlib/1.2.11-GCCcore-8.2.0 (H) 9) libffi/3.2.1-GCCcore-8.2.0 (H)
5) ncurses/6.1-GCCcore-8.2.0 (H) 10) Python/3.7.2-GCCcore-8.2.0
Where:
S: Module is Sticky, requires --force to unload or purge
H: Hidden Module
No modules loaded
```
{: .output}

```
{{ site.host_prompt }} module load Beast/2.5.2-GCC-8.2.0-2.31.1
{{ site.host_prompt }} module load lammps/openmpi/intel/20231214
{{ site.host_prompt }} module list
```
{: .language-bash}

```
Currently Loaded Modules:
1) StdEnv (S) 9) libffi/3.2.1-GCCcore-8.2.0
2) GCCcore/8.2.0 10) Python/3.7.2-GCCcore-8.2.0
3) bzip2/1.0.6-GCCcore-8.2.0 (H) 11) binutils/2.31.1-GCCcore-8.2.0
4) zlib/1.2.11-GCCcore-8.2.0 (H) 12) GCC/8.2.0-2.31.1
5) ncurses/6.1-GCCcore-8.2.0 (H) 13) Java/11.0.2
6) libreadline/8.0-GCCcore-8.2.0 (H) 14) beagle-lib/3.1.2-GCC-8.2.0-2.31.1
7) XZ/5.2.4-GCCcore-8.2.0 (H) 15) Beast/2.5.2-GCC-8.2.0-2.31.1
8) GMP/6.1.2-GCCcore-8.2.0 (H)
1) szip/intel/2.1.1 5) gsl/intel/2.6 9) python/intel/3.8.6
2) hdf5/intel/1.12.0 6) openmpi/intel/4.0.5 10) boost/intel/1.74.0
3) netcdf-c/intel/4.7.4 7) fftw/openmpi/intel/3.3.9 11) plumed/openmpi/intel/2.8.3
4) pnetcdf/openmpi/intel/1.12.1 8) intel/19.1.2 12) lammps/openmpi/intel/20231214
Where:
S: Module is Sticky, requires --force to unload or purge
H: Hidden Module
```
{: .output}

So in this case, loading the `beast` module (a bioinformatics software
package), also loaded `Java/11.0.2` and `beagle-lib/3.1.2-GCC-8.2.0-2.31.1` as
well. Let's try unloading the `beast` package.
So in this case, loading the `lammps` module (a molecular dynamics
software package), also loaded 11 other modules as well. Let's try
unloading the `lammps` package.

```
{{ site.host_prompt }} module unload Beast/2.5.2-GCC-8.2.0-2.31.1
{{ site.host_prompt }} module unload lammps/openmpi/intel/20231214
{{ site.host_prompt }} module list
```
{: .language-bash}

```
Currently Loaded Modules:
1) StdEnv (S) 8) GMP/6.1.2-GCCcore-8.2.0 (H)
2) GCCcore/8.2.0 9) libffi/3.2.1-GCCcore-8.2.0 (H)
3) bzip2/1.0.6-GCCcore-8.2.0 (H) 10) Python/3.7.2-GCCcore-8.2.0
4) zlib/1.2.11-GCCcore-8.2.0 (H) 11) binutils/2.31.1-GCCcore-8.2.0 (H)
5) ncurses/6.1-GCCcore-8.2.0 (H) 12) GCC/8.2.0-2.31.1
6) libreadline/8.0-GCCcore-8.2.0 (H) 13) Java/11.0.2
7) XZ/5.2.4-GCCcore-8.2.0 (H) 14) beagle-lib/3.1.2-GCC-8.2.0-2.31.1
Where:
S: Module is Sticky, requires --force to unload or purge
H: Hidden Module
No modules loaded
```
{: .output}

Expand All @@ -81,13 +52,6 @@ everything).
```
{: .language-bash}
```
The following modules were not unloaded:
(Use "module --force purge" to unload all):
1) StdEnv
No modules loaded
```
{: .output}

Note that `module purge` is informative. It lets us know that all but a default
set of packages have been unloaded (and how to actually unload these if we
truly so desired).

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Let's take a closer look at the `nextflow` module. Nextflow is a scientific
workflow system predominantly used for bioinformatic data analysis
In this case, we have:

```
nextflow/20.07.1 nextflow/20.11.0-edge nextflow/21.10.5 nextflow/23.04.1
nextflow/20.10.0 nextflow/21.04.3 nextflow/21.10.6 nextflow/24.04.3
```
{: .language-bash}

How do we load each copy and which copy is the default?

```
{{ site.host_prompt }} module load Nextflow
```
{: .language-bash}

```
Lmod has detected the following error: The following module(s) are unknown: "Nextflow"
Please check the spelling or version number. Also try "module spider ..."
It is also possible your cache file is out-of-date; it may help to try:
$ module --ignore-cache load "Nextflow"
Also make sure that all modulefiles written in TCL start with the string #%Module
```
{: .output}

To load a software module we must specify the full module name:

```
{{ site.host_prompt }} module load nextflow/24.04.3
{{ site.host_prompt }} nextflow -version
```
{: .language-bash}

0 comments on commit 2da235b

Please sign in to comment.