Make¶
Important
Be sure to refer to the installation instructions provided with software being installed. If the software requires additional dependencies not installed on the system, they might need to installed and added to your PATH
similarly.
If you want to use make
to add software locally to your path, you must first download the software package from its source (e.g., its webpage or GitHub) and unpack it or unzip it if need be. Then, you must set the installation path to a directory with write access on the cluster, such as your home directory or your /work
.
Note
You can use ./configure
to specify the installation path (e.g., ./configure --prefix=${HOME}/software
).
After setting the installation path, compile the code via make
and then install the software using make install
.
Makefile Example: Installing FFTW Library¶
Even without root access, you can install software system-wide by installing it in your home directory. Let us continue with the FFTW library as an example.
Download the FFTW tarball. Here, we download version 3.3.9:
cd ~ wget http://www.fftw.org/fftw-3.3.9.tar.gz
Extract the tarball:
tar xzf fftw-3.3.9.tar.gz
Move into the directory:
cd fftw-3.3.9
Configure the build process, specifying the prefix as a location in your home directory. This location is where the library will be installed. Note that the specified directory should be in your
PATH
to ensure system-wide accessibility../configure --prefix=$HOME/fftw
Compile the software:
make -j 8
Instead of the default
make install
, which typically requires root access for system-wide installation, you canmake install
with the prefix configuration to install the software in your home directory.make install
The FFTW library should now be installed in the fftw
directory in your home directory.
Important
Include the location of the software in your PATH
to access directly. This can be done by adding the following line to your ~/.bashrc
:
export PATH=$HOME/fftw/bin:$PATH
This puts the program in your path so that the system can find the FFTW library binaries when called.
Note
You need to source your profile or restart your shell for these changes to take effect, which is done as follows:
source ~/.bashrc
Makefile Example: Installing LAMMPS¶
See also
Note
There are no configure options used and the information is stored within the makefiles MAKE
directory inside of the LAMMPS source code in the make.serial
and make.mpi
files.
The following instructions to build LAMMPS using make
.
To allocate an interactive job on compute node type:
srun -N 1 -n 28 --constraint=ib --pty /bin/bash
Load the following modules required for building LAMMPS:
module load gcc/11.1.0 module openmpi/4.1.2-gcc11.1
Download the source code to LAMMPS:
cd ~ wget https://github.com/lammps/lammps/archive/refs/tags/stable_29Aug2024.tar.gz tar -xvf stable_29Aug2024.tar.gz
Change the directory to the
src
directory using the commandcd lammps-stable_29Aug2024/src
Use the following command to build serial version or the MPI version of LAMMPS depending on the requirement. This will generate
lmp_serial
binary for a serial build andlmp_mpi
for an MPI build.make yes-most make serial make mpi
To use the LAMMPS build, you will need to setup your environment so the binaries are in your PATH. This can be completed by including the following export statement in your sbatch script or have it as a script that you can source in your job script:
#!/bin/bash #SBATCH -N 1 #SBATCH -n 8 #SBATCH -p short module load gcc/11.1.0 module openmpi/4.1.2-gcc11.1 export PATH=/home/$USER/lammps-stable_29Aug2024/src:$PATH cd ~ mpirun -n 8 lmp_mpi -in /home/$USER/lammps-stable_29Aug2024/examples/melt/in.melt
or create the following script in your
$HOME
calledlammps_env.sh
#!/bin/bash module load gcc/11.1.0 module openmpi/4.1.2-gcc11.1 export PATH=/home/$USER/lammps-stable_29Aug2024/src:$PATH
and modify your sbatch job script to source this environment file that will setup your environment for your job:
#!/bin/bash #SBATCH -N 1 #SBATCH -n 8 #SBATCH -p short source /home/$USER/lammps_env.sh cd ~ mpirun -n 8 lmp_mpi -in /home/$USER/lammps-stable_29Aug2024/examples/melt/in.melt