Modifying Makefile for ROMS3.0

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
richard.schmalz
Posts: 24
Joined: Thu Oct 04, 2007 4:14 am
Location: NOAA

Modifying Makefile for ROMS3.0

#1 Unread post by richard.schmalz »

I am using ROMS 3.0 and have mpi turned on. I have a makefile called makefile.mpi which selects DELAWARE_BAY and within /Include/delaware_bay.h resides with some cppdef options.

I now have created a new application termed delaware_bay_robc.h (reduced open boundary conditions) in /Include. I wish to keep the original /Bin and /Build directories for the first application.

I have created a new makefile termed makefile.robc.mpi with

ROMS_APPLICATION ?=DELAWARE_BAY_ROBC
BINDIR ?= Bin_robc
SCRATCH_DIR ?= Build/robc
CLEAN := ROMS/Bin_robc/cpp_clean
SFMAKEDEPEND := ./ROMS/Bin_robc/sfmakedepend

Is there anything else I need to do to create the new ROBC application while still preserving the original one?

User avatar
arango
Site Admin
Posts: 1351
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

#2 Unread post by arango »

You do not need to do anything like this :!: There is no need to change the makefile or any of the files inside the ROMS directory tree. We redesigned ROMS so everything can be done from outside of the distribution directories. You can have numerous project directories. You just need to use the ROMS/Bin/build.sh or ROMS/Bin/build.bash script.

There is plenty of detailed information to how to do this in :arrow: WikiROMS. See the ROMS :arrow: build script page.

richard.schmalz
Posts: 24
Joined: Thu Oct 04, 2007 4:14 am
Location: NOAA

#3 Unread post by richard.schmalz »

I have successfully implemented this strategy and now have under myDBROMS.1 several /Bin and /Build files. With /Nonlinear I have several versions of set_vbc.F and use the makefile on the appropriate file.

I wanted to eliminate some of the /Bin and Build files, so I copied myDBROMS.1 to myDBROMS.2 and then deleted some of the Bin and Build files, but now have trouble with the makefile. Here is the directory structure:

/gpfs/d/marine/save/wx21rs/myDBROMS.2
total 2048
-rwxrwxrwx 1 wx21rs g01 1298 Aug 16 2007 typesizes.mod
-rwxrwxrwx 1 wx21rs marine 18518 May 30 12:21 makefile.robc.mpi
-rw-r--r-- 1 wx21rs g01 38 May 30 13:40 list.out
-rw-r--r-- 1 wx21rs marine 933 Dec 10 10:55 help
drwxr-xr-x 4 wx21rs marine 32768 Dec 10 10:51 Waves
drwxr-xr-x 6 wx21rs marine 32768 Dec 10 10:55 User
drwxr-xr-x 17 wx21rs marine 32768 Dec 10 10:51 ROMS
drwxr-xr-x 3 wx21rs g01 32768 Dec 17 16:05 Projects
drwxr-xr-x 3 wx21rs marine 32768 Dec 10 10:55 Master
drwxr-xr-x 6 wx21rs marine 32768 Dec 10 10:55 Lib
-rw-r--r-- 1 wx21rs g01 864 Mar 19 11:21 INFO_makefile
drwxr-xr-x 4 wx21rs marine 32768 Dec 10 10:55 Data
drwxr-xr-x 3 wx21rs marine 32768 May 30 12:52 Compilers
drwxr-xr-x 2 wx21rs g01 32768 May 30 12:52 Build
drwxr-xr-x 2 wx21rs g01 32768 Feb 01 15:40 Bin
drwxr-xr-x 5 wx21rs marine 32768 Dec 10 10:55 Atmosphere
drwxr-xr-x 7 wx21rs marine 32768 Dec 10 10:49 .svn
drwxr-sr-x 6 wx21rs marine 32768 May 30 08:47 ..
drwxr-xr-x 14 wx21rs marine 32768 May 30 13:40 .

And when I run gmake -d -f makefile.robc.mpi
I get the following error:

No implicit rule found for `makefile.robc.mpi'.
Finished prerequisites of target file `makefile.robc.mpi'.
No need to remake target `makefile.robc.mpi'.
Updating goal targets....
Considering target file `all'.
File `all' does not exist.
Considering target file `Build'.
Finished prerequisites of target file `Build'.
No need to remake target `Build'.
Considering target file `Build/MakeDepend'.
Recently tried and failed to update file `Build/MakeDepend'.
gmake: *** No rule to make target `Build/MakeDepend', needed by `all'. Stop.

Any suggestions would be much appreciated. Note when I run makefile.robc.mpi in myDBROMS.1 directory it works fine and there is no difference in the versions in myDBROMS.1 and myDBROMS.2.

richard.schmalz
Posts: 24
Joined: Thu Oct 04, 2007 4:14 am
Location: NOAA

#4 Unread post by richard.schmalz »

I recopied myDBROMS.1 to myDBROMS.1.1 and removed the Build and Bin directories which I no longer needed. I modified the necessary routines and the makefile.robc.mpi worked perfectly.

I can only think that the diff did not pick up some minor character difference in the files which caused gmake to fail.

It appears that gmake is a very complicated piece of software, which may perform erratically at times.

User avatar
wilkin
Posts: 890
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

#5 Unread post by wilkin »

If I understand correctly what you are wanting to do, Hernan is quite correct that the build.sh script allows a far more convenient way to do this without getting mired in the makefile.

build.sh uses environment variables to over-ride the default settings.

In build.sh, comment out the lines that set the variables you want to alter on separate calls of the script, e.g.

Code: Select all

#export   ROMS_APPLICATION=UPWELLING
#export   BINDIR=${MY_PROJECT_DIR
and set these variable in the shell that calls build.bash. The script will assume the values from the shell, e.g.

Code: Select all

export ROMS_APPLICATION=DELAWARE_BAY
export BINDIR=/var/tmp/Builds/version1
./build.bash
Obviously, you can be even more clever and construct these environment variables in a script that becomes the driver for the whole process.

The information in these environment variables gets written to the internal metadata of the netcdf file, so you also have the capability to fully document what you've done and if you are running a large suite of jobs with different options you can still track individual runs that might have failed for certain settings.

This is way easier than getting in to the makefile.

John.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

Post Reply