Skip to content

Instantly share code, notes, and snippets.

@martijngastkemper
Last active February 4, 2017 13:14
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save martijngastkemper/a703a6f2c8c3bbfe2a04 to your computer and use it in GitHub Desktop.
Script to build Delft3D with parallel computation Ubuntu Lucid (10.04). I tested it on AWS AMI "Ubuntu Server 14.04 LTS (HVM), SSD Volume Type - ami-f0b11187".
#!/bin/bash
# Sources:
# - http://content.oss.deltares.nl/delft3d/Webinar/Baart_LinuxCodeCompiling/WebinarBaart_11012012_v3.html
# - http://oss.deltares.nl/web/delft3d/general/-/message_boards/view_message/567530
sudo apt-get update
sudo apt-get install \
build-essential\
subversion\
autoconf\
libtool\
bison\
flex\
gfortran\
libexpat1\
libexpat1-dev\
make
# MPICH is a requirement, but the version provided by apt-get isn't sufficient
wget http://www.mpich.org/static/downloads/1.4.1/mpich2-1.4.1.tar.gz
tar -xzf mpich2-1.4.1.tar.gz
cd mpich2-1.4.1
# This prefix is hard coded in delft3d/src/build.sh
./configure\
--prefix=/opt/mpich2-1.4.1-gcc-4.6.2\
--enable-shared\
--enable-lib-depend\
--enable-sharedlibs=gcc\
--with-pm=mpd\
F77=gfortran FC=gfortran CC=gcc CXX=g++ FCFLAGS=-fPIC CFLAGS=-fPIC CCFLAGS=-fPIC CXXFLAGS=-fPIC 2>&1 | tee c.txt
make
make install
cd ~
svn checkout https://svn.oss.deltares.nl/repos/delft3d/trunk delft3d
# Give your credentials
cd delft3d/src
./build.sh -gnu
sudo ln -s mpich2-1.4.1-gcc-4.6.2 /opt/mpich2
echo "export LD_LIBRARY_PATH=/opt/mpich2-1.4.1-gcc-4.6.2/lib/:$LD_LIBRARY_PATH" >> ~/.profile
source ~/.profile
echo "secretword=whatever" > ~/.mpd.conf
chmod 600 ~/.mpd.conf
#!/bin/bash
# Easily upload results to a AWS S3 bucket
sudo apt-get install awscli
aws configure
# type your credentials
aws s3 sync dir s3://delft3d/
#!/bin/bash
# Run 01_starndard/run_parallel.sh
nano run_flow2d3d_parallel.sh
# Change
export NHOSTS=2
# To
export NHOSTS=1
# Change amount of cpu's
@cosmic-latte
Copy link

while the Script trying to compile Delft3D , an error received on ubuntu 14.04 LTS Desktop

Installed MPE2 in /opt/mpich2-1.4.1-gcc-4.6.2
/opt/mpich2-1.4.1-gcc-4.6.2/sbin/mpeuninstall may be used to remove the installation
make[1]:正在离开目录 `/home/achilles/下载/gista703a6f2c8c3bbfe2a04-1452f9dc82dacf46ab90bac7bd019691b359cc50/mpich2-1.4.1/src/mpe2'
U delft3d/src/scripts_lgpl/win64/change_sln_projs.py
U delft3d/src/engines_gpl/part/packages/kernel_f/src/delpar.F90
U delft3d/src/engines_gpl/part/packages/kernel_f/src/Makefile.am
取出版本 4976。
Using GNU compilers in /usr/bin
Current settings:
export ACLOCAL=""
export AUTOMAKE=""
export AUTOHEADER=""
export AUTOCONF=""
export AUTORECONF_FLAGS=""
export LIBTOOLIZE=""
export LDFLAGS=""
export LDFLAGSMT_ADDITIONAL=" "
export LD_LIBRARY_PATH=":/p/delft3d/opt/netcdf-4.1.3mt/intel11.1/lib"
export MPIFC="/opt/mpich2-1.4.1-gcc-4.6.2/bin/mpif90"
export MPI_INCLUDE="/opt/mpich2-1.4.1-gcc-4.6.2/include"
export MPILIBS_ADDITIONAL="-L/opt/mpich2-1.4.1-gcc-4.6.2/lib -lfmpich -lmpich -lmpl"
export PKG_CONFIG_PATH="//p/delft3d/opt/netcdf-4.1.3mt/intel11.1/lib/pkgconfig:"
export PATH="/opt/mpich2-1.4.1-gcc-4.6.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

20150422.125126 :: Running ./autogen.sh --verbose &> logs/autogen.log
20150422.125142 :: Running CFLAGS='-O2 ' CXXFLAGS='-O2 ' AM_FFLAGS=' ' FFLAGS='-O2 ' AM_FCFLAGS=' ' FCFLAGS='-O2 ' AM_LDFLAGS=' ' ./configure --prefix=/home/achilles/delft3d/src &> logs/configure.log
20150422.125155 :: Running make ds-install &> logs/make.log
20150422.125155 :: Make fails!

here are my make.log files

Making install in third_party_open
make[1]: 正在进入目录 /home/achilles/delft3d/src/third_party_open' Making install in version_number make[2]: 正在进入目录/home/achilles/delft3d/src/third_party_open/version_number'
Making install in packages
make[3]: 正在进入目录 /home/achilles/delft3d/src/third_party_open/version_number/packages' Making install in version_number make[4]: 正在进入目录/home/achilles/delft3d/src/third_party_open/version_number/packages/version_number'
Making install in src
make[5]: 正在进入目录 /home/achilles/delft3d/src/third_party_open/version_number/packages/version_number/src' Makefile:789: 警告:覆盖关于目标“clean-local”的命令 Makefile:784: 警告:忽略关于目标“clean-local”的旧命令 /bin/bash ../../../../../libtool --tag=FC --mode=link /opt/mpich2-1.4.1-gcc-4.6.2/bin/mpif90 -DWITH_DELFTONLINE -O2 -ffree-line-length-none -cpp -o version_number.exe version_number.o -lrt -lexpat -lstdc++ -lnetcdff libtool: link: /opt/mpich2-1.4.1-gcc-4.6.2/bin/mpif90 -DWITH_DELFTONLINE -O2 -ffree-line-length-none -cpp -o version_number.exe version_number.o -lrt /usr/lib/x86_64-linux-gnu/libexpat.so -lstdc++ -lnetcdff /usr/bin/ld: cannot find -lnetcdff collect2: error: ld returned 1 exit status make[5]: *** [version_number.exe] 错误 1 make[5]:正在离开目录/home/achilles/delft3d/src/third_party_open/version_number/packages/version_number/src'
make[4]: *** [install-recursive] 错误 1
make[4]:正在离开目录 /home/achilles/delft3d/src/third_party_open/version_number/packages/version_number' make[3]: *** [install-recursive] 错误 1 make[3]:正在离开目录/home/achilles/delft3d/src/third_party_open/version_number/packages'
make[2]: *** [install-recursive] 错误 1
make[2]:正在离开目录 /home/achilles/delft3d/src/third_party_open/version_number' make[1]: *** [install-recursive] 错误 1 make[1]:正在离开目录/home/achilles/delft3d/src/third_party_open'
make: *** [install-recursive] 错误 1

错误 means error
警告 means warning
正在离开目录 means leave current folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment