I somehow had forgot to include some of the instructions for the BLAS part. Fixed now.
Post:
This is done 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
mkdir ~/tmp cd ~/tmp wget http://www.netlib.org/blas/blas.tgz tar xvf blas.tgz cd BLAS/
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=TRUE BLAS_GENERIC_FOUND:BOOL=TRUE BLAS_GENERIC_blas_LIBRARY:FILEPATH=/share/apps/tools/netlib/blas/lib/libnetblas.so BLAS_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/fftw3 sudo chown $USER /share/apps/tools/fftw3 cd ~/tmp wget http://www.fftw.org/fftw-3.3.1.tar.gz tar -xvf fftw-3.3.1.tar.gz cd fftw-3.3.1 make distclean ./configure --enable-float --enable-mpi --enable-threads --with-pic --prefix=/share/apps/tools/fftw3/single make make install make distclean ./configure --disable-float --enable-mpi --enable-threads --with-pic --prefix=/share/apps/tools/fftw3/double make 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/tmp sftp> put cpmd-v3_15_3.tar.gz Uploading cpmd-v3_15_3.tar.gz to /home/me/tmp/cpmd-v3_15_3.tar.gz cpmd-v3_15_3.tar.gz 100% 2937KB 587.4KB/s 00:05 sftp> exit
I then logged in via ssh as normal.
cd ~/tmp tar xvf cpmd-v3_15_3.tar.gz cd CPMD/CONFIGURECreate 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') THEN 201 IF(TAG(1:2).NE.'NI') THEN 271 IF(TAG(1:2).EQ.'NI') THEN
Finally, edit Makefile and change
23 LD = f95 -Oto
23 LD = mpif77 -fbounds-check
Time to compile
./mkconfig.sh LINUX-x86_64-ROCKS > Makefile make sudo mkdir /share/apps/cpmd sudo chown $USER /share/apps/cpmd cp 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' >>~/.bashrc echo 'export PATH=$PATH:/share/apps/cpmd' >> ~/.bashrc echo "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.