A blank slate guide to installing ROMS on Ubuntu Lucid Lynx

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

Post Reply
Message
Author
User avatar
cvl
Posts: 18
Joined: Tue Jun 03, 2003 7:39 pm

A blank slate guide to installing ROMS on Ubuntu Lucid Lynx

#1 Unread post by cvl »

Update (2014-07-30): This guide should is obsolete due to updates of both ROMS and Ubuntu. As my work is not currently ROMS-centered, I am unlikely to attempt this exercise again. There are several useful alternatives and active projects discussed in the comments below.
Having lurked here for a few years and seen a number of "how do I install ..." posts, I thought I'd try to work through the minimal steps from a bare machine to a functioning multi-core ROMS installation running on Linux. I based my build on Ubuntu; in my experience the most idiot-proof of distros, and tried to minimize the necessary steps and installation complexities.

What I have NOT determined is why Ubuntu's standard NetCDF library package doesn't seem to work; if anyone has any insight into this, I'd love to hear it. As far as I can determine, they are built with the correct compilers, though there may be a version mismatch. Fortunately NetCDF builds are now fairly trivial.

If anyone feels this is worthy of the Wiki, they are welcome to move it there and hack it as they wish. If anyone wishes to change it, they're welcome to email me. I understand that this installation is neither optimized nor efficient, but it has been determined to generate usable executables on several systems.
Having not worked with ROMS in a few years and being possessed of a shiny empty workstation to set-up, I decided to work through the minimum necessary steps to getting ROMS running from bare metal. Here's my road map to creating a functional Linux ROMS version in some minimal number of steps (please note the disclaimers at the end):

Start by installing Ubuntu (in my case, 10.04 Server). This has, in most cases, become an automatic process as simple (or difficult) as any other OS installation. You will need to enable networking or use a work-around to install the packages listed below. Ubuntu supports package upgrades without network if you look around enough. All of the following SHOULD be doable on a dumb terminal system, without graphics or anything more than a shell account.

Log in to your new linux system. You will need someone with administrative privileges which you will have because a stock Ubuntu install only has one account and that account has administrative privileges.

First, install the necessary Ubuntu packages (this is the only step which requires administrative privileges, if you are not an administrator, this is what you need to talk your sysadmin into doing for you):

Code: Select all

sudo apt-get -y install gfortran g++ libmpich2-dev subversion
Now get the NetCDF source code and build it in your local directory:

Code: Select all

wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf.tar.gz
tar xzvf netcdf.tar.gz
cd netcdf*
export FC=gfortran F77=gfortran
NETCDFDIR=${PWD}/gfortran
mkdir ${NETCDFDIR}
./configure --prefix=${NetCDFDIR} --disable-netcdf-4
make check install
cd
Now, get the ROMS source, entering the appropriate credentials you have obtained from the ROMS administrators via https://www.myroms.org/index.php?page=RomsCode . SVN will ask some questions about storing your password in plain text; assuming you're the sole user on this machine, yes is a fairly safe answer.

Code: Select all

svn checkout https://www.myroms.org/svn/src/trunk ROMS
Move into the ROMS build directory and set the correct location for your newly built NetCDF libraries (note, this could just as easily be done with an editor, I chose to use sed to maximize the portability of the description). The original, unmodified versions of edited files are saved with an extension of _release. If you're unfamniliar with sed, it's worth comparing the release version with the functional one.

Code: Select all

cd ROMS
sed -i_release "s#NETCDF_INCDIR ?= /usr/local#NETCDF_INCDIR ?= $NETCDFDIR#;s#NETCDF_LIBDIR ?= /usr/local#NETCDF_LIBDIR ?= $NETCDFDIR#" Compilers/Linux-gfortran.mk
sed -i_release 's.FORT ?= pgi.FORT ?= gfortran.' makefile
make
At this point, ~/ROMS should contain oceanS the serial executable for the ROMS upwelling case.

Code: Select all

./oceanS < ./ROMS/External/ocean_upwelling.in
Now let's try the OpenMP version, just for kicks:

Code: Select all

sed -i 's/USE_OpenMP ?=/USE_OpenMP ?= yes/' makefile 
make clean;make
./oceanO < ./ROMS/External/ocean_upwelling.in
And finally, we compile the MPI version using ubuntu's native MPICH2 package.

Code: Select all

