仓库源文站点原文


layout: post title: VASP.5.2.12编译:Intel Fortran+MPI+MKL categories:


2014-05-19 09:56:26

并行版本VASP编译

准备工作

1 . Fortran编译器, MPI库与MKL库安装好. 若系统使用module, 只须load即可.

module show intel/13.1.0

-------------------------------------------------------------------
/share/apps/modules/Modules/modulefiles/intel/13.1.0:

module-whatis    Intel Compiler 
module-whatis    Version: 13.1.0 
module-whatis    Category: compiler, runtime support 
module-whatis    Description: Intel Compiler Family (C/C++/Fortran for x86_64) 
module-whatis    URL: http://www.intel.com/cd/software/products/asmo-na/eng/compilers/284132.htm 
prepend-path     PATH /share/apps/intel/composer_xe_2013.2.146/bin 
prepend-path     MANPATH /share/apps/intel/composer_xe_2013.2.146/man/en_US 
prepend-path     INCLUDE /share/apps/intel/composer_xe_2013.2.146/mkl/include:/share/apps/intel/composer_xe_2013.2.146/ipp/include 
prepend-path     LD_LIBRARY_PATH /share/apps/intel/composer_xe_2013.2.146/lib/intel64 
prepend-path     LIBRARY_PATH /share/apps/intel/composer_xe_2013.2.146/lib/intel64 
prepend-path     NLS_PATH /share/apps/intel/composer_xe_2013.2.146/lib/intel64/locale/%l_%t/%N 
setenv           COMPILER_TYPE intel 
setenv           COMPILER_VERSION 13.1.0 
setenv           INTEL_LICENSE_FILE 28518@192.168.100.1 
-------------------------------------------------------------------

module show impi/4.1.0

-------------------------------------------------------------------
/share/apps/modules/Modules/modulefiles/impi/4.1.0:

module-whatis    Intel Compiler 
module-whatis    Version: 4.1.0 
module-whatis    Category: compiler, runtime support 
module-whatis    Description: Intel Compiler Family (C/C++/Fortran for x86_64) 
module-whatis    URL: http://www.intel.com/cd/software/products/asmo-na/eng/compilers/284132.htm 
setenv           version 4.1.0 
setenv           Intel_FC_Home /share/apps/intel/impi/4.1.0.030 
prepend-path     PATH /share/apps/intel/impi/4.1.0.030/intel64/bin 
prepend-path     MANPATH /share/apps/intel/impi/4.1.0.030/man 
prepend-path     LD_LIBRARY_PATH /share/apps/intel/impi/4.1.0.030/intel64/lib 
setenv           I_MPI_ROOT /share/apps/intel/impi/4.1.0.030 
setenv           I_MPI_FABRICS shm:tmi 
setenv           TMI_CONFIG /share/apps/intel/impi/4.1.0.030/intel64/etc/tmi.conf 
setenv           INTEL_LICENSE_FILE 28518@192.168.100.1 
-------------------------------------------------------------------

module show mkl/13.1.0

-------------------------------------------------------------------
/share/apps/modules/Modules/modulefiles/mkl/13.1.0:

module-whatis    Intel MKL 
module-whatis    Version: 13.1.0 
module-whatis    Category: compiler, runtime support 
module-whatis    Description: Intel Compiler Family (C/C++/Fortran for x86_64) 
module-whatis    URL: http://www.intel.com/cd/software/products/asmo-na/eng/compilers/284132.htm 
setenv           MKL_ROOT /share/apps/intel/composer_xe_2013.2.146/composer_xe_2013.2.146/mkl 
-------------------------------------------------------------------

2 . 检查编译器, 运行库, 路径无误

which ifort 给出

/share/apps/intel/composer_xe_2013.2.146/bin/ifort

which mpiifort 给出

/share/apps/intel/impi/4.1.0.030/intel64/bin/mpiifort

which mpirun 给出

/share/apps/intel/impi/4.1.0.030/intel64/bin/mpirun

编译

  1. 下载VASP源码, vasp.5.2.12.tar.gzvasp.5.lib.tar.gz

  2. 解压

    tar -xzvf vasp.5.2.12.tar.gz, 得文件夹 vasp.5.2

    tar -xzvf vasp.5.lib.tar.gz, 得文件夹 vasp.5.lib

  3. 编译库文件, 简单, 直接使用makefile.linux_ifc_P4

    将19行FC=ifc改为FC=mpiifort

    make -f makefile.linux_ifc_P4

    libdmy.alinpack_double.o, 即成功

  4. 编译主程序, 复杂, 牵涉到数学库, FFT库, 并行库的选择, 需要修改makefile.linux_ifc_P4.
    原则是尽可能使用Intel自家的东西, 简单且效率好, 故使用MKL及其自带的FFTW, 并行库使用IntelMPI
    编译器选项可在Intel官网查询
    一份修改好的makefile及其简单注释如下

    将其保存为makefile

    make

    vasp即成功, 编译中有警告, 但不致命

