14 Eylül 2012 Cuma

CPMD with Netlib's lapack, blas and your own fftw3 on ROCKS 5.4.3/CentOS 5.6

To contact us Click HERE
Pretty much like how it's done on Debian (-march=native didn't work in the BLAS compilation though, nor was -fno-whole-file accepted when compiling cpmd)

1. Compile cmake according to this post:
http://verahill.blogspot.com.au/2012/05/compiling-openbabel-231-and-cmake-on.html

2. Compile BLAS
sudo mkdir /share/apps/tools/netlib/blas/lib -p
sudo chown $USER /share/apps/tools/netlib -R

Edit make.inc
OPTS     = -O3 -shared -m64 -fPIC

make all

gfortran -shared -Wl,-soname,libnetblas.so -o libblas.so.1.0.1 *.o -lc
ln -s libblas.so.1.0.1 libnetblas.so
cp lib*blas* /share/apps/tools/netlib/blas/lib

3. Compile LAPACK
sudo mkdir /share/apps/tools/netlib/lapack -p
sudo chown $USER /share/apps/tools/netlib -R
wget http://www.netlib.org/lapack/lapack-3.4.1.tgz
tar xvf lapack-3.4.1.tgz
cd lapack-3.4.1/
mkdir build
cd build
ccmake ../

Hit 'c' and edit the values:

 BUILD_COMPLEX                    ON BUILD_COMPLEX16                  ON BUILD_DOUBLE                     ON BUILD_SHARED_LIBS                ON BUILD_SINGLE                     ON BUILD_STATIC_LIBS                ON BUILD_TESTING                    ON CMAKE_BUILD_TYPE                     CMAKE_INSTALL_PREFIX             /share/apps/tools/netlib/lapack LAPACKE                          OFF LAPACKE_WITH_TMG                 OFF USE_OPTIMIZED_BLAS               ON USE_XBLAS                        OFF

Hit 'c' again, then hit 'g'.

Edit CMakeCache.txt and add the following lines at the beginning:

######################### EXTERNAL cache entries########################BLAS_FOUND:STRING=TRUEBLAS_GENERIC_FOUND:BOOL=TRUEBLAS_GENERIC_blas_LIBRARY:FILEPATH=/share/apps/tools/netlib/blas/lib/libnetblas.soBLAS_LIBRARIES:PATH=/share/apps/tools/netlib/blas/lib/libnetblas.so

Do
ccmake ../
again, hit 'c', then 'g'.

Now,
make
make install

4. Compile FFTW3
sudo mkdir /share/apps/tools/fftw3sudo chown $USER /share/apps/tools/fftw3cd ~/tmpwget http://www.fftw.org/fftw-3.3.1.tar.gztar -xvf fftw-3.3.1.tar.gzcd fftw-3.3.1make distclean./configure --enable-float --enable-mpi --enable-threads --with-pic --prefix=/share/apps/tools/fftw3/singlemakemake installmake distclean./configure --disable-float --enable-mpi --enable-threads --with-pic --prefix=/share/apps/tools/fftw3/doublemake make install

5. Compile CPMD
I downloaded the cpmd file to a client computer, then uploaded it to the ROCKS front node:
sftp me@rocks:/home/me/tmp
Connected to rocks.Changing to: /home/me/tmpsftp> put cpmd-v3_15_3.tar.gzUploading cpmd-v3_15_3.tar.gz to /home/me/tmp/cpmd-v3_15_3.tar.gzcpmd-v3_15_3.tar.gz                100% 2937KB 587.4KB/s   00:05sftp> exit

I then logged in via ssh as normal.
cd ~/tmptar xvf cpmd-v3_15_3.tar.gzcd CPMD/CONFIGURE
Create a new file LINUX-x86_64-ROCKS

     IRAT=2     CFLAGS='-c -O2 -Wall'     CPP='/lib/cpp -P -C -traditional'     CPPFLAGS='-D__Linux -D__PGI -D__GNU -DFFT_FFTW3 -DPARALLEL -DPOINTER8'     FFLAGS='-c -O2 -fcray-pointer -fsecond-underscore'LFLAGS='-L/share/apps/tools/fftw3/double/lib -lfftw3-lfftw3_mpi -lfftw3_threads -I/usr/include -L/share/apps/tools/netlib/blas/lib -lnetblas -L/share/apps/tools/netlib/lapack/lib -llapack -L/opt/openmpi/lib -lpthread -lmpi'     FFLAGS_GROMOS='  $(FFLAGS)'       FC='mpif77 -fbounds-check'      CC='mpicc'      LD='mpif77 -fbounds-check'

NOTE: I don't think the -I belongs in the LFLAGS statement, but I'm presuming that I put it there for a reason back when I did it the first time.

Go to ~/tmp/CPMD, and edit wfnio.F (basically replace 3 with 2 and remove 'L'):

 15       CHARACTER(len=*) TAG 63         IF(TAG(1:2).EQ.'NI') THEN201       IF(TAG(1:2).NE.'NI') THEN271         IF(TAG(1:2).EQ.'NI') THEN

Finally, edit Makefile and change
  23 LD = f95 -O
to
  23 LD = mpif77 -fbounds-check

Time to compile
./mkconfig.sh LINUX-x86_64-ROCKS > Makefilemakesudo mkdir /share/apps/cpmdsudo chown $USER /share/apps/cpmdcp cpmd.x /share/apps/cpmd
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/share/apps/tools/netlib/blas/lib:/share/apps/tools/netlib/lapack/lib:/share/apps/tools/fftw3/double/lib' >>~/.bashrcecho 'export PATH=$PATH:/share/apps/cpmd' >> ~/.bashrcecho "export PP_LIBRARY_PATH=/share/apps/cpmd/PP_LIBRARY" >>~/.bashrc

You're now done compiling.To test, you need to get some pseudopotential files -- look at e.g. the end of http://verahill.blogspot.com.au/2012/07/not-solved-compiling-cpmd-on-debian.html for instructions.


Hiç yorum yok:

Yorum Gönder