close


大部分转自 http://simulation.5d6d.net/thread-24147-1-1.html,部分来自同学,偷艺。。。




1.
首先确认要安装机器的配置和操作系统,我的是这样的


lsb_release
–a 
查看系统详细信息:


LSB
Version:

:core-3.0-ia32:core-3.0-noarch:graphics-3.0-ia32:graphics-3.0-noarch



Distributor
ID: RedHatEnterpriseAS



Description:

Red Hat Enterprise Linux AS release 4 (Nahant Update
4)



Release:

4



Codename:

NahantUpdate4



cat /proc/cpuinfo | grep name | cut -f2
-d: | uniq –c
查看CPU配置


4
Intel(R) Xeon(TM) CPU
3.40GHz




下载
或寻找对应版本的
Intel
编译器,IntelMKL数据库,如果要并行还需要下载并行软件MPICH2或其他MPI软件包


我的是32
位的操作系统,intelcpu,我下载了如下两个编译器:


l_fc_p_10.1.008_ia32.tar.gz l_cc_p_10.1.008_ia32.tar.gz



mkl
数据库为:l_mkl_p_10.0.011.tgz


2.
Intel
编译器和mkl的安装


查看各个安装软件的压缩包中的install.txt





从中找到Perform the
following steps to install the
compiler. 
按步骤安装





