Help getting HelloMeshF77.F to run on GRUMMP

Mark Miller miller86 at llnl.gov
Tue Nov 3 13:17:30 CST 2009


Hi All,

In order to understand problems I introduced for Fortran interface as a
result of my recent change to iMesh.h, I went ahead and compiled one of
the Fortran examples I could find, HelloMeshF77.F against GRUMMP.

I learned a few things I want to share here and I have a question or two
also.

First, I did not understand this until yesterday, but we're using
FC_FUNC and CPP to map symbols in C language to the Fortran name mangled
equivalent bindings. So, the result of this is that the actual
implementation's .a file has imesh_newmesh__ defined but not
iMesh_newMesh. This is a bit odd. For example, debugging C code means I
set break points on imesh_newmesh__ and not iMesh_newMesh. That is a
little strange but maybe ok.

I guess I understand why we're doing it that way. Fortran doesn't have
the equivalent of CPP. So, we can't very well do this kind of magic with
Fortran. Or can we? Why not use CPP and code-generate the Fortran
interface from the C interface resulting in an implementation having,
for example, both iMesh_newMesh (C func.) and imesh_newmesh__ defined in
the resulting .a/.so files. I think this would be easy using CPP. Every
fortran func would immediately just turn around and call its C
equivalent....

void imesh_newmesh__(...) { iMesh_newMesh(...); }

Next, there is an iMesh_f.h file required to compile HelloMeshF77.F but
I could NOT find it where I thought it should be. I found it
in ./Papers/iMesh07/FindConnect/iMesh_f.h. Shouldn't this be 'next to'
iMesh.h. Also, shouldn't we just code generate this file from iMesh and
likewise from iBase? I have code that does this kind of thing for Silo
library.

Next, why is HelloMeshF77.F written using the C-like symbol names for
the functions? It uses iMesh_newMesh() knowing that fortran compiler
will mangle case. It is a bit unnatural. Why not just use the 'natural'
fortran thing? imesh_newmesh()

Next, in order to compile HelloMeshF77.F, I needed to compile with g77
but link with g++. Now, I did NOT use the Makefile.noatuconf there. I
just compiled things manually. But, I think this is right as GRUMMP is a
C++ implementation under the covers. And, we cannot link it correctly
without a C++ compiler. Do others agree? Or, did I do something wrong?

Finally, I cannot get HelloMeshF77 to run successfully. GRUMMP is always
trying to add '.vmesh' to the filename. That is fine, but try as I
might, no matter what I do, iMesh_load() winds up getting some scrambled
name.

Mark



-- 
Mark C. Miller, Lawrence Livermore National Laboratory
email: mailto:miller86 at llnl.gov
(M/T/W) (925)-423-5901 (!!LLNL BUSINESS ONLY!!)
(Th/F)  (530)-753-8511 (!!LLNL BUSINESS ONLY!!)



More information about the tstt-interface mailing list