<table class="highlighttable"><th colspan="2" style="text-align:left">makefile</th><tr><td><div class="linenodiv" style="background-color: #f0f0f0; padding-right: 10px"><pre style="line-height: 125%"> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233</pre></div></td><td class="code"><div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #008800; font-style: italic"># MKL及其FFTW路径</span> <span style="color: #B8860B">MKLROOT</span><span style="color: #666666">=</span>/share/apps/intel/composer_xe_2013.2.146/composer_xe_2013.2.146/mkl <span style="color: #B8860B">FFTWROOT</span><span style="color: #666666">=</span><span style="color: #BB6688; font-weight: bold">${</span><span style="color: #B8860B">MKLROOT</span><span style="color: #BB6688; font-weight: bold">}</span>/include/fftw

<span style="color: #008800; font-style: italic"># 扩展名</span> <span style="color: #00A000">.SUFFIXES</span><span style="color: #666666">:</span> .inc .f .f90 .F

<span style="color: #008800; font-style: italic"># 预处理扩展名</span> <span style="color: #B8860B">SUFFIX</span><span style="color: #666666">=</span>.f90

<span style="color: #008800; font-style: italic"># MPI Fortran编译器, 链接器, 可使用绝对路径</span> <span style="color: #008800; font-style: italic"># 增加FFTW路径, 以便使用MKL自带的FFTW</span> <span style="color: #B8860B">FC</span><span style="color: #666666">=</span>mpiifort -I<span style="color: #BB6688; font-weight: bold">${</span><span style="color: #B8860B">FFTWROOT</span><span style="color: #BB6688; font-weight: bold">}</span> <span style="color: #B8860B">FCL</span><span style="color: #666666">=</span><span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #008800; font-style: italic"># fpp预处理选项</span> <span style="color: #B8860B">CPP_</span><span style="color: #666666">=</span>fpp -f_com<span style="color: #666666">=</span>no -free -w0 <span style="color: #B8860B">$*</span>.F <span style="color: #B8860B">$*</span><span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #008800; font-style: italic"># 编译选项. 注意</span> <span style="color: #008800; font-style: italic"># 1. 行尾必须有空格, 数目不限</span> <span style="color: #008800; font-style: italic"># 2. byterecl必须使用, 否则WAVECAR文件极大</span> <span style="color: #B8860B">FFLAGS</span> <span style="color: #666666">=</span> -FR -lowercase -assume byterecl

<span style="color: #008800; font-style: italic"># 优化选项</span> <span style="color: #008800; font-style: italic"># 增加 -xHost -axAVX</span> <span style="color: #B8860B">OFLAG</span><span style="color: #666666">=</span>-O2 -ip -ftz -xHost -axAVX

<span style="color: #008800; font-style: italic"># 其他编译选项</span> <span style="color: #B8860B">OFLAG_HIGH</span> <span style="color: #666666">=</span> <span style="color: #AA22FF; font-weight: bold">$(</span>OFLAG<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #B8860B">OBJ_HIGH</span> <span style="color: #666666">=</span> <span style="color: #B8860B">OBJ_NOOPT</span> <span style="color: #666666">=</span> <span style="color: #B8860B">DEBUG</span> <span style="color: #666666">=</span> -FR -O0 <span style="color: #B8860B">INLINE</span> <span style="color: #666666">=</span> <span style="color: #AA22FF; font-weight: bold">$(</span>OFLAG<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #008800; font-style: italic"># MKL, BLAS, LAPACK使用选项</span> <span style="color: #008800; font-style: italic"># 1. CPP选项中必须设置 -DRPROMU_DGEMV -DRACCMU-DGEMV</span> <span style="color: #008800; font-style: italic"># 2. 使用静态库, 速度可能稍快</span> <span style="color: #008800; font-style: italic"># 3. 可参考https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor</span> <span style="color: #B8860B">BLAS</span><span style="color: #666666">=</span><span style="color: #AA22FF; font-weight: bold">$(</span>MKLROOT<span style="color: #AA22FF; font-weight: bold">)</span>/lib/intel64/libmkl_blas95_lp64.a <span style="color: #B8860B">LAPACK</span><span style="color: #666666">=</span><span style="color: #AA22FF; font-weight: bold">$(</span>MKLROOT<span style="color: #AA22FF; font-weight: bold">)</span>/lib/intel64/libmkl_lapack95_lp64.a

