Is C faster than fortran?

N

Nomad.C

Hi
I've been thinking of learning Fortran as number crunching kinda
language for my Physics degree......but then looking around the
internet, people are saying that the libraries/ Algorithms once used
for number crunching is now slowly converting into C, so do you think
I should stick with C, since I know C already, or should I proceed
learning fortran??

Any advice??
Thanks
Chris
 
R

Richard Harter

Hi
I've been thinking of learning Fortran as number crunching kinda
language for my Physics degree......but then looking around the
internet, people are saying that the libraries/ Algorithms once used
for number crunching is now slowly converting into C, so do you think
I should stick with C, since I know C already, or should I proceed
learning fortran??

This is a bit off topic, but:

There was a thread on the perceived merits of Fortran for scientific
programming in comp.fortran this month in which various parties gave
their views. I posted a summary there and in comp.lang.misc. You could
google for the latter - the title was "The merits of fortran" and the
date was March 14 this annum.

Briefly, though, Fortran is often faster for number crunching and is
probably a more pleasant language to use for that purpose. Besides it's
always worthwhile learning another language. If you do tackle it,learn
Fortran 95 - the older versions are, ah, antique.
 
C

Chris Torek

I've been thinking of learning Fortran ...

Learning additional computer languages is often good. Note (as
someone else did) that there are lots of different versions of
Fortran, though. The current standard is F95.

As for the question in the "subject" line, "is C faster than
fortran?": the answer is the same as the answer to the question,
"is chocolate ice cream tastier than strawberry?".
 
R

Richard Heathfield

Chris Torek said:

As for the question in the "subject" line, "is C faster than
fortran?": the answer is the same as the answer to the question,
"is chocolate ice cream tastier than strawberry?".

And of course the answer depends on the quality of the chocolate and
whether real strawberries are used. It's actually getting quite
difficult to find strawberry-*flavoured* ice cream in UK supermarkets,
let alone ice cream made with actual strawberries.

Using this reasoning, I am forced to the inevitable conclusion that C is
faster, except when it isn't.
 
N

Nelu

Chris Torek said:



And of course the answer depends on the quality of the chocolate and
whether real strawberries are used. It's actually getting quite
difficult to find strawberry-*flavoured* ice cream in UK supermarkets,
let alone ice cream made with actual strawberries.

I work 3 miles away from Ben & Jerry's original factory. They'll have
their annual Free Cone Day in April or May. Care to taste some
Strawberry Cheesecake Icecream? You can also visit Canada, it's two
hours away :)).
Using this reasoning, I am forced to the inevitable conclusion that C is
faster, except when it isn't.

GSL is a nice topping...
 
U

user923005

Hi
I've been thinking of learning Fortran as number crunching kinda
language for my Physics degree......but then looking around the
internet, people are saying that the libraries/ Algorithms once used
for number crunching is now slowly converting into C, so do you think
I should stick with C, since I know C already, or should I proceed
learning fortran??

The two main competitors here are C++ and Fortran. Fortran has been
discussed elsethread.
See also (for instance):
http://portal.acm.org/citation.cfm?id=615718
http://www.oonumerics.org/oon/

Of course, you can do high performance work in other languages and C
is not an exception.
 
L

Lane Straatman

user923005 said:
The two main competitors here are C++ and Fortran. Fortran has been
discussed elsethread.
See also (for instance):
http://portal.acm.org/citation.cfm?id=615718
http://www.oonumerics.org/oon/

Of course, you can do high performance work in other languages and C
is not an exception.
Those are both c++ links. The time you lose there is not during execution,
but development. Their standard is significantly thornier than is C's.
 
M

Malcolm McLean

I've been thinking of learning Fortran as number crunching kinda
language for my Physics degree......but then looking around the
internet, people are saying that the libraries/ Algorithms once used
for number crunching is now slowly converting into C, so do you think
I should stick with C, since I know C already, or should I proceed
learning fortran??
It is a lot easier to build an optimising Fortran 77 compiler than an
optimising C compiler, largely because of the aliasing problem, but also
because call by reference eliminates a lot of overhead.

I have spent far too much of my time translating Fortan 77 programs to C,
because although the Fortran will crunch the numbers faster, it is much
harder to make algorithmic improvements. Then of course I have nearly twenty
years' experince with C as opposed to one and a half with Fortran.

However if you are going to do serious physics-based programming you will
have to learn Fortran some time. You can't always choose the language to
program in, for lots of reasons, technical and social.
 
R

Richard Tobin

Chris Torek said:
As for the question in the "subject" line, "is C faster than
fortran?": the answer is the same as the answer to the question,
"is chocolate ice cream tastier than strawberry?".

But the answer to that is obviously "yes", so I don't see how it
applies.

-- Richard
 
L

Lane Straatman

Richard Heathfield said:
Chris Torek said:
The question would seem to be regional. Chris Torek, IIRC, lives in
cream-based Valley, with Cream of Weber and Aggie Ice Cream.
And of course the answer depends on the quality of the chocolate and
whether real strawberries are used. It's actually getting quite
difficult to find strawberry-*flavoured* ice cream in UK supermarkets,
let alone ice cream made with actual strawberries.
You can't overlook the portability of Italian ice cream in Europe. It is
not cream-based and, in many persons' informed opinion, tastier. As a
consequence, these people ingest fewer calories and are therefore quicker to
the street vendors than their American counterparts.
Using this reasoning, I am forced to the inevitable conclusion that C is
faster, except when it isn't.
How would I put "ice cream" in an array, run through the letters as chars,
and have an integer tab to represent their total?
 
S

