GithubHelp home page GithubHelp logo

Comments (4)

rgknox avatar rgknox commented on June 12, 2024

Hi Hamid,

I think the easiest solution to this problem is to use the "mpif90" wrapper function that calls gfortran. A wrapper is kind of like an alias, that makes a compilcated command very simple. For instance, I use openmpi for MPI communications, and it is built with gfortran. If I execute the command "mpif90 -show" in my terminal window, it will show me what it's equivalent command string is, as if it was passed to compile a program:

rgknox@eddi:$ mpif90 -show

gfortran -I/home/rgknox/local/openmpi-1.8.1/include -pthread -I/home/rgknox/local/openmpi-1.8.1/lib -Wl,-rpath -Wl,/home/rgknox/local/openmpi-1.8.1/lib -Wl,--enable-new-dtags -L/home/rgknox/local/openmpi-1.8.1/lib -lmpi_usempi -lmpi_mpifh -lmpi

All that stuff that comes after the gfortran command tell the compiler where to find external libraries and how exactly to compile. So you need to work with your system administrator to find out what type of MPI is available on your system, and once you have identified that you must have the binaries (mpif90) and the libraries that come with it, in your path.

See below I have the F_COMP variable in my include.mk.opt file set to mpif90, and the C_COMP variable set to mpicc.

F_COMP=mpif90
F_OPTS=-g -ffree-line-length-none -fno-whole-file -O2
C_COMP=mpicc
C_OPTS=-g -O2
LOADER=mpif90
LOADER_OPTS=${F_OPTS}
C_LOADER=mpicc
LIBS=
MOD_EXT=mod

Note that you will run into a similar issue when the build process tries to incorporate the HDF5 libraries and functionality. In this case you have to make sure that the HDF5_INCS variable and HDF5_LIBS variable are set to the correct path on your machine. See http://www.hdfgroup.org/HDF5/ for more info.

from ed2.

rgknox avatar rgknox commented on June 12, 2024

Another comment:

For some reason, the build process will tell you it can't find mpif.h and some other libraries, but these are just false positives and can be ignored. This is generated during my compile:

./generate_deps.sh ../..
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: mpif.h
Can't find file: stdio.h
Can't find file: math.h
Can't find file: stdlib.h
Can't find file: malloc/malloc.h
Can't find file: sys/malloc.h
Can't find file: malloc.h
Can't find file: stdlib.h
Can't find file: errno.h
Can't find file: string.h
Can't find file: ctype.h
Can't find file: dirent.h
Can't find file: string.h
=== Finished dependencies ===

Do you get any specific error messages during compile time?

from ed2.

hamiddashti avatar hamiddashti commented on June 12, 2024

Thanks for your response.
Actually i get the " Can't find file: mpif.h " error when i am trying to compile the ED model downloaded from Moorcroft Lab website. But when i compile the BRAMS version downloaded from GitHub i don't get any more that error. however in BRAMS version the compiling error is something related to "Landuse_input.f90" as follow:
.
.
.
cp -f /home/hamid/opt/source/ED2-master/BRAMS/src/mksfc/mem_mksfc.f90 mem_mksfc.f90
mpif90 -c -O3 -ffree-line-length-none -I/home/hamid/opt/source/ED2-master/BRAMS/src/include -I/home/hamid/opt/source/hdf5-1.8.14/build/include -DRAMS_MPI mem_mksfc.f90
rm -f mem_mksfc.f90
cp -f /home/hamid/opt/source/ED2-master/BRAMS/src/mksfc/landuse_input.F90 landuse_input.F90
mpif90 -c -DUSE_INTERF=1 -DUSENC=0 -DPC_GFORTRAN -DUSE_HDF4= -DUSE_HDF5=1 -DUSE_MPIWTIME=1 -DCOUPLED -O3 -ffree-line-length-none -I/home/hamid/opt/source/ED2-master/BRAMS/src/include -I/home/hamid/opt/source/hdf5-1.8.14/build/include -DRAMS_MPI -DUSE_COLLECTIVE_IO=0 landuse_input.F90
landuse_input.F90:1207:0: error: #if with no expression
#if USE_HDF4
^
make[1]: *** [landuse_input.o] Error 1
make[1]: Leaving directory `/home/hamid/opt/source/ED2-master/BRAMS/build/bin'
make: *** [all] Error 2

And here is my address to HDF5:
HDF5_INCS=-I/home/hamid/opt/source/hdf5-1.8.14/build/include
HDF5C_INCS=-I/home/hamid/opt/source/hdf5-1.8.14/build/include
HDF5_LIBS=-lz /home/hamid/opt/source/hdf5-1.8.14/build/lib/libhdf5_fortran.a
/home/hamid/opt/source/hdf5-1.8.14/build/lib/libhdf5.a
/home/hamid/opt/source/hdf5-1.8.14/build/lib/hdf5_hl.a
/home/hamid/opt/source/hdf5-1.8.14/build/lib/libhdf5hl_fortran.a

Thanks

from ed2.

DanielNScott avatar DanielNScott commented on June 12, 2024

This is essentially a wild guess, but it looks like the issue might be the omission of any sort of HDF4 flag I've italicized below...

cp -f /home/hamid/opt/source/ED2-master/BRAMS/src/mksfc/landuse_input.F90 landuse_input.F90
mpif90 -c -DUSE_INTERF=1 -DUSENC=0 -DPC_GFORTRAN -DUSE_HDF4= -DUSE_HDF5=1 -DUSE_MPIWTIME=1 -DCOUPLED -O3 -ffree-line-length-none -I/home/hamid/opt/source/ED2-master/BRAMS/src/include -I/home/hamid/opt/source/hdf5-1.8.14/build/include -DRAMS_MPI -DUSE_COLLECTIVE_IO=0 landuse_input.F90

Which is to say it looks like the compiler simply doesn't know how to interpret 'USE_HDF4'. Seems reasonable anyway.

from ed2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.