UWGeodynamics icon indicating copy to clipboard operation
UWGeodynamics copied to clipboard

What commands does the shell script have in UWGeodynamics_2.9.10.sh?

Open Peigen-L opened this issue 5 years ago • 10 comments

Hi, I am using Underworld2/UWGeodynamics on Gadi, and I have a problem at the installation stage.

In the 12th line of script.pbs:

source /scratch/q97/codes/UWGeodynamics_2.9.10.sh

What commands does the shell script have in UWGeodynamics_2.9.10.sh

Peigen-L avatar Dec 09 '20 06:12 Peigen-L

Hi Luo, are you a member of q97?

PatriceFRey avatar Dec 09 '20 21:12 PatriceFRey

Hi Luo, are you a member of q97? Hi Patrice, I am a member of jq14. I installed UW under my group but don’t know how to use it.

Peigen-L avatar Dec 09 '20 22:12 Peigen-L

Then you should replace "source /scratch/q97/codes/UWGeodynamics_2.9.10.sh" by something like "source /scratch/jq14/codes/UWGeodynamics_2.9.10.sh". Cheers Patrice

PatriceFRey avatar Dec 10 '20 00:12 PatriceFRey

Hi Patrice,

Thank you for your help.

I tried as you said, source /g/data/jq14/lp5029/codes/UWGeodynamics_2.9.6.sh this is my installation path of Underworld and the machine recalled a bash error as: bash: /g/data/jq14/lp5029/codes/UWGeodynamics_2.9.6.sh: No such file or directory Please help

Kind regards Peigen

Peigen-L avatar Dec 10 '20 01:12 Peigen-L

Then UWGeodynamics_2.9.6.sh is not where it is supposed to be. May be it is into another folder than "codes".

PatriceFRey avatar Dec 10 '20 03:12 PatriceFRey

Hi Patrice, Thank you for your help. The people from NCI helped me to install UWGeodynamics_2.9.6 in path /g/data/jq14/lp5029/codes/UWGeodynamics_2.9.6 They told me that UWGeodynamics_2.9.6.sh should be a shell script file which I should create ahead before I load the PBS commands. The problem is I can't find UWGeodynamics_2.9.6.sh in any folder I have. (I double checked about this) Will this UWGeodynamics_2.9.6.sh file be created at once finishing installation?(which means we have something wrong during our installation process) Or I should write one by myself? (have no idea about what commands it will contain)

Please help and kind regards

Peigen

Peigen-L avatar Dec 10 '20 04:12 Peigen-L

First check if the shell script in not here: /g/data/jq14/lp5029/codes/UWGeodynamics_2.9.6/UWGeodynamics_2.9.6.sh.

If it is not there, then use the script below (courtesy of Julian Giodani) and put it in /g/data/jq14/lp5029/codes/

Then follow the instruction at the top of the script.

Cheers

#===================== #!/bin/bash

usage=" Usage: A script to install and run an Underworld software stack.

** To install ** Review script details: modules, paths, repository urls / branches etc. $ source <this_script_name> $ install_full_stack see script for details, running $ install_petsc maybe required.

** To run ** Add the line source /path/UWGeodynamics_2.10.sh to your pbs file, make sure to include the absolute path. "

while getopts ':h' option; do case "$option" in h) echo "$usage" # safe script exit for sourced script (return 0 2>/dev/null) && return 0 || exit 0 ;; ?) # incorrect options echo "Error: Incorrect options" echo "$usage" (return 0 2>/dev/null) && return 0 || exit 0 ;; esac done

module purge module load openmpi/4.0.2 hdf5/1.10.5p python3/3.7.4 scons/3.1.1 #petsc/3.12.2

export GROUP=jq14 export USER= export INSTALL_NAME=UWGeodynamics_2.10

export CODES_PATH=/scratch/$GROUP/$USER/Underworld export UW_OPT_DIR=$CODES_PATH/opt export INSTALL_PATH=$CODES_PATH/$INSTALL_NAME

export OMPI_MCA_io=ompio export LD_PRELOAD=/apps/openmpi-mofed4.7-pbs19.2/4.0.2/lib/libmpi_usempif08_GNU.so.40:/apps/openmpi-mofed4.7-pbs19.2/4.0.2/lib/libmpi_usempi_ignore_tkr_GNU.so.40:/apps/openmpi-mofed4.7-pbs19.2/4.0.2/lib/libmpi_cxx.so.40

All above environment variables are require for the runtime environment

Our practice is to add this script to gadi so users can source this file

with the specific envrionment configuration