<span style="color: #008800; font-style: italic"># 链接选项, 使用静态库</span> <span style="color: #B8860B">LINK</span><span style="color: #666666">=</span>-Wl,--start-group <span style="color: #BB6622; font-weight: bold">\</span> <span style="color: #AA22FF; font-weight: bold">$(</span>MKLROOT<span style="color: #AA22FF; font-weight: bold">)</span>/lib/intel64/libmkl_intel_lp64.a <span style="color: #BB6622; font-weight: bold">\</span> <span style="color: #AA22FF; font-weight: bold">$(</span>MKLROOT<span style="color: #AA22FF; font-weight: bold">)</span>/lib/intel64/libmkl_core.a <span style="color: #BB6622; font-weight: bold">\</span> <span style="color: #AA22FF; font-weight: bold">$(</span>MKLROOT<span style="color: #AA22FF; font-weight: bold">)</span>/lib/intel64/libmkl_intel_thread.a <span style="color: #BB6622; font-weight: bold">\</span> -Wl,--end-group <span style="color: #BB6622; font-weight: bold">\</span> -lpthread -liomp5 -lmpi -lm

<span style="color: #008800; font-style: italic"># CPP并行选项</span> <span style="color: #008800; font-style: italic"># NGZhalf charge density reduced in Z direction</span> <span style="color: #008800; font-style: italic"># wNGZhalf gamma point only reduced in Z direction</span> <span style="color: #008800; font-style: italic"># scaLAPACK use scaLAPACK (usually slower on 100 Mbit Net)</span> <span style="color: #008800; font-style: italic"># avoidalloc avoid ALLOCATE if possible</span> <span style="color: #008800; font-style: italic"># PGF90 work around some for some PGF90 / IFC bugs</span> <span style="color: #008800; font-style: italic"># CACHE-SIZE 1000 for PII,PIII, 5000 for Athlon, 8000-12000 P4, PD</span> <span style="color: #008800; font-style: italic"># RPROMU-DGEMV use DGEMV instead of DGEMM in RPRO (depends on used BLAS)</span> <span style="color: #008800; font-style: italic"># RACCMU-DGEMV use DGEMV instead of DGEMM in RACC (depends on used BLAS)</span> <span style="color: #008800; font-style: italic"># tbdyn MD package of Tomas Bucko</span> <span style="color: #B8860B">CPP</span> <span style="color: #666666">=</span> <span style="color: #AA22FF; font-weight: bold">$(</span>CPP_<span style="color: #AA22FF; font-weight: bold">)</span> -DMPI -DHOST<span style="color: #666666">=</span><span style="color: #BB6622; font-weight: bold">\"</span>LinuxIFC<span style="color: #BB6622; font-weight: bold">\"</span> -DIFC <span style="color: #BB6622; font-weight: bold">\</span> -DCACHE_SIZE<span style="color: #666666">=4000</span> -DPGF90 -Davoidalloc -DNGZhalf <span style="color: #BB6622; font-weight: bold">\</span> -DMPI_BLOCK<span style="color: #666666">=8000</span> <span style="color: #BB6622; font-weight: bold">\</span> -DRPROMU_DGEMV -DRACCMU_DGEMV

<span style="color: #008800; font-style: italic"># MPI库</span> <span style="color: #B8860B">LIB</span> <span style="color: #666666">=</span> -L../vasp.5.lib -ldmy <span style="color: #BB6622; font-weight: bold">\</span> ../vasp.5.lib/linpack_double.o <span style="color: #AA22FF; font-weight: bold">$(</span>LAPACK<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>BLAS<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #008800; font-style: italic"># 使用MKL自带的FFTW</span> <span style="color: #B8860B">FFT3D</span> <span style="color: #666666">=</span> fftmpiw.o fftmpi_map.o fftw3d.o fft3dlib.o <span style="color: #008800; font-style: italic"># 或使用VASP自带的FFTW</span> <span style="color: #008800; font-style: italic">#FFT3D = fftmpi.o fftmpi_map.o fft3dfurth.o fft3dlib.o</span>

<span style="color: #008800; font-style: italic"># 一般规则, 编译命令行, 以下不可修改</span> <span style="color: #B8860B">BASIC</span><span style="color: #666666">=</span> symmetry.o symlib.o lattlib.o random.o