sed -i 's/USE_OpenMP ?= yes/USE_OpenMP ?=/;s/USE_MPI ?=/USE_MPI ?= yes/;s/USE_MPIF90 ?=/USE_MPIF90 ?= yes/' makefile 
make clean;make
Start up a basic MPI daemon:

Code: Select all

echo MPD_SECRETWORD=roms > ~/.mpd.conf
chmod 600 ~/.mpd.conf
mpd &
And run the MPICH code, first with just one tile to verify usability:

Code: Select all

mpirun -n 1 ./oceanM ./ROMS/External/ocean_upwelling.in
Now with two tiles:

Code: Select all

sed -i_release 's/NtileJ == 1/NtileJ == 2/' ROMS/External/ocean_upwelling.in 
mpirun -n 2 ./oceanM ./ROMS/External/ocean_upwelling.in
At this point the machine is configured to successfully run ROMS in serial and two types of parallel configurations. Note that NO optimization has been done, nor does this imply that the results are sane, merely that the code can be run!
Last edited by cvl on Wed Jul 30, 2014 10:36 am, edited 2 times in total.

lalvarez
Posts: 106
Joined: Wed Feb 03, 2010 6:59 pm
Location: Universidad Autonoma de Baja California Sur

Re: A blank slate guide to installing ROMS on Ubuntu Lucid L

#2 Unread post by lalvarez »

Hello CVL

I'm following your instructions to install ROMS and i have install the gfortran & netcdf libraries and download the ROMS code succesfully, when i get to the fourth step i get this message

Code: Select all

