in your opinion

M

Malcolm McLean

2 -- Which Fortran Standard you consider as "the best language
      for heavy number crunching"?
Fortran 77. MPI supports it.

3 -- Would it be difficult to interface Fortran and C code once I have
      written a long and complex program-project in Fortran (or C) ?
Yes and no. The rules are quite simple (basically a Fortran parameter
becomes a pointer parameter in C).

The problem is that Fortran indexes from 1 to N, C from 0 to N-1, and
matrices are referenced row-major rather than column-major. In
practice these turn interfacing into a nightmare - the human mind
can't make both transitions at once.
 
S

Seebs

People who know the standard inside out often produce code with bugs.
I know of nobody who has never checked in code with a bug.

Sure, but your claim was that they produced this bad code because they
read the standard. Got any examples?
These bugs can be difficult to trace if the behaviour of the code
relies on little-known quirks of the C compiler, particularly if the
person with the job of correcting the program isn't basically a C
programmer.

And that's a hell of a lot more likely from someone who knows assembly, and
thus thinks he knows what's happening under the hood (but is wrong), than from
someone who's trying to write portably without relying on quirks of a given
compiler.

-s
 
I

Ian Bush

Fortran 77. MPI supports it.

Ermmm, not nowadays. Fortran 95 is the way to go if you want to keep
you sanity. For a list of compilers and what is supported

http://www.polyhedron.com/

is not a bad place to start.
Yes and no. The rules are quite simple (basically a Fortran parameter
becomes a pointer parameter in C).

The problem is that

by default
Fortran indexes from 1 to N,

but you can change it to whatever you like
C from 0 to N-1, and
matrices are referenced row-major rather than column-major. In
practice these turn interfacing into a nightmare - the human mind
can't make both transitions at once.

As for interfacing C and Fortran there is a standard method in Fortran
2003. While 2003 implementations are not universal yet,
interoperability with C is all but. See

http://www.fortranplus.co.uk/resources/fortran_2003_2008_compiler_support.pdf

for example,

Ian
 
B

Ben Bacarisse

Kenneth Brody said:
BASIC was my first as well. (And "Basic BASIC" was my first
programming book.) APL was my second. Along the way, there was
FORTRAN, COBOL, Snobol, Sitbol,

Spitbol, presumably.
LISP, several assembly and
batch/script/jcl languages, and probably some I've completely
forgotten about.

<snip>
 
B

blmblm

[ snip ]

As of MPI-2 (1997) the official specification for the Fortran
language binding is tied to Fortran 90 rather than FORTRAN 77, and
I believe two major no-cost implementations (OpenMPI and MPICH2)
claim to fully support MPI-2. Still, whether that means that
MPI plays as well with F90 as it does with F77 -- I'm not sure.
Lots of details in the spec (findable at http://www.mpi-forum.org/).
This illustrates why F77 is not a good choice. First of all, the
later versions of Fortran let you choose the base index. I think
that came in with F90.

F77, actually. (That's what I remembered, and it appears to check
out with the standard at http://www.fortran.com/F77_std/f77_std.html.)

[ snip ]
 
R

Richard Bos

Malcolm McLean said:
I think it's best to know assembly - for any processor - before
learning C. A lot of C only makes sense if you understand what's going
on behind the scenes. Pointers, in particular, cause trouble to
newbies without an assembly background.

This is such bad advice that I hardly know where to start. But start I
will: to any assembly programmer out there, a pointer (or rather,
"address register") is something you can point anywhere, willy-nilly,
all over the place, recklessly, object boundaries be damned. And then
they go on and bring that same attitude to C. _Not_ advisable.

Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,085
Messages
2,570,597
Members
47,218
Latest member
GracieDebo

Latest Threads

Top