This section will cover the basic usage of environment modules and virtual environments, with all software and numerical libraries available at the cluster.
In the cluster you can find these C/C++ compilers :
gcc /g++ -> GNU Compilers for C/C++
% man gcc
% man g++
All invocations of the C or C++ compilers follow these suffix conventions for input files:
By default, the preprocessor is run on both C and C++ source files.
These are the default sizes of the standard C/C++ datatypes on the machine
Default datatype sizes on the machine
Type | Length (bytes) |
---|---|
bool (c++ only) | 1 |
char | 1 |
wchar_t | 4 |
short | 2 |
int | 4 |
long | 8 |
float | 4 |
double | 8 |
long double | 16 |
To compile MPI programs it is recommended to use the following handy wrappers: mpicc, mpicxx for
C and C++ source code. You need to choose the Parallel environment first: module load openmpi. These wrappers will include all the necessary libraries to build MPI applications without having to specify all the details by hand.
% mpicc a.c -o a.exe
% mpicxx a.C -o a.exe
Lmod is a module system that offers a way to dynamically change the users environment through modulefiles, including adding and removing directories from the PATH environment variable. In order to the user communicate with Lmod, it has a list of commands to interact with it.
The module command sets the proper environment variable, independently of the user's shell. Typically, a system will load a default set of modules.
In order to find which modules are loaded, a user can do:
$ module list
To find out which modules are available to be loaded, a user can do:
$ module available
-------------------------- /opt/ohpc/pub/macc/modules/sandybridge/modules/all ---------------------------
Autoconf/2.69-GCCcore-6.4.0 Ninja/1.9.0-GCCcore-8.2.0
Autoconf/2.69-GCCcore-8.2.0 (D) OpenBLAS/0.2.20-GCC-6.4.0-2.28
Automake/1.15.1-GCCcore-6.4.0 OpenBLAS/0.3.5-GCC-8.2.0-2.31.1 (D)
Automake/1.16.1-GCCcore-8.2.0 (D) OpenFOAM/v1812-foss-2019a
Autotools/20170619-GCCcore-6.4.0 OpenFOAM/v1906-foss-2019a
Autotools/20180311-GCCcore-8.2.0 (D) OpenFOAM/6-foss-2019a (D)
Bison/3.0.4-GCCcore-6.4.0 OpenMPI/2.1.1-GCC-6.4.0-2.28
Bison/3.0.4 OpenMPI/3.1.3-GCC-8.2.0-2.31.1 (D)
Bison/3.0.5-GCCcore-6.4.0 PCRE/8.43-GCCcore-8.2.0
Bison/3.0.5-GCCcore-8.2.0 PETSc/3.11.1-foss-2019a
Bison/3.0.5 ParMETIS/4.0.3-foss-2017b
Bison/3.3.2 (D) ParMETIS/4.0.3-gompi-2019a (D)
Boost/1.70.0-gompi-2019a ParMGridGen/1.0-foss-2017b
CFITSIO/3.47-GCCcore-8.2.0 ParMGridGen/1.0-foss-2019a (D)
CGAL/4.11.1-foss-2019a-Python-3.7.2 Perl/5.28.1-GCCcore-8.2.0
CGAL/4.14-foss-2019a-Python-3.7.2 (D) Python/2.7.14-foss-2017b
CMake/3.9.1-GCCcore-6.4.0 Python/2.7.15-GCCcore-8.2.0
CMake/3.9.5-GCCcore-6.4.0 Python/2.7.16-GCCcore-8.2.0
CMake/3.13.3-GCCcore-8.2.0 (D) Python/3.7.2-GCCcore-8.2.0 (D)
Eigen/3.3.7 ROOT/6.18-GCCcore-8.2.0
FFTW/3.3.6-gompi-2017b SCOTCH/6.0.4-foss-2017b
FFTW/3.3.8-gompi-2019a (D) SCOTCH/6.0.6-gompi-2019a (D)
GCC/6.4.0-2.28 SQLite/3.20.1-GCCcore-6.4.0
GCC/8.2.0-2.31.1 (D) SQLite/3.27.2-GCCcore-8.2.0 (D)
These are a few packages available on MACC.
To load packages a user can do:
$ module load packageA packageB
In the same manner, a user can unload packages with:
$ module unload packageA packageB
It may happen that a user wants to change, for example, his OpenFOAM version. So if the user that already has the version v1812-foss-2019a and needs the v1906-foss-2019a version, he can just do:
$ module swap OpenFOAM/v1812-foss-2019a OpenFOAM/v1906-foss-2019a
If a user wants to unload all currently loaded modules he has 2 options, either he can go back to a default set of modules, with:
$ module reset
This will unload all the modules and then load the list specified by LMOD_SYSTEM_DEFAULT_MODULES variable.
The other option is restoring the modules to the user default, with
$ module restore
The user may search for specific modules to load.
Will list all modules.
$ module spider
Results may be filtered:
Will show only modules with the name 'python'.
$ module spider python
To show more detailed information on a specific package you
must specify the version if there is more than one version.
$ module spider python/3.7.7
Here we search for module by name/keyword, 'python' in this case, and will show all possible modules matching that keyword.
$ module keyword python
In case the user needs a description of what the modules does, he can do:
$ module whatis moduleA
Writing module every time a user wants to execute a command is boring, so Lmod provides the ml tool. The most common command are module list and module load<_>, the ml command does both:
$ ml
This is equivalent to module list, and:
$ ml moduleA
means module load moduleA while:
$ ml -moduleA
means module unload moduleA. You can also combine them:
$ ml -moduleA moduleB
meaning module unload moduleA; module load moduleB.
You can also do other module commands:
$ ml avail
$ ml whatis moduleA
$ ml show moduleB
So, instead of using module you can use ml.
Some of the most relevant scientific software publicly available at bob are:
You are welcome to download third-party research software and install it in your account.
Python is a interpreted high level language that emphasizes code readibility and productivity. This, as other reasons, has driven its growth in sciences and make it a must in HPC clusters. Macc comes with a variety of Python distributions:
These installations may come with packages often needed in HPC environments, however, there are Python packages which do not fit in the Python installation tree. Sometimes, the users need to have the flexibilty to install packages without having to install their own Python distribution.
Python Virutal Environment solves this problems by allowing the users to create a virtual distribution from an existing Python installation. We can see a more detailed view of the Python installed distributions by:
$ ml av Python
-------------- /opt/ohpc/pub/macc/modules/sandybridge/modules/all --------------
Python/2.7.14-foss-2017b Python/2.7.16-GCCcore-8.2.0
Python/2.7.15-GCCcore-8.2.0 Python/3.7.2-GCCcore-8.2.0 (D)
Where:
D: Default Module
As there are some differences between creating a Virtual Environment under Python 2.x and Python 3.x, there will be 2 sections explaining the setup on both versions.
Before we setup the virtual environment, we must have virtualenv installed in the main distribution.
By default, MACC uses a Python 3.x distribution, as we can see with ml av Python
command. In this section we will use Python 2.7.16 as an example.
$ ml Python/2.7.16-GCCcore-8.2.0 # Loads Python distribution
$ virtualenv --system-site-packages VirtualEnvNAME-Python-2.7.16 # Creates the virtual environment
$ ml -Python/2.7.16-GCCcore-8.2.0 # Unloads Python distribution
The flag --system-site-packages allows the use of packages installed in the main distribution.
$ source VirtualEnvNAME-Python-2.7.16 # Activates the virtual environment
You can check if your virtual environment is being used by using which python
that should result on VirtualEnvNAME-Python-2.7.16/bin/python.
To install the packages that you need, you can simply:
$ pip install PACKAGE_NAME
In the same manner as the previous section, we can see and load which python distribution we want to use, being Python 3.7.2 the focus of this section. It can be load and unloaded with the same lmod commands.
$ ml Python/3.7.2-GCCcore-8.2.0 # Loads Python distribution
$ virtualenv --system-site-packages VirtualEnvNAME-Python/3.7.2 # Creates the virtual environment
$ ml -Python/3.7.2-GCCcore-8.2.0 # Unloads Python distribution
The flag --system-site-packages allows the use of packages installed in the main distribution.
$ source VirtualEnvNAME-Python-3.7.2 # Activates the virtual environment
You can check if your virtual environment is being used by using which python
that should result on VirtualEnvNAME-Python-3.7.2/bin/python.
To install the packages that you need, you can:
$ python -m pip install PACKAGE_NAME