ROMS in CYGWIN using g95

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

Post Reply
Message
Author
sankaras
Posts: 33
Joined: Mon Nov 27, 2006 6:02 pm
Location: Stanford University.

ROMS in CYGWIN using g95

#1 Post by sankaras » Thu May 10, 2007 7:38 pm

Hello,

I am a very new ROMS and CYGWIN user. I am trying to compile ROMS in CYGWIN by,

Make -f CYGWIN-g95.mk

and I get the following message:

Make: *** No targets. Stop.

I beginning to learn about cygwin, cpp, and make, this week.

For eg in th e cppdef.h file, it says

The application CPP flag to run is activated in the **
** makefile. For example, to activate the upwelling example (UPWELLING) **
** set: **
** **
** ROMS_APPLICATION ?= UPWELLING


where do I put this "ROMS_APPLICATION ?= UPWELLING" in the make file?

My CYGWIN-g95.mk is given below.

Any help would be appreciated.

Thanks,

Sankar


****************************************************************
# svn $Id$
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Copyright (c) 2002-2007 The ROMS/TOMS Group :::
# Licensed under a MIT/X style license :::
# See License_ROMS.txt :::
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#
# Include file for GNU g95 on Cygwin
# -------------------------------------------------------------------------
#
# ARPACK_LIBDIR ARPACK libary directory
# FC Name of the fortran compiler to use
# FFLAGS Flags to the fortran compiler
# CPP Name of the C-preprocessor
# CPPFLAGS Flags to the C-preprocessor
# CLEAN Name of cleaning executable after C-preprocessing
# NETCDF_INCDIR NetCDF include directory
# NETCDF_LIBDIR NetCDF libary directory
# LD Program to load the objects into an executable
# LDFLAGS Flags to the loader
# RANLIB Name of ranlib command
# MDEPFLAGS Flags for sfmakedepend (-s if you keep .f files)
#
# First the defaults
#

BIN := /cygdrive/c/Programs/ROMS

FC := g95
FFLAGS := -fno-second-underscore -ftrace=full
CPP := /cygdrive/c/Programs/cygwin/bin
CPPFLAGS := -P -traditional
LD := $(FC)
LDFLAGS :=
AR := ar
ARFLAGS := -r
MKDIR := mkdir -p
RM := rm -f
RANLIB := ranlib
PERL := perl
TEST := test

MDEPFLAGS := --cpp --fext=f90 --file=- --objdir=$(SCRATCH_DIR)

#
# Library locations, can be overridden by environment variables.
#

MCT_LIBDIR ?= /usr/local/mct/lib
NETCDF_INCDIR ?= /usr/include
NETCDF_LIBDIR ?= /usr/local/lib

CPPFLAGS += -I$(NETCDF_INCDIR)
LIBS := -L$(NETCDF_LIBDIR) -lnetcdf

ifdef USE_ARPACK
ifdef USE_MPI
PARPACK_LIBDIR ?= /usr/local/lib
LIBS += -L$(PARPACK_LIBDIR) -lparpack
endif
ARPACK_LIBDIR ?= /usr/local/lib
LIBS += -L$(ARPACK_LIBDIR) -larpack
endif

ifdef USE_DEBUG
FFLAGS += -g -fbounds-check
else
FFLAGS += -O3 -ffast-math
endif

ifdef SWAN_COUPLE
FFLAGS += -I/usr/local/mct/include
LIBS += -L$(MCT_LIBDIR) -lmct -lmpeu
endif

#
# Set free form format in source files to allow long string for
# local directory and compilation flags inside the code.
#

$(SCRATCH_DIR)/mod_ncparam.o: FFLAGS += -ffree-form
$(SCRATCH_DIR)/mod_strings.o: FFLAGS += -ffree-form

#
# Supress free format in SWAN source files since there are comments
# beyond column 72.
#

ifdef SWAN_COUPLE

$(SCRATCH_DIR)/ocpcre.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/ocpids.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/ocpmix.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swancom1.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swancom2.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swancom3.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swancom4.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swancom5.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swanmain.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swanout1.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swanout2.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swanparll.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swanpre1.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swanpre2.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swanser.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swmod1.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swmod2.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swmod3.o: FFLAGS += -ffixed-form

endif

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

#2 Post by m.hadfield » Fri May 11, 2007 2:47 am

Start a Bash shell in the directory at the head of your ROMS tree, i.e. the one containing a single file (makefile) and a number of subdirectories (Atmosphere, Compilers, ...). Then type:

Code: Select all

export FORT=g95
make
You should get a more interesting result :wink:

The reason make reported no targets in CYGWIN-g95.mk is that there aren't any. This file contains only platform-specific stuff. It is brought into the make process via an include statement in makefile.

The standard makefile contains

Code: Select all

ROMS_APPLICATION ?= UPWELLING
There are various ways to change this. One is to override it from the command line, eg:

Code: Select all

make ROMS_APPLICATION=LMD_TEST
PS: You'll need Gnu make version 3.81 or 3.82.

jcwarner
Posts: 798
Joined: Wed Dec 31, 2003 6:16 pm
Location: USGS, USA

#3 Post by jcwarner » Fri May 11, 2007 3:06 am

you need to modify the makefile, located in the root directory.
This is where you would set
FORT ?= g95
and other options, such as mpi or openmp.

You may not need to modify CYGWIN-g95.mk.
You can search this discussion board for other posts about the makefile, and compiler files.

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

#4 Post by m.hadfield » Fri May 11, 2007 3:17 am

Following on from John's comment, a little more information about how make file variables are set may be helpful here. The relevant part of the Gnu documentation is here:

http://www.gnu.org/software/make/manual ... tml#Values

The latest ROMS make files use the "?=" operator to set a lot of their variables, eg:

Code: Select all

ROMS_APPLICATION ?= UPWELLING
FORT ?= PGI
These will be overridden by values specified on the command line and by environment variables. So to build the BENCHMARK test case compiled with g95 you could do

Code: Select all

export ROMS_APPLICATION=BENCHMARK
export FORT=PGI
make
or you could do

Code: Select all

make ROMS_APPLICATION=BENCHMARK FORT=PGI
Or you could modify the make file of course, but I think the idea with the new system is that you don't have to do that.

The widespread use of "?=" is pretty recent. Previously most of the same variables were set with the ":=" operator. These could be overridden via the make command line but not by environment variables.

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

#5 Post by arango » Fri May 11, 2007 3:46 am

Alternatively, you can use the ROMS/Bin/build.sh script to compile your application. There is not need to change the makefile in this case.

My personal applications are structured as follows.

Code: Select all

   Projects/                      root directory
           /ias                   Intra-America Seas application
               /AFTE              adjoint finite time eigenmodes
               /ADsen             adjoint sensitivity
               /Data              input NetCDF files
               /Forward           nonlinear model, ensembles
               /FTE               tangent linear finite time eigenmodes
               /IS4DVAR           incremental, strong contraint 4DVar
               /OP                optimal perturbations
               /OBS               data assimilation observations
               /Sanity            adjoint/tangent sanity check
               /SOsemi            stochastic optimals, semi-norm
               /Symmetry          representer matrix symmetry check
               /W4DPSAS           weak constraint, 4D-PSAS
               /W4DVAR            weak constrain, indirect representers
I have a header (ias.h) and a build.sh in each of the above application directories. Notice that you can compile all of the above applications simulataneously. I removed Compilers/MakeDepend today. It is no longer under svn control and it is now located in the build directory specified in SCRATCH_DIR.

Post Reply