<span style="color: #B8860B">SOURCE</span><span style="color: #666666">=</span> base.o mpi.o smart_allocate.o xml.o <span style="color: #BB6622; font-weight: bold">\</span> constant.o jacobi.o main_mpi.o scala.o <span style="color: #BB6622; font-weight: bold">\</span> asa.o lattice.o poscar.o ini.o mgrid.o xclib.o vdw_nl.o xclib_grad.o <span style="color: #BB6622; font-weight: bold">\</span> radial.o pseudo.o gridq.o ebs.o <span style="color: #BB6622; font-weight: bold">\</span> mkpoints.o wave.o wave_mpi.o wave_high.o <span style="color: #BB6622; font-weight: bold">\</span> <span style="color: #AA22FF; font-weight: bold">$(</span>BASIC<span style="color: #AA22FF; font-weight: bold">)</span> nonl.o nonlr.o nonl_high.o dfast.o choleski2.o <span style="color: #BB6622; font-weight: bold">\</span> mix.o hamil.o xcgrad.o xcspin.o potex1.o potex2.o <span style="color: #BB6622; font-weight: bold">\</span> constrmag.o cl_shift.o relativistic.o LDApU.o <span style="color: #BB6622; font-weight: bold">\</span> paw_base.o metagga.o egrad.o pawsym.o pawfock.o pawlhf.o rhfatm.o paw.o <span style="color: #BB6622; font-weight: bold">\</span> mkpoints_full.o charge.o Lebedev-Laikov.o stockholder.o dipol.o pot.o <span style="color: #BB6622; font-weight: bold">\</span> dos.o elf.o tet.o tetweight.o hamil_rot.o <span style="color: #BB6622; font-weight: bold">\</span> steep.o chain.o dyna.o sphpro.o us.o core_rel.o <span style="color: #BB6622; font-weight: bold">\</span> aedens.o wavpre.o wavpre_noio.o broyden.o <span style="color: #BB6622; font-weight: bold">\</span> dynbr.o rmm-diis.o reader.o writer.o tutor.o xml_writer.o <span style="color: #BB6622; font-weight: bold">\</span> brent.o stufak.o fileio.o opergrid.o stepver.o <span style="color: #BB6622; font-weight: bold">\</span> chgloc.o fast_aug.o fock.o mkpoints_change.o sym_grad.o <span style="color: #BB6622; font-weight: bold">\</span> mymath.o internals.o dynconstr.o dimer_heyden.o dvvtrajectory.o vdwforcefield.o <span style="color: #BB6622; font-weight: bold">\</span> hamil_high.o nmr.o pead.o mlwf.o subrot.o subrot_scf.o <span style="color: #BB6622; font-weight: bold">\</span> force.o pwlhf.o gw_model.o optreal.o davidson.o david_inner.o <span style="color: #BB6622; font-weight: bold">\</span> electron.o rot.o electron_all.o shm.o pardens.o paircorrection.o <span style="color: #BB6622; font-weight: bold">\</span> optics.o constr_cell_relax.o stm.o finite_diff.o elpol.o <span style="color: #BB6622; font-weight: bold">\</span> hamil_lr.o rmm-diis_lr.o subrot_cluster.o subrot_lr.o <span style="color: #BB6622; font-weight: bold">\</span> lr_helper.o hamil_lrf.o elinear_response.o ilinear_response.o <span style="color: #BB6622; font-weight: bold">\</span> linear_optics.o linear_response.o <span style="color: #BB6622; font-weight: bold">\</span> setlocalpp.o wannier.o electron_OEP.o electron_lhf.o twoelectron4o.o <span style="color: #BB6622; font-weight: bold">\</span> ratpol.o screened_2e.o wave_cacher.o chi_base.o wpot.o local_field.o <span style="color: #BB6622; font-weight: bold">\</span> ump2.o bse_te.o bse.o acfdt.o chi.o sydmat.o dmft.o <span style="color: #BB6622; font-weight: bold">\</span> rmm-diis_mlr.o linear_response_NMR.o

