Source Code

Preparing to Install

Obtaining software directly from the source code generally requires Linux to configure so as to help the program to run on wide varieties of computers by matching the libraries on user’s computer. The configuration process creates make files for compiling the code, the executable of which will then be installed at the appropriate install directory. Finally, you can configure your .bashrc file (BASHRC Configuration).

Unzip or Untar the Installation file as described in the Section "Installing Binaries"

cd to installation Directory (We recommend to have your installation directory structures as /home/CaseID/.usr/local/src/<software>)

cd /home/CaseID>/<path-to-source-directory>

You can find README, Notes, or INSTALL files along with other configuration files. These files can guide you on your installation process.

In the installation directory, if you find CMakeLists.txt, then you need to install it using cmake utility as described in Section "CMAKE Installation". If you find configure file, then refer to Section "Configure-Make-MakeInstall Installation". During installation, the default compilers and libraries required for installation are used. Along with the compiler, Linker flags, you may need to provide the path to the binaries, include path, and libraries as required by your software or those you chose to use.

Example: Check what are the default Intel, GNU, and MPI compilers:

which gcc; which icc; which mpicc

output:

/usr/bin/gcc                                                    #GNU C Compiler

/usr/local/intel/2012/composerxe-2011.3.174/bin/intel64/icc     #INTEL C Compiler

/usr/local/openmpi/1.6.3/bin/mpicc                              #MPI C Compiler

Check the versions:

gcc -v; icc -v

Check if you have the module for latest version - example: gcc

module spider gcc

output:

Rebuilding cache, please wait ... (written to file) done.

----------------------------------------------------------------------------

  gcc:

----------------------------------------------------------------------------

     Versions:

        gcc/4.7.3

        gcc/4.9.3

----------------------------------------------------------------------------

  To find detailed information about gcc please enter the full name.

  For example:

     $ module spider gcc/4.9.3

----------------------------------------------------------------------------

You can check the other compilers using the module avail command or visiting Software Guide. For example, if you are looking for other MPI modules, then type module command:

module avail mpi # or openmpi

In case, you are using default MPI (OpenMPI), see its compiler, include, and library paths as:

module display openmpi

output:

--------------------------------------------------------------------

/usr/local/share/modulefiles/Compiler/intel/17/openmpi/2.0.1.lua:

--------------------------------------------------------------------

pushenv("CC","mpicc")

pushenv("CXX","mpicxx")

pushenv("FC","mpifort")

pushenv("MPICC","mpicc")

pushenv("MPICXX","mpicxx")

pushenv("MPIFORT","mpifort")

pushenv("INSTALLS","/usr/local/intel-17/openmpi-2_0_1")

whatis("Name: openmpi")

whatis("Version 2.0.1")

whatis("Category: compiler")

whatis("Description: A High Performance Message Passing Library")

whatis("URL: https://www.open-mpi.org")

prepend_path("MODULEPATH","/usr/local/share/modulefiles/MPI/intel/17/openmpi/2.0.1")

prepend_path("PATH","/usr/local/intel-17/openmpi/2.0.1/bin")

prepend_path("CPLUS_INCLUDE_PATH","/usr/local/intel-17/openmpi/2.0.1/include")

prepend_path("C_INCLUDE_PATH","/usr/local/intel-17/openmpi/2.0.1/include")

prepend_path("LD_LIBRARY_PATH","/usr/local/intel-17/openmpi/2.0.1/lib")

prepend_path("LIBRARY_PATH","/usr/local/intel-17/openmpi/2.0.1/lib")

prepend_path("PKG_CONFIG_PATH","/usr/local/intel-17/openmpi/2.0.1/lib/pkgconfig")

Configure, Make, Install

Brief procedure: ./configure --prefix=/home/<CaseID>/<path-to-install-dir>; make;make install

Configure:

By default, the installation directory is /usr/local, So, you NEED TO change the installation path to your home directory by using prefix option "--prefix=/home/CaseID/path-to-install-dir>"

To see more options, type:

./configure --help

Configure with path to installation directory:

./configure  --prefix=/home/<CaseID>/<path-to-install-dir>

If you have option for shared libraries, use --enable-shared to create shared libraries

./configure --enable-shared --prefix=/home/<CaseID>/<path-to-install-dir>

If you have option for slurm, use --with-slurm (check with --help)

./configure --prefix=/home/<CaseID>/<path-to-install-dir> --with-slurm=/usr/local/slurm/14.11.5

Some of them might have GPU and MPI options such as –enable-mpi and –enable-gpu.

If you want to compile using Intel MKL Libraries, see the mkl  module using "module display mkl" for paths. Sample configure command with options for a software that uses intel MKL libraries, OpenMPI, and GPU. it assigns the install directory at HOME directory.

