[MITgcm-support] Installation of gfortran and netcdf
Dr Nick Rogan
nrogan at geomar.de
Thu Jan 15 05:57:00 EST 2015
Hi Martin,
I'm sure your absolutely right. I ended up getting in a massive twist
and probably couldnt see the wood for the trees. However, I seem to have
managed to get it going by starting from scratch and following some good
advice from Ruth. I'm not sure if her advice came to the list, so here
it is and I attach the optfile which also works for me:
/Hi Nick,
This can be a total pain. I use macports as a package manager, and I've
pasted below the commands that I used to get all the software installed
for running the MITgcm on my MBP. I've also attached my optfile.
Hope this helps,
Ruth
1: sudo port install gcc48 +universal
2: sudo port install mpich +gcc48
to query available binaries: port select --list gcc
3: sudo port select --set gcc mp-gcc48
4: sudo port select --set mpi mpich-mp-fortran
5: sudo port install netcdf
6: sudo port install netcdf-fortran
7: sudo port install nco/
I downloaded macports (which has a very efficient self-install package) and then added it to my path using the following advice from Ruth as I couldnt find where macports was installed:
/Hi Nick,
I used the .pkg - way easier. My port installation
is at:
/opt/local/bin/port
Is it possible that it isn't in your path? Try
echo $PATH
if it's not there, then you can add it to your path in your .bashrc by
adding a line like
# set path
PATH=/opt/local/bin:$PATH
export PATH
Ruth/
When changing .bashrc or similar files it's obviously important to open a new termianl to allow the changes to take effect.
I have numbered the above commands myself. I should note I choose to install gcc46 instead of gcc48, as as far as I know gcc46 was the last one compatible with my system. The first step took a long time, and was disrupted when my internet dropped out while macports was trying to download something. Repeating the command it continued and completed successfully.
The second step crashed for me. I cleaned the directory:
1b: sudo port clean mpich-default
I queried the available binaries and saw this:
gcc40
gcc42
mp-gcc46
and altered command 2 to:
2b: sudo port install mpich +mp-gcc46
this worked for me and the remaining commands all worked. I have now compiled the MITgcm and everything seems to be fine. No error messages, no complaints, so thank you very much Ruth! And thanks everyone else for the advice.
Hope my response helps others struggling with this problem. Once this project is done I guess I'd better upgade my systems, then I'm sure I'll be back on here with more issues!
Regards,
Nick
On 15/01/2015 11:30, Martin Losch wrote:
> Nick,
>
> the fact that all of your test fail usually means that something very simple (but fundamental) goes wrong (like the cpp command fails and no *.f can be generated or similar). I suggest to have a look at genmake.log; there you’ll find the actual error messages of the c-preprocessor cpp and the compilers.
>
> Did you try to compile and run simple “hello world” programs with your gfortran?
>
> Martin
>
>
> On Jan 14, 2015, at 1:40 PM, Nick <nrogan at geomar.de> wrote:
>
>> Hi everyone,
>>
>> I feel rather daft resorting to the mailing list for what should be such a simple task. However, I've spent the last four days trying to sort it out and I just can't keep going.
>>
>> I have lots of experience running the MIT on my iMac and macbook pro, the latter of which I set up within an hour myself by installing gfortran, hdf and netcdf before compiling the MITgcm successfully.
>>
>> My experience of installation was a couple of years ago and due to a short term post, a crippled iMac and a change of institution I need to install the MIT on my personal MACbook to run some simple simulations.
>>
>> So, I am running Mac OS X 10.6 and just can not get gfortran and netcdf installed, or if they are installed genmake2 does not acknowledge their existence. I have tried compiling binaries from sourceforge, gcc and others. I have tried apple installers, everything and none of them seem to give the required result.
>>
>> Can someone take a couple of minutes out of their day and give me some advice?
>>
>> This is no doubt something simple like the location of the libraries or pointing a particular package to the executable, but I just can't get my head around it.
>>
>> I think I've installed gfortran, though I couldnt find anywhere how I should test it's installation. Version information and manual information come onto the terminal when I request them.
>>
>> I pointed the mitgcm optfile at the gfortran executable at /usr/local/bin/gfortran. But genmake2 does not acknowledge that fortran exists:
>>
>> === Checking system libraries ===
>> Do we have the system() command using /usr/local/bin/gfortran... no
>> Do we have the fdate() command using /usr/local/bin/gfortran... no
>> Do we have the etime() command using /usr/local/bin/gfortran... no
>> Can we call simple C routines (here, "cloc()") using /usr/local/bin/gfortran... no
>> Can we unlimit the stack size using /usr/local/bin/gfortran... no
>> Can we register a signal handler using /usr/local/bin/gfortran... no
>> Can we use stat() through C calls... no
>> Can we create NetCDF-enabled binaries... no
>>
>> Any advice?
>>
>> Hopefully someone can solve this problem for me in seconds.
>>
>> Kind regards,
>>
>> Nick Rogan
>>
>>
>>
>>
>> _______________________________________________
>> MITgcm-support mailing list
>> MITgcm-support at mitgcm.org
>> http://mitgcm.org/mailman/listinfo/mitgcm-support
>
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-support
--
Kind regards,
Nick
-------------------------------------
Dr Nick Rogan
GEOMAR
Helmholtz-Centre for Ocean Research Kiel
Wischhofstrasse 1-3 / Room 12/330
D-24148 Kiel, Germany
-------------------------------------
nrogan at geomar.de
www.geomar.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mitgcm.org/pipermail/mitgcm-support/attachments/20150115/1c7afb2f/attachment-0001.htm>
-------------- next part --------------
#!/bin/bash
#
# $Header: /u/gcmpack/MITgcm/tools/build_options/darwin_amd64_gfortran,v 1.3 2012/06/22 17:04:39 jmc Exp $
# $Name: $
# tested on MacBook Pro with Snow Leopard & Snow Lion
# ==> need to update folowing comments:
# on 20-Nov-2009
# gcc and gfortran obtained from
# http://hpc.sourceforge.net/
# http://prdownloads.sourceforge.net/hpc/gcc-snwleo-intel-bin.tar.gz?download
# http://prdownloads.sourceforge.net/hpc/gfortran-snwleo-intel-bin.tar.gz?download
#-------
# need to set NETCDF_ROOT to where the NetCDF is installed, e.g.:
# export NETCDF_ROOT='/usr/NetCDF'
# MPI : need to set environment variable MPI_INC_DIR to the include
# directory of your MPI implementation
#-------
# run with OpenMP: needs to set environment var. OMP_NUM_THREADS
# and generally, needs to increase the thread stack-size:
# - sh,bash:
# > export OMP_NUM_THREADS=2
# > export GOMP_STACKSIZE=400m
# - csh,tcsh:
# > setenv OMP_NUM_THREADS 2
# > setenv GOMP_STACKSIZE 400m
#-------
if test "x$MPI" = xtrue ; then
CC=mpicc
FC=mpif77
F90C=mpif90
LINK=$F90C
else
CC=gcc
FC=gfortran
F90C=gfortran
LINK=$F90C
fi
FC_NAMEMANGLE="#define FC_NAMEMANGLE(X) X ## _"
S64='$(TOOLSDIR)/set64bitConst.sh'
DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR'
CPP='/usr/bin/cpp -traditional -P'
GET_FC_VERSION="--version"
EXTENDED_SRC_FLAG='-ffixed-line-length-132'
OMPFLAG='-fopenmp'
MPI_INC_DIR='/opt/local/include/mpich-mp'
NETCDF_ROOT='/opt/local' # needs to point to netcdf.inc and libnedcdf.a
#MAKEDEPEND=tools_xmakedepend
#Following flag is needed when using 32-bit gfortran with 64-bit gcc,
#as can be the case right after switching to Snow Leopard.
#CFLAGS='-arch i386'
NOOPTFLAGS='-O0'
NOOPTFILES=''
FFLAGS="$FFLAGS -fconvert=big-endian"
# for big objects:
#FFLAGS="$FFLAGS -fPIC"
#- might want to use '-fdefault-real-8' for fizhi pkg:
#FFLAGS="$FFLAGS -fdefault-real-8 -fdefault-double-8"
# For IEEE, use the "-ffloat-store" option
if test "x$IEEE" = x ; then
FFLAGS="$FFLAGS -Wunused -Wuninitialized"
FOPTIM='-O3 -ftree-vectorize -funroll-loops'
NOOPTFLAGS='-O2 -funroll-loops'
# NOOPTFILES='gad_c4_adv_x.F gad_u3_adv_x.F'
else
FFLAGS="$FFLAGS -Wunused"
FOPTIM='-O0'
fi
INCLUDEDIRS=''
INCLUDES=''
LIBS=''
if [ "x$NETCDF_ROOT" != x ] ; then
INCLUDEDIRS="${NETCDF_ROOT}/include"
INCLUDES="-I${NETCDF_ROOT}/include"
LIBDIR="${NETCDF_ROOT}/lib"
LIBS="-L${NETCDF_ROOT}/lib -lnetcdf -lcurl"
fi
if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then
INCLUDES="$INCLUDES -I$MPI_INC_DIR"
INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR"
MPIINCLUDEDIR="$MPI_INC_DIR"
MPI_HEADER_FILES='mpif.h mpiof.h'
MPI_HEADER_FILES_INC='./mpi_headers/mpif.h ./mpi_headers/mpiof.h'
fi
More information about the MITgcm-support
mailing list