[Wrf-users] gfortran compilation of version 3.9.1.1
Don Morton
don.morton at borealscicomp.com
Sun Feb 4 10:12:25 MST 2018
Hello, this may be overkill, but I use Chef to provision WRF machines in
both VirtualBox and Amazon Cloud in Ubuntu 16.04, and in the last few weeks
set up a recipe for WRFv3.9.1.1
So, maybe there's something in there that helps.
Now that this stuff can be provisioned automatically, I've found that it
makes sense to use the libraries provided by the WRF people as a
foundation, rather than trying to get stuff to work with typical Ubuntu
packages. I've spent hours trying to get that kind of stuff to work, and
found that just working with the WRF tutorial installation, with their set
of tried-and-tested packages, works much better.
#
# Cookbook:: wrfnode
# Recipe:: default
#
# Copyright:: 2017, The Authors, All Rights Reserved.
#
#
# Set the global and environment variables
# For this first, root, directory, we need to recognize that when we
# create the directory, we can only create one at a time, not recursively.
# So, if we decided we wanted something like /shared/WRF, we would first
need
# to create /shared, then /shared/WRF
WRF_ROOTDIR = '/WRF'
ENV['WRF_ROOTDIR'] = WRF_ROOTDIR
WRF_LIB_DIR = WRF_ROOTDIR + '/LIBRARIES'
ENV['WRF_LIB_DIR'] = WRF_LIB_DIR
NETCDF = WRF_LIB_DIR + '/netcdf'
# This one is needed for the WRF compiling environment
ENV['NETCDF'] = NETCDF
# Root directory for tests of the provisioning system
#RUNTESTS_ROOTDIR = WRF_ROOTDIR + '/RUNTESTS'
#ENV['RUNTESTS_ROOTDIR'] = RUNTESTS_ROOTDIR
# Add the new NetCDF and MPICH to beginning of PATH
# This is done early, but I'm not sure how to do this
# "after" the install of netcdf and bin so that it's
# accessible to others
ENV['PATH'] = NETCDF + '/bin:' + WRF_LIB_DIR + '/mpich/bin:' + ENV['PATH']
ENV['CC'] = 'gcc'
ENV['CXX'] = 'g++'
ENV['FC'] = 'gfortran'
ENV['CFLAGS'] = '-m64'
ENV['F77'] = 'gfortran'
ENV['FFLAGS'] = '-m64'
# These are also assigned early
ENV['LDFLAGS'] = '-L' + WRF_LIB_DIR + '/grib2/lib'
ENV['CPPFLAGS'] = '-I' + WRF_LIB_DIR + '/grib2/include'
apt_update
# Basic system development packages
package 'csh'
package 'ksh'
package 'gfortran'
package 'm4'
package 'build-essential'
package 'openmpi-bin'
package 'libopenmpi-dev'
package 'libblas-dev'
package 'liblapack-dev'
package 'wget'
package 'curl'
package 'git'
package 'xterm'
package 'libxml2-utils'
package 'libxml-libxml-perl'
# Atmospheric stuff
package 'ncview'
package 'ncl-ncarg'
package 'grads' # For wgrib and wgrib2
user 'wrfuser' do
home '/home/wrfuser'
shell '/bin/bash'
manage_home true
action :create
end
bash 'set_wrfuser_password' do
code <<-EOH
echo -e
"#{node['wrfuser']['password']}\n#{node['wrfuser']['password']}" | passwd
wrfuser
EOH
end
bash 'customize_wrfuser_bashrc' do
code <<-EOH
# Add in a tag to search for in the not_if
echo "###CUSTOM###" >> /home/wrfuser/.bashrc
# Modify the PATH
echo "export
PATH=$WRF_LIB_DIR/mpich/bin:$WRF_LIB_DIR/netcdf/bin:$PATH" >>
/home/wrfuser/.bashrc
EOH
# Skip this if line ###CUSTOM### is in there
not_if 'grep -q "###CUSTOM###" /home/wrfuser/.bashrc'
end
# Allow for password login (I think this may be necessary for AWS EC2...)
# # I would like to find a more generic way to do this at some point, so
# # it's not system dependent
bash 'set_sshd_passwd_auth' do
code <<-EOH
sed "/PasswordAuthentication/ c\PasswordAuthentication yes" -i
/etc/ssh/sshd_config
service ssh restart
EOH
end
directory WRF_ROOTDIR do
owner "ubuntu"
group "ubuntu"
mode '0755'
action :create
end
directory WRF_LIB_DIR do
owner "ubuntu"
group "ubuntu"
mode '0755'
action :create
end
#directory RUNTESTS_ROOTDIR do
# owner "ubuntu"
# group "ubuntu"
# mode '0755'
# action :create
#end
bash 'wrfgeog-install' do
user 'ubuntu'
group "ubuntu"
cwd ENV['WRF_ROOTDIR']
code <<-EOH
wget -nv
http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_complete.tar.gz
wget -nv
http://www2.mmm.ucar.edu/wrf/src/wps_files/geog_new3.9.tar.bz2
# This creates new dir, geog
tar xzvf geog_complete.tar.gz
tar xjvf geog_new3.9.tar.bz2 -C geog
# Remove the huge tar files
rm geog_complete.tar.gz
rm geog_new3.9.tar.bz2
EOH
# Just a partial test that skips this resource if these exist
not_if 'test -e $WRF_ROOTDIR/geog/islope/index -a -e
$WRF_ROOTDIR/geog/soiltype_bot_30s/index'
end
# Install NetCDF that works well with WRF
bash 'netcdf-install' do
user 'ubuntu'
group "ubuntu"
cwd ENV['WRF_LIB_DIR']
code <<-EOH
wget -nv
http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/netcdf-4.1.3.tar.gz
tar xzvf netcdf-4.1.3.tar.gz
cd netcdf-4.1.3
./configure --prefix=$NETCDF --disable-dap --disable-netcdf-4
--disable-shared
make
make install
rm -rf $WRF_LIB_DIR/netcdf-4.1.3
rm -rf $WRF_LIB_DIR/netcdf-4.1.3.tar.gz
EOH
# Just a partial test that skips this resource if these exist
not_if 'test -e $NETCDF/lib/libnetcdf.a -a -e $NETCDF/lib/libnetcdff.a'
end
# This is currently redundant, because I have an openmpi that gets
provisioned
# with the image, but the following is tested to actually work with WRF. At
# some point I may want to test trying to do this with the default system
MPI
# Install the mpich that works well with WRF
bash 'mpich-install' do
user 'ubuntu'
group "ubuntu"
cwd ENV['WRF_LIB_DIR']
code <<-EOH
wget -nv
http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/mpich-3.0.4.tar.gz
tar xzvf mpich-3.0.4.tar.gz
cd mpich-3.0.4
./configure --prefix=$WRF_LIB_DIR/mpich
make
make install
rm -rf $WRF_LIB_DIR/mpich-3.0.4
rm -rf $WRF_LIB_DIR/mpich-3.0.4.tar.gz
EOH
# Just a partial test that skips this resource if these exist
not_if 'test -e $WRF_LIB_DIR/mpich/bin/mpif90 -a -e
$WRF_LIB_DIR/mpich/bin/mpiexec.hydra'
end
# Install zlib for WRF
bash 'zlib-install' do
user 'ubuntu'
group "ubuntu"
cwd ENV['WRF_LIB_DIR']
code <<-EOH
wget -nv
http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/zlib-1.2.7.tar.gz
tar xzvf zlib-1.2.7.tar.gz
cd zlib-1.2.7
./configure --prefix=$WRF_LIB_DIR/grib2
make
make install
rm -rf $WRF_LIB_DIR/zlib-1.2.7
rm -rf $WRF_LIB_DIR/zlib-1.2.7.tar.gz
EOH
# Just a partial test that skips this resource if these exist
not_if 'test -e $WRF_LIB_DIR/grib2/lib/libz.a'
end
# Install libpng for WRF
bash 'libpng-install' do
user 'ubuntu'
group "ubuntu"
cwd ENV['WRF_LIB_DIR']
code <<-EOH
wget -nv
http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/libpng-1.2.50.tar.gz
tar xzvf libpng-1.2.50.tar.gz
cd libpng-1.2.50
./configure --prefix=$WRF_LIB_DIR/grib2
make
make install
rm -rf $WRF_LIB_DIR/libpng-1.2.50
rm -rf $WRF_LIB_DIR/libpng-1.2.50.tar.gz
EOH
# Just a partial test that skips this resource if these exist
not_if 'test -e $WRF_LIB_DIR/grib2/lib/libpng.a'
end
# Install jasper for WRF
bash 'jasper-install' do
user 'ubuntu'
group "ubuntu"
cwd ENV['WRF_LIB_DIR']
code <<-EOH
wget -nv
http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz
tar xzvf jasper-1.900.1.tar.gz
cd jasper-1.900.1
./configure --prefix=$WRF_LIB_DIR/grib2
make
make install
rm -rf $WRF_LIB_DIR/jasper-1.900.1
rm -rf $WRF_LIB_DIR/jasper-1.900.1.tar.gz
EOH
# Just a partial test that skips this resource if these exist
not_if 'test -e $WRF_LIB_DIR/grib2/lib/libjasper.a'
end
# Install WRF (dm mode)
bash 'wrf-install' do
user 'ubuntu'
group "ubuntu"
cwd ENV['WRF_ROOTDIR']
code <<-EOH
wget -nv http://www2.mmm.ucar.edu/wrf/src/WRFV3.9.1.1.TAR.gz
tar xzvf WRFV3.9.1.1.TAR.gz
cd WRFV3
./clean -a
./configure << RESPONSES
34
1
RESPONSES
./compile em_real 2>&1 | tee wrf-compile.log
# check for executables
for execfile in wrf.exe real.exe tc.exe ndown.exe
do
if [ ! -f main/$execfile ]; then
echo "WARNING - main/$execfile not found"
fi
done
rm -rf $WRF_ROOTDIR/WRFV3.9.1.1.TAR.gz
EOH
# Just a partial test that skips this resource if these exist
not_if 'test -e $WRF_ROOTDIR/WRFV3/main/wrf.exe -a -e
$WRF_ROOTDIR/WRFV3/main/real.exe'
end
# Install WPS (dm mode)
bash 'wps-install' do
user 'ubuntu'
group "ubuntu"
cwd ENV['WRF_ROOTDIR']
code <<-EOH
wget -nv http://www2.mmm.ucar.edu/wrf/src/WPSV3.9.1.TAR.gz
tar xzvf WPSV3.9.1.TAR.gz
cd WPS
export JASPERLIB=$WRF_LIB_DIR/grib2/lib
export JASPERINC=$WRF_LIB_DIR/grib2/include
./clean -a
./configure << RESPONSES
3
RESPONSES
./compile 2>&1 | tee compile.log
# check for executables
for execfile in ungrib.exe metgrid.exe geogrid.exe
do
if [ ! -f $execfile ]; then
echo "WARNING - $execfile not found"
fi
done
rm -rf $WRF_ROOTDIR/WPSV3.9.1.TAR.gz
EOH
# Just a partial test that skips this resource if these exist
not_if 'test -e $WRF_ROOTDIR/WPS/geogrid.exe -a -e
$WRF_ROOTDIR/WPS/ungrib.exe -a -e $WRF_ROOTDIR/WPS/metgrid.exe'
end
---
Don Morton, Owner/Manager
Boreal Scientific Computing LLC
Fairbanks, Alaska USA
http://www.borealscicomp.com/
http://www.borealscicomp.com/Miscellaneous/MortonBio/
On Sun, Feb 4, 2018 at 4:56 PM, Frank Colby <Frank_Colby at uml.edu> wrote:
> Hi Folks,
>
> Have any of you had trouble compiling 3.9.1.1?
>
> I tried on a Ubuntu 16.04 OS, serial, basic nesting, and had two "internal
> compiler errors".
>
> Using the same system, same configuration, 3.8.1 compiles without errors.
>
> Any thoughts?
>
> Thanks,
> Frank Colby
> UMass Lowell
>
> _______________________________________________
> Wrf-users mailing list
> Wrf-users at ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/wrf-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/wrf-users/attachments/20180204/d690c58d/attachment-0001.html>
More information about the Wrf-users
mailing list