export CDIR=$PWD export SWIG_VERSION=3.0.12 export SWIG_PATH=$UW_OPT_DIR/swig-$SWIG_VERSION export PATH=$SWIG_PATH/bin:$PATH

install_swig() { tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX) cd $tmp_dir wget http://prdownloads.sourceforge.net/swig/swig-$SWIG_VERSION.tar.gz tar -xvzf swig-$SWIG_VERSION.tar.gz cd swig-$SWIG_VERSION ./configure --prefix=$SWIG_PATH make make install rm $tmp_dir cd $CDIR }

install_petsc(){ source $INSTALL_PATH/bin/activate export PETSC_CONFIGURE_OPTIONS="--with-debugging=0
--COPTFLAGS='-O3' --CXXOPTFLAGS='-O3' --FOPTFLAGS='-O3'
--with-zlib=1
--with-hdf5=1
--download-mumps=1
--download-parmetis=1
--download-metis=1
--download-superlu=1
--download-hypre=1
--download-scalapack=1
--download-superlu_dist=1
--useThreads=0
--download-superlu=1
--with-shared-libraries
--with-cxx-dialect=C++11
--prefix=$UW_OPT_DIR/petsc-3.12.3
--with-make-np=4"

   CC=mpicc CXX=mpicxx FC=mpif90 pip install petsc==3.12.3 -vvv

}

install_python_dependencies(){ source $INSTALL_PATH/bin/activate pip3 install --upgrade pip pip3 install Cython numpy==1.18.4 scipy==1.4.1 LV_OSMESA=1 pip3 install --no-binary :all: lavavu==1.4.14 pip3 install mpi4py export HDF5_VERSION=1.10.5 CC=h5pcc HDF5_MPI="ON" pip3 install --no-cache-dir --global-option=build_ext --global-option="-L/apps/hdf5/1.10.5p/lib/ompi3/" --no-binary=h5py h5py==2.10.0

}

install_underworld(){ export PETSC_DIR=$UW_OPT_DIR/petsc-3.12.3 source $INSTALL_PATH/bin/activate pip install underworld==2.10.1b0

    # tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX)
    # cd $tmp_dir
    # git clone -b v2.10.0b https://github.com/underworldcode/underworld2.git $tmp_dir
    # pip3 install .
    # rm -rf $tmp_dir       
    # cd $CDIR

}

install_uwgeodynamics(){ source $INSTALL_PATH/bin/activate pip install uwgeodynamics==2.10.2

    # tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX)
    # cd $tmp_dir
    # git clone -b v2.10.0 https://github.com/underworldcode/uwgeodynamics.git $tmp_dir
    # pip3 install .
    # rm -rf $tmp_dir       
    # cd $CDIR

}

check_underworld_exists(){ source $INSTALL_PATH/bin/activate return $(python3 -c "import underworld") }

check_uwgeodynamics_exists(){ source $INSTALL_PATH/bin/activate return $(python3 -c "import UWGeodynamics") }

check_badlands_exists(){ source $INSTALL_PATH/bin/activate return $(python3 -c "import badlands") }

install_badlands(){ source $INSTALL_PATH/bin/activate pip3 install badlands==2.2.0 }

install_full_stack(){ if ! command -v swig 2>/dev/null; then install_swig else echo "Found swig" fi

install_python_dependencies

if ! check_underworld_exists; then
      install_underworld
fi

if ! check_uwgeodynamics_exists; then
      install_uwgeodynamics
fi

if ! check_badlands_exists; then
      install_badlands
fi

cp $(basename $BASH_SOURCE) $INSTALL_PATH.sh

}

if [ ! -d "$INSTALL_PATH" ] then echo "Environment not found, creating a new one" mkdir -p $INSTALL_PATH python3 --version python3 -m venv $INSTALL_PATH else echo "Found Environment" source $INSTALL_PATH/bin/activate fi #==============

PatriceFRey avatar Dec 10 '20 04:12 PatriceFRey

#!/bin/bash

module purge
module load openmpi/4.0.2 hdf5/1.10.5p python3/3.7.4 scons/3.1.1 petsc/3.12.2

export GROUP=jq14
export USER=lp5029
export INSTALL_NAME=UWGeodynamics_2.9.6

#export CODES_PATH=/scratch/$GROUP/$USER/codes
export CODES_PATH=/g/data/$GROUP/$USER/codes
export UW_OPT_DIR=$CODES_PATH/opt
export INSTALL_PATH=$CODES_PATH/$INSTALL_NAME

export SWIG_VERSION=3.0.12
export SWIG_PATH=$UW_OPT_DIR/swig-$SWIG_VERSION
export PATH=$SWIG_PATH/bin:$PATH

export OMPI_MCA_io=ompio

export CDIR=$PWD
export LD_PRELOAD=/apps/openmpi-mofed4.7-pbs19.2/4.0.2/lib/libmpi_usempif08_GNU.so.40:/apps/openmpi-mofed4.7-pbs19.2/4.0.2/lib/libmpi_usempi_ignore_tkr_GNU.so.40:/apps/openmpi-mofed4.7-pbs19.2/4.0.2/lib/libmpi_cxx.so.40

install_swig() {
	tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX)
	cd $tmp_dir
	wget http://prdownloads.sourceforge.net/swig/swig-$SWIG_VERSION.tar.gz
	tar -xvzf swig-$SWIG_VERSION.tar.gz
	cd swig-$SWIG_VERSION
	./configure --prefix=$SWIG_PATH
	make
	make install
	rm $tmp_dir
	cd $CDIR
}


install_petsc(){
	source $INSTALL_PATH/bin/activate
        export PETSC_CONFIGURE_OPTIONS="--with-debugging=0 --prefix=/usr/local \
                --COPTFLAGS='-O3' --CXXOPTFLAGS='-O3' --FOPTFLAGS='-O3' \
                --with-zlib=1                   \
                --with-hdf5=1                   \
                --download-mumps=1              \
                --download-parmetis=1           \
                --download-metis=1              \
                --download-superlu=1            \
                --download-hypre=1              \
                --download-scalapack=1          \
                --download-superlu_dist=1       \
                --useThreads=0                  \
                --download-superlu=1            \
                --with-shared-libraries         \
                --with-cxx-dialect=C++11        \
		--prefix=/scratch/q97/codes/opt/petsc_3.12.3\
                --with-make-np=4"

       CC=mpicc CXX=mpicxx FC=mpif90 pip install petsc==3.12.3 -vvv
}

install_python_dependencies(){
	source $INSTALL_PATH/bin/activate
	pip3 install Cython
	pip3 install mpi4py
        export HDF5_VERSION=1.10.5
        CC=h5pcc HDF5_MPI="ON" pip3 install --no-cache-dir --global-option=build_ext --global-option="-L/apps/hdf5/1.10.5p/lib/ompi3/" --no-binary=h5py h5py

}

install_underworld(){
	export PETSC_DIR=/scratch/q97/codes/opt/petsc_3.12.3
	source $INSTALL_PATH/bin/activate
	tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX)
	cd $tmp_dir
        git clone --branch v2.9.4b https://github.com/underworldcode/underworld2.git $tmp_dir
        pip3 install .
        rm -rf $tmp_dir	
	cd $CDIR
}

install_uwgeodynamics(){
	source $INSTALL_PATH/bin/activate
	tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX)
	cd $tmp_dir
        git clone https://github.com/underworldcode/uwgeodynamics.git $tmp_dir
        pip3 install .
        rm -rf $tmp_dir	
	cd $CDIR
}

check_underworld_exists(){
	source $INSTALL_PATH/bin/activate
	return $(python3 -c "import underworld") 
}

check_uwgeodynamics_exists(){
	source $INSTALL_PATH/bin/activate
	return $(python3 -c "import UWGeodynamics") 
}

check_badlands_exists(){
	source $INSTALL_PATH/bin/activate
	return $(python3 -c "import badlands") 
}

install_badlands(){
       source $INSTALL_PATH/bin/activate
       pip3 install badlands
}

install_full_stack(){
    if ! command -v swig 2>/dev/null; then
           install_swig  
    else
           echo "Found swig"
    fi
    
    install_python_dependencies
    
    if ! check_underworld_exists; then
          install_underworld
    fi
    
    if ! check_uwgeodynamics_exists; then
          install_uwgeodynamics
    fi
    
    if ! check_badlands_exists; then
          install_badlands
    fi
}


if [ ! -d "$INSTALL_PATH" ]
then
    echo "Environment not found, creating a new one"
    mkdir -p $INSTALL_PATH
    python3 --version
    python3 -m venv $INSTALL_PATH
else
    echo "Found Environment"
    source $INSTALL_PATH/bin/activate
fi

This is the commands in my install_on_gadi.sh file which I used for installation. I reinstalled and still cannot find the UWGeodynamics_2.9.6.sh file

Peigen-L avatar Dec 10 '20 05:12 Peigen-L

UWGeodynamics_2.9.6.sh is install_on_gadi.sh.
Rename install_on_gadi.sh to UWGeodynamics_2.9.6.sh

PatriceFRey avatar Dec 10 '20 21:12 PatriceFRey

Thank you Patrice. Problem fixed. Appreciated!

Peigen-L avatar Dec 11 '20 00:12 Peigen-L