Openmpi安装
./configure --prefix=/home/chengxl/sourcecode/openmpi-gnu CC=gcc CXX=g++ F77=gfortran FC=gfortran
对于intel ./configure --prefix=/usr/local/openmpi-1.4.3 CC=icc CXX=icpc F77=ifort FC=ifort
2. make all 3. make install4.打开 ~/.bashrc 添加环境变量 export PATH=/usr/local/openmpi-1.4.3/bin:$PATH export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/openmpi-1.4.3/lib5. source ~/.bashrc(重新打开终) 并验证 which mpiccwhich mpic++ which mpif77 which mpif90
fftw3安装
./configure --prefix=$HOME/usr --enable-mpi --enable-shared=yesmake install
安装lapack
下载:http://www.netlib.org/lapack
Cd BLAS/Src
make
cp make.example.inc make.inc
并修改以下几行:
BLASLIB = /your/path/to/lapack-3.4.2/librefblas.a#将要创建一个librefblas.a
LAPACKLIB = liblapack.a
TMGLIB = libtmglib.a
LAPACKELIB = liblapacke.a
Make
如果测试通不过,在终端中输入以下命令:
ulimit -s 65000
安装BLACS
http://www.netlib.org/blacs下载MPIBLACS
在BMAKES文件夹中拷出Bmake.MPI-LINUX Bmake.inc
参见:How do I build BLACS with Open MPI http://www.open-mpi.org/faq/?category=mpi-apps
修改Bmake.inc
# Section 1:
# Ensure to use MPI for the communication layer
COMMLIB = MPI
# The MPIINCdir macro is used to link in mpif.h and
# must contain the location of Open MPI's mpif.h.
# The MPILIBdir and MPILIB macros are irrelevant
# and should be left empty.
MPIdir = /path/to/openmpi-1.6.5
MPILIBdir =
MPIINCdir = $(MPIdir)/include
MPILIB =
# Section 2:
# Set these values:
SYSINC =
INTFACE = -Df77IsF2C
SENDIS =
BUFF =
TRANSCOMM = -DUseMpi2
WHATMPI =
SYSERRORS =
# Section 3:
# You may need to specify the full path to
# mpif77 / mpicc if they aren't already in
# your path.
F77 = mpif77
F77LOADFLAGS =
CC = mpicc
CCLOADFLAGS =
Make mpi
安装scalapack
修改SLmake.inc
参见:http://www.open-mpi.org/faq/?category=mpi-apps
# Make sure you follow the instructions to build BLACS with Open MPI,
# and put its location in the following.
BLACSdir =
# The MPI section is commented out. Uncomment it. The wrapper
# compiler will handle SMPLIB, so make it blank. The rest are correct
# as is.
USEMPI = -DUsingMpiBlacs
SMPLIB =
BLACSFINIT = $(BLACSdir)/blacsF77init_MPI-$(PLAT)-$(BLACSDBGLVL).a
BLACSCINIT = $(BLACSdir)/blacsCinit_MPI-$(PLAT)-$(BLACSDBGLVL).a
BLACSLIB = $(BLACSdir)/blacs_MPI-$(PLAT)-$(BLACSDBGLVL).a
TESTINGdir = $(home)/TESTING
# The PVMBLACS setup needs to be commented out.
#USEMPI =
#SMPLIB = $(PVM_ROOT)/lib/$(PLAT)/libpvm3.a -lnsl -lsocket
#BLACSFINIT =
#BLACSCINIT =
#BLACSLIB = $(BLACSdir)/blacs_PVM-$(PLAT)-$(BLACSDBGLVL).a
#TESTINGdir = $(HOME)/pvm3/bin/$(PLAT)
# Make sure that the BLASLIB points to the right place. We built this
# example on Solaris, hence the name below. The Linux version of the
# library (as of this writing) is blas_LINUX.a.
BLASLIB = $(LAPACKdir)/blas_solaris.a
# You may need to specify the full path to mpif77 / mpicc if they
# aren't already in your path.
我改的:
BLACSdir = /path to/BLACS/LIB
BLASLIB = -L/path to/lapack-3.4.2 -lrefblas
LAPACKLIB = -L/path to/lapack-3.4.2 -llapack
LIBS = $(LAPACKLIB) $(BLASLIB)
USEMPI = -DUsingMpiBlacs
SMPLIB =
BLACSFINIT = $(BLACSdir)/blacsF77init_MPI-LINUX-0.a
BLACSCINIT = $(BLACSdir)/blacsCinit_MPI-LINUX-0.a
BLACSLIB = $(BLACSdir)/blacs_MPI-LINUX-0.a
#TESTINGdir = $(home)/TESTING
Then type : make
NetCDF编译
cd netcdf-fortran
Cd netcdf-4-*两都安装一致
sudo apt install libnetcdf-dev libnetcdff-dev
./configure --disable-dap --disable-netcdf-4 --prefix=/usr/local/netcdf FC=gfortran
./configure --prefix=/usr/local/netcdf FC=gfortran
make
make install
编译siesta
将Src/MPI中全部拷到 Obj/MPI中,make
在Obj文件夹中执行:
sh ../Src/obj_setup.sh
../Src/configure--enable-mpi(详见--help)
修改arch.make, 我的:
FC=mpif90
FPPFLAGS= -DFC_HAVE_FLUSH -DFC_HAVE_ABORT -DMPI
BLAS_LIBS= -L/path/lapack-3.4.2/ -lrefblas
LAPACK_LIBS= -L/path/lapack-3.4.2/ -llapack -ltmglib
BLACS_LIBS= -L/path/BLACS/LIB/blacs_MPI-LINUX-0.a
SCALAPACK_LIBS= -L/path/scalapack-2.0.2/ -lscalapack
COMP_LIBS= dc_lapack.a linalg.a
MPI_INTERFACE=libmpi_f90.a
MPI_INCLUDE=/home/feng/scisoft/openmpi-gnu/include
测试:
mpirun -np siesta < input.fdf > output
编译CPMD
FFLAGS = -O2 -I/home/leno/scisoft/openmpi-gnu/include -I/home/leno/scisoft/fftw/include -I${SRCDIR} -I${OBJDIR}
#LFLAGS = -L/usr/lib64/atlas/ -llapack -lblas -lfftw
LFLAGS = -L/home/leno/scisoft/lapack -llapack -lrefblas \
-L/home/leno/scisoft/fftw/lib -lfftw3
make
共享库出错:
forrtl: error (78): process killed (SIGTERM)Image PC Routine Line Source mca_pml_ob1.so 00002AE5777DF87E Unknown Unknown Unknownlibmpi.so.1 00002AE571B9E616 Unknown Unknown Unknownlibmpi.so.1 00002AE571ACBE24 Unknown Unknown Unknownmca_coll_tuned.so 00002AE579539EE9 Unknown Unknown Unknownmca_coll_tuned.so 00002AE579535B7C Unknown Unknown Unknownlibmpi.so.1 00002AE571AD9931 Unknown Unknown Unknownlibmpi_f77.so.1 00002AE5718539F4 Unknown Unknown Unknownpvasp533 00000000004899E7 Unknown Unknown Unknown------------------------------------------从上面的错误结果可以看出,有些共享库找不到。一般来说,并行程序(如vasp)的编译是在主节点上进行的,而运行是在各个计算节点进行的。有些人(尤其是某些公司)在安装机群时,将软件都装在主节点上,通过网络共享(nfs)的方式发布到各计算节点上。不过也有些是在各计算节点上全部装一遍。无论是哪一种情况,你需要去查找在各计算节点上是否能找到共享库。你用下面的命令查看一下目前已指定的共享位置都有哪些:echo $LD_LIBRARY_PATH然后看你那些需要共享的库文件所在的目录是否出现在上面命令的结果中。例如看第一个错误的情况:locate mca_pml_ob1.somca_pml_ob1.so文件可能在/mpi/lib/openmpi中,可你的共享库路径中只有/mpi/lib,显然计算节点是无法找到这个共享文件的,所以你得手工加上。方法是,将下面语句加到你主目录下的.bashrc(或者.bash_profile)文件中去:export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/mpi/lib/openmpi重复以上步骤,直到将所有出现错误的共享库文件都能正确地被计算机搜索到。
Atlas安装
If throttling is enabled, the only way to get a decent ATLAS install is therefore to turn it off. Most machines can switch it off in the BIOS, but on machines with newer Linux kernels even this does not stop pstate throttling. To tell linux not to ignore your bios settings you must log in as root/sudo, and issue something similar to:
[if !supportLists]1. [endif]Edit /etc/default/grub
[if !supportLists]2. [endif]Find line with: GRUB_CMDLINE_LINUX_DEFAULT
[if !supportLists]3. [endif]Append the following to args: intel_pstate=disable
[if !supportLists]4. [endif]Update grub: update-grub
[if !supportLists]5. [endif]Reboot
For modern Linuxes, you can turn off throttling using cpufreq-set. Some systems allow you to set the speed of individual cores, and others force groups of cores to run at same speed. Therefore, on a 4-core system, your frequency settings may not take hold until you've set all 4-cores to the desired setting. For instance:
/usr/bin/cpufreq-set -g performance -c 0
/usr/bin/cpufreq-set -g performance -c 1
/usr/bin/cpufreq-set -g performance -c 2
/usr/bin/cpufreq-set -g performance -c 3
Mkdir obj
../configure
Make
检查可执行文件的依赖库:
env | grep BLASenv | grep USEldd $NWCHEM_TOP/bin/LINUX64/nwchemhead -24 $NWCHEM_TOP/src/tools/build/config.log
http://math-atlas.sourceforge.net/errata.html#LINK
How do I link with all these libraries?
The user libs created by ATLAS are:
liblapack.a
The serial LAPACK routines provided by ATLAS.
libcblas.a
The ANSI C interface to the BLAS.
libf77blas.a
The Fortran77 interface to the BLAS.
libptlapack.a
The threaded (parallel) LAPACK routines provided by ATLAS.
libptcblas.a
The ANSI C interface to the threaded (SMP) BLAS. This library only appears if you have asked for SMP support.
libptf77blas.a
The Fortran77 interface to the threaded (SMP) BLAS. This library only appears if you have asked for SMP support.
libatlas.a
The main ATLAS library, providing low-level routines for all interface libs.
If you have missing symbols on link, make sure you are linking in all of the libraries you need, and remember that order *is* significant. For instance, a code calling the Fortran77 interface to the BLAS would need:
-L$(MY_BLDdir)/lib/ -lf77blas -latlas
The full LAPACK library created by merging ATLAS and netlib LAPACK requires both C and Fortran77 interfaces, and thus that serial link line would be:
-L$(MY_BLDdir)/lib/ -llapack -lf77blas -lcblas -latlas
While the threaded LAPACK link would be:
-L$(MY_BLDdir)/lib/ -lptlapack -lptf77blas -lptcblas -latlas
Where $(MY_BLDdir) should be replaced by the directory where you have built your ATLAS.