注意r我的serial numbe是以文件的形式存在,直接指定路径即可:/…/ licenses/*.lic





打开.bashrc 设置环境变量





export
PATH=/…/intel/fc/10.1.018/bin:$PATH





export
PATH=/…/intel/cc/10.1.008/bin:$PATH





export cc=icc





export fc=ifort





source
/…/fc/10.1.018/bin/ifortvars.sh





source
/…/intel/idb/10.1.018/bin/idbvars.sh





source
/…/intel/cc/10.1.008/bin/iccvars.sh





source
/…/intel/idb/10.1.008/bin/idbvars.sh





source
/…/intel/mkl/10.0.011/tools/environment/mklvars32.sh





 





source 一下.bashrc文件





which
ifort
which icc





查看路径是否一致。





 





3.
CPMD
串行的安装


具体的安装过程已有人总结过,我在这里注意提一下我的Makefile的设置,我选用的是PC-IFC平台,



./mkcofin.sh
PC-IFC >Makefile



make
clean



make



根据make提示的信息修改



首先删除MakefileFFLAGS表示中无法识别的如w95tpp6等信息(FFlags是设置ifort编译参数)



其次在LFLAGS中建立mkl数据库的链接,这一块要看mkl的说明书,参看/…/intel/mkl/10.0.011/lib 目录中的 *.a
*.os 
文件 查看和串行相关的参数设置



Mkl的说明书中
有Detailed directory
structure


lib/32 Contains all
libraries for IA-32 architecture

Static Libraries

Interface layer

libmkl_intel.a 
     Interface
library for Intel® compiler

libmkl_gf.a    
     Interface
library for GNU Fortran compiler


Threading
layer

libmkl_intel_thread.a 
   Parallel
drivers library supporting Intel compiler

libmkl_gnu_thread.a 
   Parallel
drivers library supporting GNU compiler

libmkl_sequential.a 
     Sequential
drivers library

Computational layer

libmkl_core.a 
  
  
  
   Kernel
library for IA-32 architecture

libmkl_ia32.a 
  
  
  
   Dummy
library. Contains references to Intel MKL libraries

libmkl_lapack.a 
  
     Dummy
library. Contains references to Intel MKL libraries

libmkl_solver.a 
  
     Sparse
Solver, Interval Solver, and GMP routines

libmkl_solver_sequential.a 
  
    Sequential
version of Sparse Solver, Interval Solver, and GMP

routines library

libmkl_scalapack.a 
  
  
     Dummy
library. Contains references to Intel MKL libraries

libmkl_scalapack_core.a   
ScaLAPACK routines

libmkl_cdft.a Dummy library. 
  
     Contains
references to Intel MKL libraries

libmkl_cdft_core.a 
  
  
  
  
  
  
    Cluster
version of FFTs

RTL layer

libguide.a    
  
  
  
  
    
Intel® Legacy OpenMP* run-time library for static
linking

libiomp5.a    
  
  
  
  
  
 Intel® Compatibility OpenMP*
run-time library for static

linking libmkl_blacs.a BLACS routines supporting the following
MPICH versions:

• Topspin* MPICH version 1.2.5 configured with ch_vapi

device

• Myricom* MPICH version 1.2.5.10

• ANL* MPICH version 1.2.5.2

libmkl_blacs_intelmpi.a 
  
    BLACS
routines supporting Intel MPI 1.0


libmkl_blacs_intelmpi20.a   
BLACS routines supporting Intel MPI 2.0 and 3.0, and
MPICH2.0

libmkl_blacs_openmpi.a 
   BLACS
routines supporting OpenMPI. 

  

具体每个mkl版本这部分说明可能有所不同

















根据这部分说明





我的设置如下:



FFLAGS = -c
-O3



LFLAGS =
-L/…/intel/mkl/10.0.011/lib/32 -lmkl_intel -lmkl_sequential
-lmkl_core -lmkl_ia32 -lmkl_lapack -lmkl_solver_sequential
-lmkl_scalapack -lmkl_cdft -lguide -lbiomp5 -lpthread
–static



CFLAGS = -c
-O2 -Wall



CPP = /lib/cpp
-P -C -traditional



CPPFLAGS =
-D__Linux -D__PGI -DFFT_DEFAULT -DLINUX_IFC



NOOPT_FLAG
=



CC =
icc



FC =
ifort



LD =
ifort



AR =
ar



修改后再次make 看有没有问题 一般undefined均为库参数指代不对或不恰当或多余的原因。再次make
clean
make





4.
CPMD
并行的安装


我选用的是PC-IFC-MPI平台,



首先安装mpich2并行软件



安装成功后,设置环境变量(.bashrc)



export
PATH=/home/myanping/mpich2-install/bin/:$PATH



export
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/myanping/mpich2-install/lib/



source一下.bashrc文件





./mkcofin.sh
PC-IFC-MPI >Makefile



make
clean



make



根据make提示的信息修改删除MakefileFFLAGS表示中无法识别的如w95tpp6等信息(FFlags是设置ifort编译参数的)



LFLAGS中不仅要建立适合并行的mkl数据库的链接,还有建立mpi库的链接



我的设置如下:



FFLAGS = -c
-O3



LFLAGS =
-L/home/myanping/intel/mkl/10.0.011/lib/32 -lmkl_intel
-lmkl_intel_thread -lmkl_core -lmkl_ia32 -lmkl_lapack -lmkl_solver
-lmkl_scalapack -lmkl_cdft -lguide -lbiomp5 -lmkl_blacs
-lmkl_blacs_intelmpi -lpthread -static -Vaxlib \
-L/home/myanping/mpich2-install/lib -lfmpich
-lmpich



CFLAGS = -c
-O2 -Wall



CPP = /lib/cpp
-P -C -traditional



CPPFLAGS = -D__Linux -D__PGI -DFFT_DEFAULT
\





-DPARALLEL -DMYRINET -DLINUX_IFC



NOOPT_FLAG =



CC =
mpicc



FC =
mpif77



LD =
mpif77



AR =
ar



make
clean



make



编译成功。













最关键的步骤修改 Makefiel中的”Default
Configuration for PC-IFC”

这是其中各个部分代表的意思

FFLAGS Fortran flags

LFLAGS Link editor flags

CFLAGS C compiler flags

CPP Preprocessor program

CPPFLAGS CPP flags

FC Fortran compiler

LD Link editor

AR Archive library maintainer

RANLIB Converts archives to random libraries

SRC Source files directory (default=.)

DEST Object files directory (default=.)

Use to write irat.inc in the right directory

BIN Use to put the cpmd.x executable
(default=.)
(只是个人意见)主要修改的部分LFLAGS,需要详细的看你的MKL文件/opt/intel/mkl/10.2.5.035/lib中有哪些东西,根据不同版本的MKL内容修改,这里我借鉴了myanping在分子模拟论坛中MKL列表(网址1

Detailed directory structure

lib/32 Contains all libraries for IA-32 architecture

Static Libraries

Interface layer

libmkl_intel.a Interface library for Intel®
compiler

libmkl_gf.a Interface library for GNU Fortran compiler

Threading layer

libmkl_intel_thread.a Parallel drivers library supporting Intel
compiler

libmkl_gnu_thread.a Parallel drivers library supporting GNU
compiler

libmkl_sequential.a Sequential drivers library

Computational layer

libmkl_core.a Kernel library for IA-32 architecture

libmkl_ia32.a Dummy library. Contains references to Intel MKL
libraries

libmkl_lapack.a Dummy library. Contains references to Intel MKL
libraries

libmkl_solver.a Sparse Solver, Interval Solver, and GMP
routines

libmkl_solver_sequential.a Sequential version of Sparse Solver,
Interval Solver, and GMP

routines library

libmkl_scalapack.a Dummy library. Contains references to Intel MKL
libraries

libmkl_scalapack_core.a ScaLAPACK routines

libmkl_cdft.a Dummy library. Contains references to Intel MKL
libraries

libmkl_cdft_core.a Cluster version of FFTs

RTL layer

libguide.a Intel® Legacy OpenMP* run-time library
for static linking

libiomp5.a Intel® Compatibility OpenMP* run-time
library for static

linking libmkl_blacs.a BLACS routines supporting the following
MPICH versions:

• Topspin* MPICH version 1.2.5 configured with ch_vapi

device

• Myricom* MPICH version 1.2.5.10

• ANL* MPICH version 1.2.5.2

libmkl_blacs_intelmpi.a BLACS routines supporting Intel MPI
1.0

libmkl_blacs_intelmpi20.a BLACS routines supporting Intel MPI 2.0
and 3.0, and MPICH2.0

libmkl_blacs_openmpi.a BLACS routines supporting
OpenMPI.
具体每个mkl版本这部分说明可能有所不同。
又去掉了FFLAGS中的一些无法识别的如w95tpp6等信息,在CPPFLAGS中添加了-DINTEL_MKL,在LD添加了-i-static,最终版本

#————— Default Configuration for PC-IFC —————

SRC = .

DEST = .

BIN = .

FFLAGS = -c -O3

LFLAGS = -L/opt/intel/mkl/10.2.5.035/lib/32 -lmkl_intel
-lmkl_blas95 -lmkl_blacs -lmkl_lapack -lmkl_sequential -lmkl_core
-lmkl_solver_sequential -lguide -liomp5 -lpthread -lmkl_solver
-lmkl_vml_ia

CFLAGS = -c -O2 -Wall

CPP = /lib/cpp -P -C -traditional

CPPFLAGS = -D__Linux -D__PGI -DFFT_DEFAULT -DLINUX_IFC
-DINTEL_MKL

NOOPT_FLAG =

CC = gcc

FC = ifort

LD = ifort -i-static

AR = ar

#—————————————————————————-

# Personal Configuration

#—————————————————————————-

#—————————————————————————-

# End of Personal Configuration

#—————————————————————————-

CFGDEST = .

CFGMACH = PC-IFC






arrow
arrow
    全站熱搜
    創作者介紹
    創作者 lsx121924 的頭像
    lsx121924

    lsx121924的部落格

    lsx121924 發表在 痞客邦 留言(0) 人氣()