Stephen Sprunk

Malcolm McLean said:
....
However if you are going to do serious physics-based programming
you will have to learn Fortran some time. You can't always choose the
language to program in, for lots of reasons, technical and social.

There's the rub. If you're in the math or physics communities, you're not
going to get very far without at least _learning_ FORTAN. That's what a lot
of the existing code (which you'll want to modify or reuse) is going to be
in, and it may be all many of your associates know. The academic world
thrives on sharing with your peers, and if you aren't using the same
language as the people you need to share with, you're going to have a harder
time solving your problems.

When in Rome, do as the Romans do.

(Note that the above has absolutely nothing to do with technical reasons to
use one or the other or their relative speeds. You're probably better off
asking in comp.lang.fortran for that kind of stuff.)

S
 
S

SM Ryan

# Hi
# I've been thinking of learning Fortran as number crunching kinda
# language for my Physics degree......but then looking around the
# internet, people are saying that the libraries/ Algorithms once used
# for number crunching is now slowly converting into C, so do you think
# I should stick with C, since I know C already, or should I proceed
# learning fortran??

Fortran is designed to simplify optimisers; it has more potential
for running faster. What the compiler actually does is another matter.
 
U

user923005

Those are both c++ links. The time you lose there is not during execution,
but development. Their standard is significantly thornier than is C's.

That is true, of course. However, I am not aware of any recent C work
for high performance numeric computation. Hence my comment "The two
main competitors here are C++ and Fortran."

A bugaboo when porting from Fortran to C (and vice versa):
The row/column access order that is optimal in one language is not in
the other.
So if you port a program from one language to another, there are
always lots of manual steps if you want it to run fast when you are
done.
 
C

CBFalconer

Nelu said:
I work 3 miles away from Ben & Jerry's original factory. They'll
have their annual Free Cone Day in April or May. Care to taste
Strawberry Cheesecake Icecream? You can also visit Canada, it's
two hours away :)).

Do it soon. Bush's inane passport moves are going to virtually cut
off international travel unless somebody rapidly gains sanity.
This will probably also reduce the viability of the Burlington
economic area. It's going to play hell with Calais ME.

(Note for other nationalities - the areas involved are Burlington
VT. USA and Montreal PQ Canada. All accessible by ship, Atlantic,
St. Lawrence, and Richelieu/Lake Champlain for Burlington.)
 
T

Tim Prince

user923005 said:
On Mar 26, 12:27 pm, "Lane Straatman" <[email protected]> wrote:
That is true, of course. However, I am not aware of any recent C work
for high performance numeric computation.

Did you ever hear of C99? Most of the performance features are
implemented in current compilers. Much as I hate to admit it, this puts
C at least even with Fortran in respect of availability of compilers
supporting latest standard features.
A bugaboo when porting from Fortran to C (and vice versa):
The row/column access order that is optimal in one language is not in
the other.
So if you port a program from one language to another, there are
always lots of manual steps if you want it to run fast when you are
done.
Back in the early days of C, there were plenty of automatic tools, both
commercial and open source. f2c may be as antiquated as C89, but it
avoids performance snafus on translation of Fortran array syntax.
 
L

Lane Straatman

CBFalconer said:
Do it soon. Bush's inane passport moves are going to virtually cut
off international travel unless somebody rapidly gains sanity.
This will probably also reduce the viability of the Burlington
economic area. It's going to play hell with Calais ME.

(Note for other nationalities - the areas involved are Burlington
VT. USA and Montreal PQ Canada. All accessible by ship, Atlantic,
St. Lawrence, and Richelieu/Lake Champlain for Burlington.)
The Bush policy is solid in this respect. What I wouldn't give to see our
secretary of state affirm this instead of prattle on with her Pollyanna Iraq
crappola.
 
N

Nelu

Do it soon. Bush's inane passport moves are going to virtually cut
off international travel unless somebody rapidly gains sanity.
This will probably also reduce the viability of the Burlington
economic area. It's going to play hell with Calais ME.

(Note for other nationalities - the areas involved are Burlington
VT. USA and Montreal PQ Canada. All accessible by ship, Atlantic,
St. Lawrence, and Richelieu/Lake Champlain for Burlington.)

I am not a US resident so I need a Canadian VISA on my passport
anyway... and it's up from $75 to $100 right now, I believe. But let
me know if you happen to visit the Stowe - Waterbury area.

.... and stop with the politics. Everyone is a liberal in VT and I'm
growing tired of it :)) (Oh, it's also OT).
 
N

Nelu

Do it soon. Bush's inane passport moves are going to virtually cut
off international travel unless somebody rapidly gains sanity.
This will probably also reduce the viability of the Burlington
economic area. It's going to play hell with Calais ME.

(Note for other nationalities - the areas involved are Burlington
VT. USA and Montreal PQ Canada. All accessible by ship, Atlantic,
St. Lawrence, and Richelieu/Lake Champlain for Burlington.)

I am not a US resident so I need a Canadian VISA on my passport
anyway... and it's up from $75 to $100 right now, I believe. But let
me know if you happen to visit the Stowe - Waterbury area.

.... and stop with the politics. Everyone is a liberal in VT and I'm
growing tired of it :)) (Oh, it's also OT).
 
A

Al Balmer

Do it soon. Bush's inane passport moves are going to virtually cut
off international travel unless somebody rapidly gains sanity.
[OT}
Is there some reason you aren't eligible for a passport? IMO, this
should have been done years ago. BTW, Bush is also lobbying to add 22
more countries to the visa waiver program, which certainly won't hurt
international travel.
[OT]
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top