./configure  --prefix=/home/CaseID/path-to-install-dir>  FC=ifort CC=icc LIBS="-L /usr/local/intel/2012/composerxe-2011.3.174/mkl/lib/intel64 –l /mkl_lapack95_lp64.a -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread –lm --with-mpi   CC=mpicc CXX=mpic++ FC=mpif90 –with-mpi-incs=-I/usr/local/openmpi/1.6.3/include  --with-mpi-libs= /usr/local/openmpi/1.6.3/lib --enable-gpu --with-gpu-incs=-I/usr/local/cuda/include --with-gpu-libs=-L/usr/local/cuda/lib64 LIBS=-lcufft -lcudart

To understand the flags, you can also visit Compiling & Linking @HPCC. Intel Compiler Guides and MKL Link Advisor can be valuable for Intel compilers and libraries.

Configuration Error:

See the log file (config.log) in the source directory if you encounter an error and try to fix the error looking at errors. You can also save configure and make output using tee command:

./configure  --prefix=/home/<CaseID>/<path-to-install-dir> | tee <outputfile>

Make:

Makefile gets created at the source directory once the configuration gets through. Now, you can issue make command:

make

Make Install:

To install the binaries and libraries at the location prefixed by configure for the installed software, issue make install command.

make install

CMAKE Installation

Brief procedure: cmake -DCMAKE_INSTALL_PREFIX=/home/<caseID><path-to-install>; make; make install

Cmake is the cross platform build system. Build process is described in a simple text file CMakeLists.txt via special CMake commands. When invoked, CMake parses these text files and generate a native build chain for the desired platform and compiler. It provides options for user to customize the build process.

The options are presented in the form of variables which usually are of the form PACKAGE_<SOME>_<OPTION>  and may contain anything from BOOLEAN to strings. For an example, to enable GROMACS package with MPI option,  use GMX_MPI=ON. 

To change the content of the CMake Cache variable, use –D option after cmake command. To change the location of the install directory from default /usr/local to home directory, use "DCMAKE_INSTALL_PREFIX=/home/<caseID><path-to-install>" and to enable GPU and MPI on GROMACS package, use "-DGMX_GPU=ON –DGMX_MPI=ON"

Configure

Make a build directory and cd to it. The compilers output are stored here which includes both object files as well as final executable and libraries. It also stores several other files including its cache. It is helpful to build with different build options.

mkdir build;cd build

Load the cmake modules:

module load cmake

See the CMake Variable List:

cmake --help-variable-list

output:

CMAKE_INSTALL_PREFIX

CMAKE_LIBRARY_PATH

...

Run cmake command with appropriate options. The options below are for GROMACS package (search for options in CMakeLists.txt file). You can use this template for your package.

cmake .. -DGMX_GPU=ON –DGMX_MPI=ON -DCMAKE_INSTALL_PREFIX=/home/<caseID><path-to-install>

(If you need to assign multiple libraries, you can do it with -D<X_LIBRARIES>='-L <path-to-library> -l<lib1> -l<lib2>')

If you need to select compiler and library options, use ccmake command to generate the native build system. Issue a command from the build directory. 

(Note: If ccmake is not available, you can easily edit CMakeLists.txt file to apply those changes that is possible through ccmake).

ccmake ..

It processes the source directory and prepares the current directory as the build directory. You are presented with UI which lets you edit the content. Use the cursor keys to navigate to any variable you want to change, then press Enter. If the variable is boolean, this will switch its state from ON to OFF or vice versa. Otherwise you can type in the new value of the variable and press Enter again to finish your edit. A short help text to each variable is displayed at the bottom in a status bar. Once you are done, press 'c' to reconfigure the build, then press 'g' to generate the native build system and exit ccmake. If you want to quit without generating, press 'q'. By default, ccmake only displays a part of the available cache variables. Others may be marked as advanced settings and will only be shown to you if you press 't' - this toggles the display of advanced variables.

 To change the generator used by ccmake, you need to pass the same command line argument as with cmake, so read on up above.

To understand the flags, you can also visit Compiling & Linking @HPCC. Intel Compiler Guides and MKL Link Advisor can be valuable for Intel compilers and libraries.

Configuration Error:

If you are installing using CMAKE, the error and output files are CMakeError.log  and Output.log at <build-dir>/CMakeFiles/.  This sample Gadgetron installation guide can be useful in difficult cmake installation.

Make:

Makefile gets created at the source directory once the configuration gets through. Now, you can issue make command:

make

Make Install:

To install the binaries and libraries at the location prefixed by configure for the installed software, issue make install command.

make install

Makefile Installation

Some installation may just have Makefile. So, you need to view the Makefile and make changes to the path of the environment variables properly in accordance with HPC environments. As an example, the entry below should be changed to your home directory as you don't have write permission in /usr/*.

# default installation directory 

INSTALLDIR=/usr/local/bin 

changed to:

# default installation directory 

INSTALLDIR=/home/<CaseID>/<path-to-installation>

Some information on Makefile is also available at Compiling and Linking @ HPC

Make:

make