Installing PLUTO and its dependencies on your linux machine for parallel computation

Last updated: Wednesday, April 24, 2024

Installing dependencies

In this demonstration, we will install the modules in one designated folder, say "modules". The user should replace <username> with his/her/their username on the desktop in all the syntax that follows.

Make a directory where you want to keep all the installations grouped. We are gonna name it "modules" for now.

mkdir modules/

cd modules/


Installing mpich

Download mpich tar file from the web, with wget on terminal

wget https://www.mpich.org/static/downloads/4.2.1/mpich-4.2.1.tar.gz

We don't want to install it in the default locations; instead, we want to specify a custom installation path. For this, create a directory ./mpich in the /home/<username>/modules directory using mkdir.

Unpack the downloaded tar file and use cd to move to the unpacked folder

tar -xfz mpich-4.2.1.tar.gz 

cd  mpich-4.1.2/

and configure and install the module

./configure --prefix=/home/<username>/modules/mpich --enable-shared --disable-fortran 

make -j8 

make install 

Use -j8 if your system has at least 8 processors; otherwise, use echo $(nproc) to decide on the maximum number of threads. Once the installation has finished successfully, you will see that the installation directory has lib, bin and include folders.

ls /home/<username>/modules/mpich

>> bin  include  lib  share


Now, add the installation path to your ~/.bashrc (using your favorite editor, say vi ~/.bashrc)

 export MPI_HOME="/home/<username>/modules/mpich"

 export LD_LIBRARY_PATH="$MPI_HOME/lib:$LD_LIBRARY_PATH"

 export PATH="$MPI_HOME/bin:$PATH"

 Run source ~/.bashrc to re-run the bash script or open a new terminal.

NOTE: In case you encounter some error and there is a huge log on screen, the output dumped on the screen can be saved to a .txt file:

./configure --prefix=/home/<username>/modules/mpich --enable-shared --disable-fortran 2>&1 | tee c.txt

Use vi c.txt and look for the error messages.

Similarly, make -j4 2>&1 | tee m.txt and make install 2>&1 | tee mi.txt.


Continuing with other PLUTO dependencies :: somewhat similar steps as above

Install zlib

cd /home/<username>/modules/

mkdir zlib

wget https://www.zlib.net/zlib-1.3.1.tar.gz

tar -xfz zlib-1.3.1.tar.gz  

cd zlib-1.3.1/ 

./configure --prefix=/home/<username>/modules/zlib

make -j4 && make install

We will add a path LD_LIBRARY_PATH to ~/.bashrc; required when -lz flag is called in the local_make. 

export LD_LIBRARY_PATH="$/home/<username>/modules/zlib/lib:$LD_LIBRARY_PATH"


Install szip

cd /home/<username>/modules/

mkdir szip

wget https://support.hdfgroup.org/ftp/lib-external/szip/2.1.1/src/szip-2.1.1.tar.gz

tar -xfz szip-2.1.1.tar.gz 

cd szip-2.1.1/ 

./configure --prefix=/home/<username>/modules/szip

make -j4 && make install

No need to add to ~/.bashrc


Install gsl (optional)

cd /home/<username>/modules/

mkdir gsl

wget ftp://ftp.gnu.org/gnu/gsl/gsl-2.6.tar.gz

tar -xfz gsl-2.6.tar.gz

cd gsl-2.6/

./configure --prefix=/home/<username>/modules/gsl

make -j4 && make install

Add the following to ~/.bashrc

export GSL_HOME="/home/<username>/modules/gsl"

export LD_LIBRARY_PATH="$GSL_HOME/lib:$LD_LIBRARY_PATH"

export PATH="$GSL_HOME/bin:$PATH"

Run source ~/.bashrc to re-run the bash script or open a new terminal.

We are now ready to install HDF5...

Install HDF5 parallel and serial installations (https://www.hdfgroup.org/downloads/hdf5/)

Let's first create our installation folders

cd /home/<username>/modules/

mkdir hdf5/parallel 

mkdir hdf5/serial

Then download the hdf5 module

wget https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5_1.14.4.2.tar.gz

tar xfz hdf5_1.14.4.2.tar.gz 

cd hdf5_1.14.4.2/


For parallel mode ::

export MPICH=/home/<username>/modules/mpich/bin


CC=$MPICH/mpicc ./configure --prefix=/home/<username>/modules/hdf5/parallel --enable-shared --with-zlib=/home/<username>/modules/zlib --with-szlib=/home/<username>/modules/szip --enable-parallel --enable-build-mode=production


make -j4 && make install

Just make sure that the installation directory now has lib, bin, and include folders

ls /home/<username>/modules/hdf5/parallel/

>> bin  include  lib  share


For serial mode ::

cd /home/<username>/modules/hdf5_1.14.4.2/

make clean


./configure --prefix=/home/<username>/modules/hdf5/serial --enable-shared --with-zlib=/home/<username>/modules/zlib --with-szlib=/home/<username>/modules/szip --enable-serial --enable-cxx --enable-build-mode=production 2>&1 | tee c_serial.txt


make -j4 && make install


Now, add the installation path to your ~/.bashrc

export HDF5_HOME="/home/<username>/modules/hdf5/parallel"

export LD_LIBRARY_PATH="$HDF5_HOME/lib:$LD_LIBRARY_PATH"

export PATH="$HDF5_HOME/bin:$PATH"

 Run source ~/.bashrc to re-run the bash script or open a new terminal. Replace parallel with serial if you are not using a parallel HDF5 (with MPI).

The PLUTO file you have downloaded (say, in the Downloads folder) is ready to be used as you untar it with: tar xfz pluto-4.4.tar.gz. Add the PLUTO installation path to your ~/.bashrc

 export PLUTO_DIR="/home/<username>/Downloads/PLUTO"


A secure copy from the local terminal to a remote cluster can be made with the following command.

scp /home/<username>/Downloads/pluto-4.4.tar.gz <username>@10.XX.XX.XXX:/home/<username>/

!IMPORTANT: Once you have successfully installed the modules, you can, in principle, get rid of the *.tar.gz files and the unpacked folders like mpich-4.1.2/,  zlib-1.3.1/, hdf5_1.14.4.2/ etc. Don't delete the installation directories unless you want to re-install/update them.

There you are!  

Ready to run... 🎉