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.

  1. Download the FFTW tarball. Here, we download version 3.3.9:

    cd ~
    wget http://www.fftw.org/fftw-3.3.9.tar.gz
    
  2. Extract the tarball:

    tar xzf fftw-3.3.9.tar.gz
    
  3. Move into the directory:

    cd fftw-3.3.9
    
  4. 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
    
  5. Compile the software:

    make -j 8
    
  6. Instead of the default make install, which typically requires root access for system-wide installation, you can make 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

Note

There are no configure options used and the information is stored within the makefiles mylammps/MAKE in the make.serial and make.mpi files.

The following instructions to build LAMMPS using make.

  1. To allocate an interactive job on compute node type:

    srun -N 1 -n 28 --constraint=ib --pty /bin/bash
    
  1. Load the following modules required for building LAMMPS:

    module load openmpi/4.0.5
    module load python/3.6.6
    module load gcc/9.2.0
    
  2. Change the directory to the src directory using the command cd /path/to/mylammps/src

  3. 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 and lmp_mpi for an MPI build.

    make serial
    make mpi
    

Now you can start running the program, using ./lmp_serial or mpirun -n 1 ./lmp_mpi -h.