<span style="color: #00A000">vasp</span><span style="color: #666666">:</span> <span style="color: #AA22FF; font-weight: bold">$(</span><span style="color: #B8860B">SOURCE</span><span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span><span style="color: #B8860B">FFT</span>3<span style="color: #B8860B">D</span><span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span><span style="color: #B8860B">INC</span><span style="color: #AA22FF; font-weight: bold">)</span> main.o rm -f vasp <span style="color: #AA22FF; font-weight: bold">$(</span>FCL<span style="color: #AA22FF; font-weight: bold">)</span> -o vasp main.o <span style="color: #AA22FF; font-weight: bold">$(</span>SOURCE<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FFT3D<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>LIB<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>LINK<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #00A000">makeparam</span><span style="color: #666666">:</span> <span style="color: #AA22FF; font-weight: bold">$(</span><span style="color: #B8860B">SOURCE</span><span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span><span style="color: #B8860B">FFT</span>3<span style="color: #B8860B">D</span><span style="color: #AA22FF; font-weight: bold">)</span> makeparam.o main.F <span style="color: #AA22FF; font-weight: bold">$(</span><span style="color: #B8860B">INC</span><span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FCL<span style="color: #AA22FF; font-weight: bold">)</span> -o makeparam <span style="color: #AA22FF; font-weight: bold">$(</span>LINK<span style="color: #AA22FF; font-weight: bold">)</span> makeparam.o <span style="color: #AA22FF; font-weight: bold">$(</span>SOURCE<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FFT3D<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>LIB<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #00A000">zgemmtest</span><span style="color: #666666">:</span> zgemmtest.o base.o random.o <span style="color: #AA22FF; font-weight: bold">$(</span><span style="color: #B8860B">INC</span><span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FCL<span style="color: #AA22FF; font-weight: bold">)</span> -o zgemmtest <span style="color: #AA22FF; font-weight: bold">$(</span>LINK<span style="color: #AA22FF; font-weight: bold">)</span> zgemmtest.o random.o base.o <span style="color: #AA22FF; font-weight: bold">$(</span>LIB<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #00A000">dgemmtest</span><span style="color: #666666">:</span> dgemmtest.o base.o random.o <span style="color: #AA22FF; font-weight: bold">$(</span><span style="color: #B8860B">INC</span><span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FCL<span style="color: #AA22FF; font-weight: bold">)</span> -o dgemmtest <span style="color: #AA22FF; font-weight: bold">$(</span>LINK<span style="color: #AA22FF; font-weight: bold">)</span> dgemmtest.o random.o base.o <span style="color: #AA22FF; font-weight: bold">$(</span>LIB<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #00A000">ffttest</span><span style="color: #666666">:</span> base.o smart_allocate.o mpi.o mgrid.o random.o ffttest.o <span style="color: #AA22FF; font-weight: bold">$(</span><span style="color: #B8860B">FFT</span>3<span style="color: #B8860B">D</span><span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span><span style="color: #B8860B">INC</span><span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FCL<span style="color: #AA22FF; font-weight: bold">)</span> -o ffttest <span style="color: #AA22FF; font-weight: bold">$(</span>LINK<span style="color: #AA22FF; font-weight: bold">)</span> ffttest.o mpi.o mgrid.o random.o smart_allocate.o base.o <span style="color: #AA22FF; font-weight: bold">$(</span>FFT3D<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>LIB<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #00A000">kpoints</span><span style="color: #666666">:</span> <span style="color: #AA22FF; font-weight: bold">$(</span><span style="color: #B8860B">SOURCE</span><span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span><span style="color: #B8860B">FFT</span>3<span style="color: #B8860B">D</span><span style="color: #AA22FF; font-weight: bold">)</span> makekpoints.o main.F <span style="color: #AA22FF; font-weight: bold">$(</span><span style="color: #B8860B">INC</span><span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FCL<span style="color: #AA22FF; font-weight: bold">)</span> -o kpoints <span style="color: #AA22FF; font-weight: bold">$(</span>LINK<span style="color: #AA22FF; font-weight: bold">)</span> makekpoints.o <span style="color: #AA22FF; font-weight: bold">$(</span>SOURCE<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FFT3D<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>LIB<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #00A000">clean</span><span style="color: #666666">:</span> -rm -f .g .f .o .L .mod .f90; touch *.F

<span style="color: #00A000">main.o</span><span style="color: #666666">:</span> main<span style="color: #AA22FF; font-weight: bold">$(</span><span style="color: #B8860B">SUFFIX</span><span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FFLAGS<span style="color: #AA22FF; font-weight: bold">)$(</span>DEBUG<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>INCS<span style="color: #AA22FF; font-weight: bold">)</span> -c main<span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #00A000">xcgrad.o</span><span style="color: #666666">:</span> xcgrad<span style="color: #AA22FF; font-weight: bold">$(</span><span style="color: #B8860B">SUFFIX</span><span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FFLAGS<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>INLINE<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>INCS<span style="color: #AA22FF; font-weight: bold">)</span> -c xcgrad<span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #00A000">xcspin.o</span><span style="color: #666666">:</span> xcspin<span style="color: #AA22FF; font-weight: bold">$(</span><span style="color: #B8860B">SUFFIX</span><span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FFLAGS<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>INLINE<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>INCS<span style="color: #AA22FF; font-weight: bold">)</span> -c xcspin<span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #00A000">makeparam.o</span><span style="color: #666666">:</span> makeparam<span style="color: #AA22FF; font-weight: bold">$(</span><span style="color: #B8860B">SUFFIX</span><span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FFLAGS<span style="color: #AA22FF; font-weight: bold">)$(</span>DEBUG<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>INCS<span style="color: #AA22FF; font-weight: bold">)</span> -c makeparam<span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #00A000">makeparam$(SUFFIX)</span><span style="color: #666666">:</span> makeparam.F main.F <span style="color: #008800; font-style: italic">#</span> <span style="color: #008800; font-style: italic"># MIND: I do not have a full dependency list for the include</span> <span style="color: #008800; font-style: italic"># and MODULES: here are only the minimal basic dependencies</span> <span style="color: #008800; font-style: italic"># if one strucuture is changed then touch-dep must be called</span> <span style="color: #008800; font-style: italic"># with the corresponding name of the structure</span> <span style="color: #008800; font-style: italic">#</span> <span style="color: #00A000">base.o</span><span style="color: #666666">:</span> base.inc base.F <span style="color: #00A000">mgrid.o</span><span style="color: #666666">:</span> mgrid.inc mgrid.F <span style="color: #00A000">constant.o</span><span style="color: #666666">:</span> constant.inc constant.F <span style="color: #00A000">lattice.o</span><span style="color: #666666">:</span> lattice.inc lattice.F <span style="color: #00A000">setex.o</span><span style="color: #666666">:</span> setexm.inc setex.F <span style="color: #00A000">pseudo.o</span><span style="color: #666666">:</span> pseudo.inc pseudo.F <span style="color: #00A000">poscar.o</span><span style="color: #666666">:</span> poscar.inc poscar.F <span style="color: #00A000">mkpoints.o</span><span style="color: #666666">:</span> mkpoints.inc mkpoints.F <span style="color: #00A000">wave.o</span><span style="color: #666666">:</span> wave.F <span style="color: #00A000">nonl.o</span><span style="color: #666666">:</span> nonl.inc nonl.F <span style="color: #00A000">nonlr.o</span><span style="color: #666666">:</span> nonlr.inc nonlr.F

<span style="color: #00A000">$(OBJ_HIGH)</span><span style="color: #666666">:</span> <span style="color: #AA22FF; font-weight: bold">$(</span>CPP<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FFLAGS<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>OFLAG_HIGH<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>INCS<span style="color: #AA22FF; font-weight: bold">)</span> -c <span style="color: #B8860B">$*</span><span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #00A000">$(OBJ_NOOPT)</span><span style="color: #666666">:</span> <span style="color: #AA22FF; font-weight: bold">$(</span>CPP<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FFLAGS<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>INCS<span style="color: #AA22FF; font-weight: bold">)</span> -c <span style="color: #B8860B">$*</span><span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #00A000">fft3dlib_f77.o</span><span style="color: #666666">:</span> fft3dlib_f77.F <span style="color: #AA22FF; font-weight: bold">$(</span>CPP<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>F77<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FFLAGS_F77<span style="color: #AA22FF; font-weight: bold">)</span> -c <span style="color: #B8860B">$*</span><span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #00A000">.F.o</span><span style="color: #666666">:</span> <span style="color: #AA22FF; font-weight: bold">$(</span>CPP<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FFLAGS<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>OFLAG<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>INCS<span style="color: #AA22FF; font-weight: bold">)</span> -c <span style="color: #B8860B">$*</span><span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #00A000">.F$(SUFFIX)</span><span style="color: #666666">:</span> <span style="color: #AA22FF; font-weight: bold">$(</span>CPP<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #00A000">$(SUFFIX).o</span><span style="color: #666666">:</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FFLAGS<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>OFLAG<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>INCS<span style="color: #AA22FF; font-weight: bold">)</span> -c <span style="color: #B8860B">$*</span><span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #008800; font-style: italic"># special rules</span> <span style="color: #008800; font-style: italic">#-----------------------------------------------------------------------</span> <span style="color: #008800; font-style: italic"># these special rules are cummulative (that is once failed</span> <span style="color: #008800; font-style: italic"># in one compiler version, stays in the list forever)</span> <span style="color: #008800; font-style: italic"># -tpp5|6|7 P, PII-PIII, PIV</span> <span style="color: #008800; font-style: italic"># -xW use SIMD (does not pay of on PII, since fft3d uses double prec)</span> <span style="color: #008800; font-style: italic"># all other options do no affect the code performance since -O1 is used</span>

<span style="color: #00A000">fft3dlib.o </span><span style="color: #666666">:</span> fft3dlib.F <span style="color: #AA22FF; font-weight: bold">$(</span>CPP<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span> -FR -lowercase -O2 -c <span style="color: #B8860B">$*</span><span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #00A000">fft3dfurth.o </span><span style="color: #666666">:</span> fft3dfurth.F <span style="color: #AA22FF; font-weight: bold">$(</span>CPP<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span> -FR -lowercase -O1 -c <span style="color: #B8860B">$*</span><span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #00A000">fftw3d.o </span><span style="color: #666666">:</span> fftw3d.F <span style="color: #AA22FF; font-weight: bold">$(</span>CPP<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span> -FR -lowercase -O1 -c <span style="color: #B8860B">$*</span><span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #00A000">wave_high.o </span><span style="color: #666666">:</span> wave_high.F <span style="color: #AA22FF; font-weight: bold">$(</span>CPP<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span> -FR -lowercase -O1 -c <span style="color: #B8860B">$*</span><span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #00A000">radial.o </span><span style="color: #666666">:</span> radial.F <span style="color: #AA22FF; font-weight: bold">$(</span>CPP<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span> -FR -lowercase -O1 -c <span style="color: #B8860B">$*</span><span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #00A000">symlib.o </span><span style="color: #666666">:</span> symlib.F <span style="color: #AA22FF; font-weight: bold">$(</span>CPP<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span> -FR -lowercase -O1 -c <span style="color: #B8860B">$*</span><span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #00A000">symmetry.o </span><span style="color: #666666">:</span> symmetry.F <span style="color: #AA22FF; font-weight: bold">$(</span>CPP<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span> -FR -lowercase -O1 -c <span style="color: #B8860B">$*</span><span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #00A000">wave_mpi.o </span><span style="color: #666666">:</span> wave_mpi.F <span style="color: #AA22FF; font-weight: bold">$(</span>CPP<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span> -FR -lowercase -O1 -c <span style="color: #B8860B">$*</span><span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #00A000">wave.o </span><span style="color: #666666">:</span> wave.F <span style="color: #AA22FF; font-weight: bold">$(</span>CPP<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span> -FR -lowercase -O1 -c <span style="color: #B8860B">$*</span><span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #00A000">dynbr.o </span><span style="color: #666666">:</span> dynbr.F <span style="color: #AA22FF; font-weight: bold">$(</span>CPP<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span> -FR -lowercase -O1 -c <span style="color: #B8860B">$*</span><span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #00A000">asa.o </span><span style="color: #666666">:</span> asa.F <span style="color: #AA22FF; font-weight: bold">$(</span>CPP<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span> -FR -lowercase -O1 -c <span style="color: #B8860B">$*</span><span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #00A000">broyden.o </span><span style="color: #666666">:</span> broyden.F <span style="color: #AA22FF; font-weight: bold">$(</span>CPP<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span> -FR -lowercase -O2 -c <span style="color: #B8860B">$*</span><span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #00A000">us.o </span><span style="color: #666666">:</span> us.F <span style="color: #AA22FF; font-weight: bold">$(</span>CPP<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span> -FR -lowercase -O1 -c <span style="color: #B8860B">$*</span><span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span>

<span style="color: #00A000">LDApU.o </span><span style="color: #666666">:</span> LDApU.F <span style="color: #AA22FF; font-weight: bold">$(</span>CPP<span style="color: #AA22FF; font-weight: bold">)</span> <span style="color: #AA22FF; font-weight: bold">$(</span>FC<span style="color: #AA22FF; font-weight: bold">)</span> -FR -lowercase -O2 -c <span style="color: #B8860B">$*</span><span style="color: #AA22FF; font-weight: bold">$(</span>SUFFIX<span style="color: #AA22FF; font-weight: bold">)</span> </pre></div> </td></tr></table>

运行测试

利用VASP自带的bench.Hg.tar.gz进行测试

1 . 解压 tar -xzvf bench.Hg.tar.gz

2 . 复制INCAR, KPOINTS, POSCAR, POTCAR四个文件到vasp.5.2文件夹下

3 . 单核运行 ./vasp, 耗时45.221s, 屏幕输出

running on    1 nodes
distr:  one band on    1 nodes,    1 groups
vasp.5.2.12 11Nov11 complex
......
entering main loop
       N       E                     dE             d eps       ncg     rms          rms(c)
RMM:   1    -0.514507058760E+05   -0.51451E+05   -0.13177E+05   316   0.780E+02
RMM:   2    -0.527604338595E+05   -0.13097E+04   -0.23675E+04   316   0.234E+02
RMM:   3    -0.529743353776E+05   -0.21390E+03   -0.41254E+03   316   0.116E+02
RMM:   4    -0.531145169975E+05   -0.14018E+03   -0.15769E+03   316   0.784E+01
RMM:   5    -0.531789029672E+05   -0.64386E+02   -0.67142E+02   316   0.452E+01
RMM:   6    -0.532264453365E+05   -0.47542E+02   -0.47991E+02   720   0.309E+01
RMM:   7    -0.532330334403E+05   -0.65881E+01   -0.94371E+01   762   0.919E+00    0.871E+00
RMM:   8    -0.532322794427E+05    0.75400E+00   -0.37182E+01   697   0.816E+00    0.265E+00
RMM:   9    -0.532327283030E+05   -0.44886E+00   -0.88476E+00   702   0.383E+00    0.129E+00
RMM:  10    -0.532327148448E+05    0.13458E-01   -0.69686E-01   695   0.120E+00    0.550E-01
RMM:  11    -0.532327089541E+05    0.58908E-02   -0.18550E-01   693   0.501E-01    0.247E-01
RMM:  12    -0.532327075118E+05    0.14423E-02   -0.34613E-02   691   0.226E-01    0.756E-02
RMM:  13    -0.532327075990E+05   -0.87187E-04   -0.65477E-03   688   0.823E-02
   1 F= -.53232708E+05 E0= -.53232710E+05  d E =0.749678E-02

4 . 多核并行 mpirun -np 12 ./vasp, 耗时7.931s, 屏幕输出

running on   12 nodes
distr:  one band on    3 nodes,    4 groups
vasp.5.2.12 11Nov11 complex
......
entering main loop
       N       E                     dE             d eps       ncg     rms          rms(c)
RMM:   1    -0.514507058760E+05   -0.51451E+05   -0.13177E+05   316   0.780E+02
RMM:   2    -0.527604338595E+05   -0.13097E+04   -0.23675E+04   316   0.234E+02
RMM:   3    -0.529743353776E+05   -0.21390E+03   -0.41254E+03   316   0.116E+02
RMM:   4    -0.531145169975E+05   -0.14018E+03   -0.15769E+03   316   0.784E+01
RMM:   5    -0.531789029672E+05   -0.64386E+02   -0.67142E+02   316   0.452E+01
RMM:   6    -0.532264453365E+05   -0.47542E+02   -0.47991E+02   720   0.309E+01
RMM:   7    -0.532330334403E+05   -0.65881E+01   -0.94371E+01   762   0.919E+00    0.871E+00
RMM:   8    -0.532322794427E+05    0.75400E+00   -0.37182E+01   697   0.816E+00    0.265E+00
RMM:   9    -0.532327283030E+05   -0.44886E+00   -0.88476E+00   702   0.383E+00    0.129E+00
RMM:  10    -0.532327148448E+05    0.13458E-01   -0.69686E-01   695   0.120E+00    0.550E-01
RMM:  11    -0.532327089541E+05    0.58908E-02   -0.18550E-01   693   0.501E-01    0.247E-01
RMM:  12    -0.532327075118E+05    0.14423E-02   -0.34613E-02   691   0.226E-01    0.756E-02
RMM:  13    -0.532327075990E+05   -0.87187E-04   -0.65477E-03   688   0.823E-02
   1 F= -.53232708E+05 E0= -.53232710E+05  d E =0.749678E-02

多核与单核结果一致, 说明并行无误

5 . 将OSZICAROSZICAR.ref, OUTCAROUTCAR.ref做比较, 所得结果有所不同, 原因在于OSZICAR.refOUTCAR.ref所用版本为vasp.4.4.4 10Jan99

说明

  1. Windows下面的编译, 原则方法相同, 但需要注意的地方更多, 暂不推荐
  2. 只计算gamma点的版本编译时, 在cpp中打开-DwNGZhalf即可

评论