Compiling ROMs in Ubuntu

Report or discuss software problems and other woes

Moderators: arango, robertson

Post Reply
Message
Author
emmabremps
Posts: 3
Joined: Fri Sep 15, 2017 5:29 pm
Location: University Of Ghana

Compiling ROMs in Ubuntu

#1 Post by emmabremps » Wed Dec 13, 2017 3:34 pm

Hi guys,
I am having challenges installing NETCDF Fortran on Ubuntu can someone please send me the codes to run to successfully install it.
Secondly i want the codes to run to build and compile my ROMs

User avatar
m.hadfield
Posts: 520
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Compiling ROMs in Ubuntu

#2 Post by m.hadfield » Thu Dec 14, 2017 5:52 am

According to this

https://www.unidata.ucar.edu/software/n ... aries.html

"The easiest way to get netCDF is through a package management program, such as rpm, yum, adept, and others. NetCDF is available from many different repositories, including the default Red Hat and Ubuntu repositories. "

I have no experience with Ubuntu, but I expect that you would need the netcdf and netcdf-fortran packages. While you're at it, get openmpi. And of course gfortran. Also perl, make and probably a few others I've forgotten.

Once you've done that, try running build.bash with the following environment variables defined:

export FORT=gfortran
export FC=gfortran
export USE_NETCDF4=on
export USE_MPIF90=on

This might work and it mightn't. Here's a problem report that I had on CentOS with the yum packages:

viewtopic.php?f=31&t=4383&hilit=centos

Let us know how you get on.

emmabremps
Posts: 3
Joined: Fri Sep 15, 2017 5:29 pm
Location: University Of Ghana

Re: Compiling ROMs in Ubuntu

#3 Post by emmabremps » Thu Dec 14, 2017 8:43 am

rslab-2@RSLAB-2:~$ nf-config --all

This netCDF-Fortran 4.4.3 has been built with the following features:

--cc -> gcc
--cflags -> -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2

--fc -> gfortran
--fflags -> -I/usr/include
--flibs -> -L/usr/lib -lnetcdff -Wl,-Bsymbolic-functions -Wl,-z,relro -lnetcdf -lnetcdf
--has-f90 -> no
--has-f03 -> yes

--has-nc2 -> yes
--has-nc4 -> yes

--prefix -> /usr
--includedir-> /usr/include
--version -> netCDF-Fortran 4.4.3

This is what I had when I run nf-config --all
Am new to ROMs my F90 says no how do I configure F90

User avatar
m.hadfield
Posts: 520
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Compiling ROMs in Ubuntu

#4 Post by m.hadfield » Thu Dec 14, 2017 8:59 am

has-f03 is "yes" so it should work with ROMS.

jpringle
Posts: 92
Joined: Sun Jul 27, 2003 6:49 pm
Location: UNH, USA

Re: Compiling ROMs in Ubuntu

#5 Post by jpringle » Thu Dec 14, 2017 2:21 pm

I have recently compiled ROMS on a bunch of ubuntu machines for benchmarking and production use, with versions 16.04, 17.04 and 17.10 (I recommend skipping 17.04). In all cases it is trivial to get ROMS going. Just install the following packages (which include the MPI packages, and you can compile a fresh download of ROMS with no problem. There is no need to try to compile netCDF yourself. Just install the following packages using "sudo apt install".

libnetcdf-dev
libnetcdff-dev
netcdf-bin
gfortran
libopenmpi-dev
openmpi-bin

Note that one libnetcdf-dev has 1 "f" and the other has 2 "f"s. Then in build.bash set the compiler to "gfortran", make sure to set "export USE_NETCDF4 on" and set the paths for the netcdf files to

export NF_CONFIG=/usr/bin/nf-config
export NETCDF_INCDIR=/usr/include

Of course, if you are using ifort or something else, you will have to rebuild netcdf for that compiler.

Jamie

User avatar
m.hadfield
Posts: 520
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Compiling ROMs in Ubuntu

#6 Post by m.hadfield » Fri Dec 15, 2017 12:05 am

Hi Jamie

Good to hear.

One quibble: if USE_NETCDF4 is "on" then you shouldn't need NETCDF_INCDIR; if it's off then setting NF_CONFIG should have no effect.

Mark

Aminrahdarian
Posts: 6
Joined: Wed Jan 25, 2017 5:26 pm
Location: University Of Waikato

Re: Compiling ROMs in Ubuntu

#7 Post by Aminrahdarian » Fri Dec 15, 2017 9:51 am

Hi ,

One way to install netcdf is to try this command in your terminal :

apt-get install *netcdf*

It will install all you need to compile ROMS (netcdf.mod, netcdf.h and nc-config) .

Amin

jpringle
Posts: 92
Joined: Sun Jul 27, 2003 6:49 pm
Location: UNH, USA

Re: Compiling ROMs in Ubuntu

#8 Post by jpringle » Fri Dec 15, 2017 5:45 pm

Mark --

Ah -- I see -- I had not defined "USE_MY_LIBS" and so it ignored the changes I made to NF_CONFIG and NETCDF_INCDIR in my build.bash. I had made the changes, and never tested if it worked without them.


Cheers,
Jamie

Post Reply