Showing posts with label lammps. Show all posts
Showing posts with label lammps. Show all posts

Installing lammps using Intel Compilers, OpenMPI and FFTW

This is a entry on how I install LAMMPS using Intel, OpenMPI and FFTW
  1. If you are eligible for the Intel Compiler Free Download. Download the Free Non-Commercial Intel Compiler Download
  2. Build OpenMPI with Intel Compiler
  3. Install FFTW. Remember to install FFTW-2.1.x and not FFTW-3.x or you will face an issue fft3d.h(164): catastrophic error: could not open source file "fftw.h" . Read the LAMMPS "Getting Started" Section for more information
  4. When you are ready and about to compile, there are several "Make" selection found at "$SOURCE/lammps-30Mar10/src/MAKE". I chose the makefile.openmpi. Be default you do not need to edit the Makefile.openmpi. But if you are a guru and want to edit the file, feel free to
  5. Finally go to the preceding directory by typing
    cd .. (ie $SOURCE/lammps-30Mar10/src)
    make openmpi -j (-j for parallel compilation)
  6. At the end of the compilation, you should see a lmp_openmpi binary at the src directory. You are almost done
  7. Check that the executable are properly linked by doing a
    # ldd lmp_openmpi
  8. Remember to include /usr/local/lib in the LD_LIBRARY_PATH if libmpi_cxx.so.0 is located at /usr/local/lib

fft3d.h(164): catastrophic error: could not open source file "fftw.h"

I was compiling LAMMPS Molecular Dynamics Simulator.
  1. Using $SOURCE/lammps-30Mar10/src
  2. I compiled using make.linux. Quite soon, I encounter the following error fft3d.h(164): catastrophic error: could not open source file "fftw.h"
  3. I have compiled my fftw3 and my Intel Math Kernel library properly and was able to locate the header in my Intel Math Kernel Library. I've correctly "source" the path at LD_LIBRARY_PATH and /etc/ld.so.conf.d. But the LAMMPS is still not able to locate the library.
  4. I realise the cruz of the problem was that LAMPS requires FFTW-2.1.x. configuring and compiling fftw-2.x, the problem went away
Problem eliminated. My compilation is not done yet. But this fftw initial problem is settle for now :)

Installing lammps using Intel Compilers, OpenMPI and FFTW (Update)

This is an update of  Blog Entry Installing lammps using Intel Compilers, OpenMPI and FFTW

The steps are still relevant and workable, but if you are doing a lot of customisation pathing or you just simply wish to tweak the parameters in the configuration file, here is my sample script. I got my information from the Message threads of LAMMPS http://lammps.sandia.gov/threads/msg12768.html

Here are my settings, amending the $SOURCE/lammps-30Mar10/src/MAKE/Makefile.Linux

# linux = RedHat Linux box, Intel icc, MPICH2, FFTW

SHELL = /bin/sh
# ---------------------------------------------------------------------
# compiler/linker settings
# specify flags and libraries needed for your compiler

CC = mpicc
CCFLAGS = -g -O -I/usr/local/fftw/include -DFFT_FFTW
DEPFLAGS = -M
LINK = mpicc
LINKFLAGS = -O
USRLIB = -lfftw -lmpi
LIB = -lstdc++ -lpthread
ARCHIVE = ar
ARFLAGS = -rc
SIZE = size

# ---------------------------------------------------------------------

# LAMMPS-specific settings
# specify settings for LAMMPS features you will use
# LAMMPS ifdef options, see doc/Section_start.html

LMP_INC = -DLAMMPS_GZIP
# MPI library, can be src/STUBS dummy lib
# INC = path for mpi.h, MPI compiler settings
# PATH = path for MPI library
# LIB = name of MPI library:wq

MPI_INC = -DMPICH_IGNORE_CXX_SEEK
MPI_PATH = -L/usr/mpi/intel/lib # where I store my openmpi binary and lib
MPI_LIB = -lmpi -lpthread

# FFT library, can be -DFFT_NONE if not using PPPM from KSPACE package
# INC = -DFFT_FFTW, -DFFT_INTEL, -DFFT_NONE, etc, FFT compiler settings
# PATH = path for FFT library
# LIB = name of FFT library

FFT_INC = -DFFT_FFTW
FFT_PATH = -L/usr/local/fftw/lib # I've put my fftw at /usr/local/fftw
FFT_LIB = -lfftw

.............

You can add further flags at CCFLAGS. See my other blog entry
  1. Understanding -DOMPI_SKIP_MPICXX Flag for compiler/linker settings
  2. Understanding -DOMPI_IGNORE_CXX_SEEK Flag for compiler/linker settings