#! /bin/bash ######################################################################################################################### ## Name of this file. fn must be in the same name as this file, without the .ii.txt suffix. fn=qe-6.1 ######################################################################################################################### ######################################################################################################################### ## A. Initialisation ######################################################################################################################### dir=$HOME/ii export dir=$dir ## mkdir ## if [ ! -d $dir ];then mkdir $dir else echo $dir existed. Not making one. fi if [ ! -d $dir/script ];then mkdir $dir/script else echo $dir/script existed. Not making one. fi if [ ! -d $dir/include ];then mkdir $dir/include else echo $dir/include existed. Not making one. fi if [ ! -d $dir/lib ];then mkdir $dir/lib else echo $dir/lib existed. Not making one. fi if [ ! -d $dir/configrepo ];then mkdir $dir/configrepo else echo $dir/configrepo existed. Not making one. fi if [ ! -d $dir/bin ];then mkdir $dir/bin else echo $dir/bin existed. Not making one. fi rm -rf $dir/script/$fn.lib rm -rf $dir/script/"$fn"var.txt rm -rf $dir/script/"$fn".log echo 'export LD_LIBRARY_PATH='$dir/lib':$LD_LIBRARY_PATH' >> $dir/script/"$fn"var.txt echo 'export PATH='$dir/bin':$PATH' >> $dir/script/"$fn"var.txt echo ' ' ######################################################################################################################### ## End of A. Initialisation ######################################################################################################################### ######################################################################################################################### ## B. Check system prerequisites ######################################################################################################################### declare -a ps=(make gcc g++ gfortran) for i in ${ps[@]}; do str=$(which $i) if [ ! "$str" ];then echo $i NOT found. Please install $i manually as root or sudo, then retry running this script. >> $dir/script/$fn.log else echo $i found. >> $dir/script/$fn.log fi done if grep -q 'NOT' "$dir/script/$fn.log"; then echo 'System prerequisites NOT met. To abort.' >> $dir/script/$fn.log cat $dir/script/$fn.log exit else echo 'System prerequisites met. To continue.' >> $dir/script/$fn.log # cat $dir/script/$fn.log fi echo ' ' ######################################################################################################################### ## End of B. Check system prerequisites ######################################################################################################################### ######################################################################################################################### ## C. Check and install prerequisite libraries if not existed ######################################################################################################################### ## &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ## ## 1. openmpi-2.1.1 #### libname2install=openmpi-2.1.1 libfile2check=libmpi.so #### checklib=$dir/$libname2install/lib/$libfile2check echo $checklib >> $dir/script/$fn.lib if [ -f $checklib ];then echo $checklib found. Not to install them. else echo $checklib NOT found. To install them. echo To install $checklib >> $dir/script/$fn.log cd $dir/configrepo rm -rf $libname2install.tgz wget http://comsics.usm.my/tlyoon/configrepo/howto/customise_centos/openmpi/openmpi-2.1.1.tgz tar -zxvf $libname2install.tgz cd $libname2install ./configure --prefix=$dir/$libname2install --disable-dlopen make make install fi echo 'export LD_LIBRARY_PATH='$dir/$libname2install/lib':$LD_LIBRARY_PATH' >> $dir/script/"$fn"var.txt echo 'export PATH='$dir/$libname2install/bin':$PATH' >> $dir/script/"$fn"var.txt source $dir/script/"$fn"var.txt ## &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ## ## &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ## ## 2. fftw-3.3.6 #### libname2install=fftw-3.3.6 libfile2check=libfftw3.a #### checklib=$dir/$libname2install/lib/$libfile2check echo $checklib >> $dir/script/$fn.lib if [ -f $checklib ];then echo $checklib found. Not to install them. else echo $checklib NOT found. To install them. echo To install $checklib >> $dir/script/$fn.log cd $dir/configrepo rm -rf $libname2install.tgz wget http://comsics.usm.my/tlyoon/configrepo/howto/customise_centos/fftw/fftw-3.3.6.tgz tar -zxvf fftw-3.3.6.tgz cd fftw-3.3.6-pl2 ./configure --prefix=$dir/$libname2install --with-g77-wrappers --enable-mpi --enable-threads --enable-openmp CC="cc" FC="mpif90" make -j 4 make install # make check # optional #make installcheck # optional fi echo 'export LD_LIBRARY_PATH='$dir/$libname2install/lib':$LD_LIBRARY_PATH' >> $dir/script/"$fn"var.txt echo 'export PATH='$dir/$libname2install/bin':$PATH' >> $dir/script/"$fn"var.txt source $dir/script/"$fn"var.txt ## &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ## ## &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ## ## 3. blas-3.7.0 #### libname2install=blas-3.7.0 libfile2check=libblas.a #### checklib=$dir/lib/$libfile2check echo $checklib >> $dir/script/$fn.lib if [ -f $checklib ];then echo $checklib found. Not to install them. else echo $checklib NOT found. To install them. echo To install $checklib >> $dir/script/$fn.log cd $dir/configrepo rm -rf $libname2install.tgz wget http://www.netlib.org/blas/blas-3.7.0.tgz tar -xzvf $libname2install.tgz cd BLAS-3.7.0 gfortran -c -O3 *.f ar rv libblas.a *.o cp $dir/configrepo/BLAS-3.7.0/libblas.a $dir/lib/ fi source $dir/script/"$fn"var.txt ## &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ## ## &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ## ## 4. lapack-3.7.0 #### libname2install=lapack-3.7.0 libfile2check=liblapack.a #### checklib=$dir/lib/$libfile2check echo $checklib >> $dir/script/$fn.lib if [ -f $checklib ];then echo $checklib found. Not to install them. else echo $checklib NOT found. To install them. echo To install $checklib >> $dir/script/$fn.log cd $dir/configrepo rm -rf $libname2install.tgz wget http://comsics.usm.my/tlyoon/configrepo/howto/customise_centos/BLAS_and_LAPACK/lapack-3.7.0.tgz tar -xzvf $libname2install.tgz cd $libname2install which g77 || sed -i -e 's/g77/gfortran/' make.inc ulimit -s unlimited make tmglib blaslib cblaslib lapack_install lapacklib -j 4 #make lapack_testing ## optional ## cd TESTING; make ### execute this line if want to perform testing on the lapack library installed. cp $dir/configrepo/lapack-3.7.0/*.a $dir/lib/ fi source $dir/script/"$fn"var.txt ## &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ## ## &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ## ## 5. python-2.7.13 #### libname2install=python-2.7.13 libfile2check=libpython2.7.a #### checklib=$dir/$libname2install/lib/$libfile2check echo $checklib >> $dir/script/$fn.lib if [ -f $checklib ];then echo $checklib found. Not to install them. else echo $checklib NOT found. To install them. echo To install $checklib >> $dir/script/$fn.log cd $dir/configrepo rm -rf Python-2.7.13.tgz wget http://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz tar -zxvf Python-2.7.13.tgz find $dir/configrepo -type d | xargs chmod 0755 cd Python-2.7.13 ./configure --prefix=$dir/python-2.7.13 make make install fi echo 'export LD_LIBRARY_PATH='$dir/$libname2install/lib':$LD_LIBRARY_PATH' >> $dir/script/"$fn"var.txt echo 'export PATH='$dir/$libname2install/bin':$PATH' >> $dir/script/"$fn"var.txt source $dir/script/"$fn"var.txt ## &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ## ######################################################################################################################### ## End of C. Check and install prerequisite libraries if not existed ######################################################################################################################### ######################################################################################################################### #### D. Determine whether any 'NOT' keyword appears in $dir/script/$fn.log ########## ######################################################################################################################### ## echo $dir/ii/lib/gnuplot.a >> $dir/script/$fn.lib ## for trouble shooting for i in $(cat $dir/script/$fn.lib) do if [ -f $i ]; then echo $i found >> $dir/script/$fn.log else echo $i NOT found >> $dir/script/$fn.log fi done echo ' ' ######################################################################################################################### #### D. Determine whether any 'NOT' keyword appears in $dir/script/$fn.log ########## ######################################################################################################################### ######################################################################################################################### ## E. Install $fn ######################################################################################################################### if grep -q 'NOT' "$dir/script/$fn.log"; then echo 'NOT all prerequisite libraries are found for' $fn. To abort installation. >> $dir/script/$fn.log cat $dir/script/$fn.log exit else echo 'All prerequisite libraries are found for' $fn. To continue installation. >> $dir/script/$fn.log # &&&&&&&&&&& Add a line of 'source '$dir/script/"$fn"var.txt in $HOME/.bashrc for $USER &&&&&&&&&&&&&& # if grep -q 'source '$dir/script/"$fn"var.txt "$HOME/.bashrc"; then echo 'source '$dir/script/"$fn"var.txt already added to $HOME/.bashrc >> $dir/script/$fn.log echo 'source '$dir/script/"$fn"var.txt already added to $HOME/.bashrc else echo source $dir/script/"$fn"var.txt has not been added to $HOME/.bashrc. To add it now. >> $dir/script/$fn.log echo source $dir/script/"$fn"var.txt has not been added to $HOME/.bashrc. To add it now. echo '## Line added by ii ' >> $HOME/.bashrc echo 'source '$dir/script/"$fn"var.txt >> $HOME/.bashrc fi # &&&&&&&&&&& end of Add a line of 'source '$dir/script/"$fn"var.txt in $HOME/.bashrc for $USER &&&&&&&&&&&&&& # #****************** begin installation of fn **************************************************************************** ## requires libgtk-3-dev ## sudo apt-get install libgtk-3-dev cd $dir/configrepo if [ -f "$fn".tgz ];then filesize=$(ls -la "$fn".tgz | awk '{print $5}') if [ $filesize == 186159207 ]; then #### provide the original file size of $fn.tgz echo "$fn".tgz is present and file size tallies in $dir/configrepo. Proceed without downloading. >> $dir/script/$fn.log cat $dir/script/$fn.log else echo "$fn".tgz is present but file size fails to tally in $dir/configrepo. Proceed with downloading. >> $dir/script/$fn.log cat $dir/script/$fn.log rm -rf "$fn".tgz wget http://comsics.usm.my/tlyoon/configrepo/howto/customise_centos/qe/qe-6.1.tgz fi else echo "$fn".tgz is absent in $dir/configrepo. Proceed with downloading. >> $dir/script/$fn.log cat $dir/script/$fn.log rm -rf "$fn".tgz wget http://comsics.usm.my/tlyoon/configrepo/howto/customise_centos/qe/qe-6.1.tgz fi cd $dir/configrepo rm -rf "$fn" tar -zxvf "$fn".tgz cd "$fn" pwd=$(echo $PWD) ./configure --prefix=$HOME/ii/$fn F90="gfortran" CC="$HOME/ii/openmpi-2.1.1/bin/mpicc" IFLAGS="-I$HOME/ii/fftw-3.3.6/include -I$HOME/ii/configrepo/qe-6.1/include -I../include" # -I$HOME/ii/configrepo/qe-6.1/include #-I../include/ # ./configure --prefix=$HOME/ii/$fn F77="$HOME/ii/openmpi-2.1.1/bin/mpif77" MPIF90="$HOME/ii/openmpi-2.1.1/bin/mpif90" --enable-openmp=yes #--enable-parallel=yes FFT_LIBS="-L$HOME/ii/fftw-3.3.6 -lfftw3" MPI_LIBS="-L$HOME/ii/openmpi-2.1.1/lib -lmpi" #IFLAGS="-I$HOME/ii/fftw-3.3.6/include -I$HOME/ii/openmpi-2.1.1/include -I$HOME/ii/configrepo/qe-6.1/include #-I$HOME/ii/configrepo/qe-6.1/install" LAPACK_LIBS="-L$HOME/ii/lib -llapack" BLAS_LIBS="-L$HOME/ii/lib -lblas" #CC="$HOME/ii/openmpi-2.1.1/bin/mpicc" # F90="$HOME/ii/openmpi-2.1.1/bin/mpif90" make -j 4 pw > $dir/script/make_pw.log make -j 4 ph > $dir/script/make_ph.log make -j 4 pwcond > $dir/script/make_pwcond.log make -j 4 neb > $dir/script/make_neb.log make -j 4 pp > $dir/script/make_pp.log ## make -j 4 pwall > $dir/script/make_pwall.log ## make pwall={pw,ph,pwcond,neb,pp} make -j 4 cp > $dir/script/make_cp.log make -j 4 tddfpt > $dir/script/make_tddfpt.log make -j 4 gwl > $dir/script/make_gwl.log; cd GWW; make -j 4 > $dir/script/make_gwl.log; cd ../ make -j 4 ld1 > $dir/script/make_ld1.log make -j 4 upf > $dir/script/make_upf.log # make -j 4 all > $dir/script/make_all.log ## same as "make pwall cp ld1 upf tddfpt" make -j 4 xspectra > $dir/script/make_xspectra.log make -j 4 couple > $dir/script/make_couple.log tar -zxvf archive/wannier90-2.1.0.tar.gz make -j 4 epw > $dir/script/make_epw.log ## make -j 4 w90 > $dir/script/make_w90.log ### do not need to make w90 as it will be made along with epw export F90="gfortran"; make -j 4 yambo; cd yambo-stable; make clean; ./configure; make -j 4 all; cd ../; make -j 4 yambo; cd yambo-stable; make -j 4 all > $dir/script/make_yambo.log; cd ../ make -j 4 gipaw > $dir/script/make_gipaw.log; cd qe-gipaw-6.1; ./configure; make > $dir/script/make_gipaw.log; cd ../ make -j 4 west > $dir/script/make_west.log make -j 4 want > $dir/script/make_want.log; cd WANT; ./configure; make all > $dir/script/make_want.log; cd ../ ## /want/src/tools/decay.x failed to compile, but the rest are OK. ## repeat for gipaw, yambo, want to ensure they are installed properly make -j 4 gipaw > $dir/script/make_gipaw.log; cd qe-gipaw-6.1; ./configure; make > $dir/script/make_gipaw.log; cd ../ make -j 4 want > $dir/script/make_want.log; cd WANT; ./configure; make all > $dir/script/make_want.log; cd ../ ## /want/src/tools/decay.x failed to compile, but the rest are OK. ## export F90="gfortran"; cd yambo-stable; ./configure; make -j 4 all > $dir/script/make_yambo.log; cd ../ ## end of repeat for gipaw, yambo, want to ensure they are installed properly make gui > $dir/script/make_gui.log make examples > $dir/script/make_examples.log make doc > $dir/script/make_doc.log make links > $dir/script/make_link.log ### kept until the last # cd yambo-stable; make clean; ./configure; cd ../; export F90="gfortran"; make yambo; cd yambo-stable; make -j 4 all > $dir/script/make_yambo.log make links > $dir/script/make_link.log ### kept until the last ## NOT TO INSTALL yambo-devel ## export F90="gfortran"; make -j 4 yambo-devel > $dir/script/make_yambo-devel.log ## fail to install ## cd yambo-devel; ./configure; make -j 4 all >> $dir/script/make_yambo-devel.log ## cd ../ ## NOT TO INSTALL d3q. It fails due to d3matrix_io.f90. # make -j 4 d3q > $dir/script/make_d3q.log; cd d3q-1.1-qe6.1; make -j 4 > $dir/script/make_d3q.log ### partially installed; partially failed. ## NOT TO INSTALL plumed. It spoils subsequent installations. ## make -j 4 plumed > $dir/script/make_plumed.log ### Failed miserably make install # echo 'hello' # make install if [ -f $dir/$fn/bin/sax2qexml.x ];then rm -rf $dir/bin/*.x ln -s $dir/$fn/bin/* $dir/bin/ echo $dir/$fn/bin/sax2qexml.x found. intstant installation for $fn completed. >> $dir/script/$fn.log else echo $dir/$fn/bin/sax2qexml.x not found. intstant installation for $fn failed. >> $dir/script/$fn.log fi #****************** end installation of fn **************************************************************************** fi ######################################################################################################################### ## end of E. Install fn ######################################################################################################################### ######################################################################################################################### ## F. Stress test fn (optional) cd $dir/configrepo if [ -f qe-6.1-test-suite.tar.gz ];then filesize=$(ls -la qe-6.1-test-suite.tar.gz | awk '{print $5}') if [ $filesize == 17094641 ]; then #### provide the original file size of qe-6.1-test-suite.tar.gz echo qe-6.1-test-suite.tar.gz is present and file size tallies in $dir/configrepo/$fn. Proceed without downloading. >> $dir/script/$fn.log cat $dir/script/$fn.log else echo qe-6.1-test-suite.tar.gz is present but file size fails to tally in $dir/configrepo/$fn. Proceed with downloading. >> $dir/script/$fn.log cat $dir/script/$fn.log rm -rf qe-6.1-test-suite.tar.gz wget http://qe-forge.org/gf/download/frsrelease/240/1073/qe-6.1-test-suite.tar.gz fi else echo qe-6.1-test-suite.tar.gz is absent in $dir/configrepo/$fn. Proceed with downloading. >> $dir/script/$fn.log cat $dir/script/$fn.log wget http://qe-forge.org/gf/download/frsrelease/240/1073/qe-6.1-test-suite.tar.gz fi cd $dir/configrepo/$fn tar -zxvf ../qe-6.1-test-suite.tar.gz ## make test-suite > test-suite.log ### optional #### cd test-suite # make run-tests-parallel ##optional ######################################################################################################################### cat $dir/script/$fn.log