Overview
The HPC cluster provides an advanced HPC environment with a variety of compilers, libraries and development tools, also known as GenSoft2.
For compilation you can use either the GNU compiler or more advanced Intel Parallel Studio XE, which normally gives more performance and has better template engine.
Once logged on maestro.pasteur.fr, to see what tools are available do:
Code Block (text)
$ module avail
| GNU WAY | Intel WAY | |
|---|---|---|
or, to find out about the gcc only: module avail gcc |
or, to find out about the Intel PS only: module avail icc |
|
| Choose later version and then load the module | module load gcc/7.2 |
module load icc/xe_2019 |
| if your code needs MPI, load it too | module load openmpi |
|
| if your code needs BOOST | module load boost |
|
| for NetCDF and HDF5 | module load hdf5 netcdf |
|
now compile helloworld.cpp |
g++ -o hello.x -O3 hello.cpp |
icpc -o hello.x -O5 hello.cpp |
if you have loaded libraries such as openmpi, use mpicxx compiler which is a wrapper for the compiler you loaded. Thus it's the same for gnu and intel |
mpicxx -o hello.x -O3 hello.cpp |
|
or with other libraries: where: * $LIBRARY_NAME_ROOT is something like $BOOST_ROOT * libname is typically the name of the library file without lib at the beginning and .so at the end (e.g. boost_chrono for libboost_chrono.so) |
g++ -L$LIBRARY_NAME_ROOT/lib -I$LIBRARY_NAME_ROOT/include -llibname |
Multiple versions of libraries are available. We update them on request but generally we keep older versions to maintain your workflow.
To simplify code development and utilization, a Makefile is used. You can find many advanced examples online, but in the simplest case, it is as follows.
Let us assume that your code has following parts:
Code Block (bash)
$ ls -1 myproject/
io.cpp
io.h
main.cpp
utils.cpp
utils.h
and uses several BOOST libraries, MPI and templates. Then we recommend to create a simple file (that you must call Makefile) like the following:
Code Block (text)
MPICXX=mpicxx -std=c++17 -Wno-deprecated
BOOST_LIBS=-lboost_mpi -lboost_serialization -lboost_system -lboost_filesystem -lboost_date_time
DEPS = utils.h io.h
OBJ = utils.o io.o
%.o: %.cpp $(DEPS)
$(MPICXX) -I/$(BOOST_ROOT)/include -g -c -o $@ $<
main: $(OBJ)
$(MPICXX) -L$(BOOST_ROOT)/lib -g -o main.x $(OBJ) $(BOOST_LIBS)
clean:
rm -f *.o main.x
Please note there is amandatory TAB before $MPICXX and rm
After creating such file, you only need to typemake
If you want to remove compiler-generated files, type make clean
For advanced compilation options please refer to: https://gcc.gnu.org/onlinedocs/gcc.pdf and Intel optimization guide
if you need help with your code, please write to konstantin.petrov@pasteur.fr