leonardo@leonardo-PC:~$ cd ROMS
leonardo@leonardo-PC:~/ROMS$ sed -i_release "s#NETCDF_INCDIR ?= /usr/local#NETCDF_INCDIR ?= $NETCDFDIR#;s#NETCDF_LIBDIR ?= /usr/local#NETCDF_LIBDIR ?= $NETCDFDIR#" Compilers/Linux-gfortran.mk
leonardo@leonardo-PC:~/ROMS$ sed -i_release 's.FORT ?= pgi.FORT ?= gfortran.' makefile
leonardo@leonardo-PC:~/ROMS$ make
[color=#0000FF]makefile:238: INCLUDING FILE /home/leonardo/make_macros.mk WHICH CONTAINS APPLICATION-DEPENDENT MAKE DEFINITIONS
cp -f /include/netcdf.mod Build
cp: no se puede efectuar `stat' sobre «/include/netcdf.mod»: No existe el archivo o el directorio
make: *** No hay ninguna regla para construir el objetivo «Build/MakeDepend», necesario para «all».  Alto.[/color]

Is there anything i miss in any of the three previous steps? Can you give me a hand on this?

Thanks in advance
Leonardo

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: A blank slate guide to installing ROMS on Ubuntu Lucid L

#3 Unread post by kate »

One of the early steps had this:

Code: Select all

NETCDFDIR=${PWD}/gfortran
After the sed command, the Compilers/Linux-gfortran.mk file will have:

Code: Select all

ifdef USE_NETCDF4
        NC_CONFIG ?= nc-config
    NETCDF_INCDIR ?= $(shell $(NC_CONFIG) --prefix)/include
             LIBS := $(shell $(NC_CONFIG) --flibs)
else
    NETCDF_INCDIR ?= $NETCDFDIR/include
    NETCDF_LIBDIR ?= $NETCDFDIR/lib
             LIBS := -L$(NETCDF_LIBDIR) -lnetcdf
endif
If you are building a new NetCDF library, you want to define USE_NETCDF4 for the build, for which nc-config should be on your path somewhere. This is newish for NetCDF. If you want to use the old style, you need to have NETCDFDIR defined in your environment for each ROMS build, not just for the NetCDF build.

User avatar
cvl
Posts: 18
Joined: Tue Jun 03, 2003 7:39 pm

Re: A blank slate guide to installing ROMS on Ubuntu Lucid L

#4 Unread post by cvl »

Just a quick note - that post is, unfortunately, fairly out of date now. I'll try to update it sometime soon.

Just a thought for general consideration: is there anywhere we could store a virtual machine with a simple set-up people could use as a sample? I'd bet it would fit within a GB or so; it would run fairly slowly but would be less vulnerable to the shifting sands of dependency hell.

lalvarez
Posts: 106
Joined: Wed Feb 03, 2010 6:59 pm
Location: Universidad Autonoma de Baja California Sur

Re: A blank slate guide to installing ROMS on Ubuntu Lucid L

#5 Unread post by lalvarez »

Hello Kate & CVL

Let me give a little explanation of what i have found, looking at your comentaries.

First, i have the Netcdf-4.3.2 directory at the same level ROMS directory is, that is
/home/leonardo/ Netcdf_4.3.2 & ROMS are in here

Is that what is expected or not?

Then after the:

Code: Select all

leonardo@leonardo-PC:~$ cd ROMS
leonardo@leonardo-PC:~/ROMS$ sed -i_release "s#NETCDF_INCDIR ?= /usr/local#NETCDF_INCDIR ?= $NETCDFDIR#;s#NETCDF_LIBDIR ?= /usr/local#NETCDF_LIBDIR ?= $NETCDFDIR#" Compilers/Linux-gfortran.mk
leonardo@leonardo-PC:~/ROMS$ sed -i_release 's.FORT ?= pgi.FORT ?= gfortran.' makefile
leonardo@leonardo-PC:~/ROMS$ make
makefile:238: INCLUDING FILE /home/leonardo/make_macros.mk WHICH CONTAINS APPLICATION-DEPENDENT MAKE DEFINITIONS
cp -f /include/netcdf.mod Build
cp: no se puede efectuar `stat' sobre «/include/netcdf.mod»: No existe el archivo o el directorio
make: *** No hay ninguna regla para construir el objetivo «Build/MakeDepend», necesario para «all».  Alto.
Anyway, i look for the ocean_upwelling.in file in the ROMS directiry (1){according to the next step in the guide}, but what i found is that i have another ROMS directory (2) inside the first one, that is:
/home/leonardo/ROMS/ROMS/

and inside the second ROMS directory, there is the ocean_upwelling.in file

is it supposed to be that way?

and there is nothing inside the Build directory
/home/leonrdo/ROMS/Build/ is empty

is that right?

Well, i hope i can fix this properly

Thanks in advance
Leonardo

rsoutelino
Posts: 23
Joined: Tue Oct 07, 2008 11:27 am
Location: MetService - New Zealand
Contact:

Re: A blank slate guide to installing ROMS on Ubuntu Lucid L

#6 Unread post by rsoutelino »

Are you familiar with the https://www.docker.com/ approach? It could be a good alternative to virtual machines, because they are super light, actually seamless when running in the same OS host.

I share a docker image with my students with Ubuntu 14.04 running the upwelling test case both on OpenMP and MPICH2 protocols, compiled with gfortran. It works perfect for us. If there is an issue with ROMS compilation or either implementation, we can ship the entire container among us to sort out the solutions, while being immune to libraries diversity. I could share a tar file with this docker image if people are interested.

User avatar
ngarg
Posts: 19
Joined: Fri Jul 12, 2013 5:46 pm
Location: NTU

Re: A blank slate guide to installing ROMS on Ubuntu Lucid L

#7 Unread post by ngarg »

Hi Guys,

I am not sure if you are familiar with LiveROMS. It is a working virtual machine configured by a research group in Chile. I have added the link below

http://ronin.dgeo.udec.cl/LiveROMS/

viewtopic.php?f=23&t=2340&hilit=liveroms

I think it is a good place to start for beginners. Although it uses ROMS_AGRIF configuration, i think it is fairly straightforward to do an installation of vanilla ROMS. They are soon going to release a new version of LiveROMS based on
Ubuntu LTS 14 (I think)

It also provides Octave based scripts for ROMS setup in place of Matlab.

User avatar
cvl
Posts: 18
Joined: Tue Jun 03, 2003 7:39 pm

Re: A blank slate guide to installing ROMS on Ubuntu Lucid L

#8 Unread post by cvl »

Thanks for that information! I've attached a warning note that my "guide" is now obsolete (should have done so long ago).

lalvarez
Posts: 106
Joined: Wed Feb 03, 2010 6:59 pm
Location: Universidad Autonoma de Baja California Sur

Re: A blank slate guide to installing ROMS on Ubuntu Lucid L

#9 Unread post by lalvarez »

Hello to All

I have contact personaly with Andres Sepulveda of LiveROMS and he is going to guide me to install LiveROMS, as He has told me it works with ROMS_AGRIF and there is no problem if i install ROMS_Rutger also, i just need to set them in different directories.

What i`m looking for is some help in order to install ROMS_Rutgers on Linux, in this i have not been clear in my past coments in this thread.

Is there any post or online guide to do so?

Thanks in advance and i appreciate your help

Leonardo

Post Reply