Re: Choice of programming language



Mark B wrote:
I was wondering what the programming language of preference currently
is for numerical integration work. Particularly for long time length
integrations such as in solar system dynamics where you might be
expected to integrate over perhaps 10^9 time steps and consume
considerable cpu time.


In the past it seemed that Fortran was the preferd language but was
wondering whether C++ or even Java would seriously be considered, and
if not, why not.

There is an important difference between FORTRAN and C/C++ semantics.
FORTRAN requires that a function not be secretly
handed the same variable under two different names.
An exception is allowed if it doesn't matter.
I think that some C/C++ compilers have pragmas or
other extensions that effectively make the same promise.
It allows optimizations that would not otherwise be safe.

That said, C/C++ allows at least one optimization that is difficult
to do in FORTRAN: aggregating data of different types.
Parallel arrays could double your cache
misses and require an extra register.
This could have changed. It's been a while since I used FORTRAN.
Whether it has or not,
tuning one's code to avoid cache misses can be interesting.

Whether java is sllooowwwww for real or just
by dogma probably depends on at least a couple things:
whether one has compiled to native code and
the kind of data structures one uses.
In java, an array of primitive types is an array of primitive types,
but an array of classes is an array of references.
In addition to adding a layer of indirection,
it raises locality (cache miss) issues.

In any case, if one is integrating over a billion iterations,
it's probably a good idea to pay attention to the numerical analysis.

.



Relevant Pages

  • Re: Who uses clapack?
    ... > functions like SUM and MAXVAL and the ability to use array sections ... > drastically change the meaning of a Fortran code. ... >>Have you ever seen those bills for a Fortran compiler for an ... engineering applications in the C and C++ languages. ...
    (comp.lang.fortran)
  • Re: Who uses clapack?
    ... > functions like SUM and MAXVAL and the ability to use array sections ... > drastically change the meaning of a Fortran code. ... >>Have you ever seen those bills for a Fortran compiler for an ... engineering applications in the C and C++ languages. ...
    (sci.math.num-analysis)
  • Re: Benchmarking APL
    ... with that of FORTRAN. ... APL a 400% gain in programming efficiency could be obtained with only ... Another good-for-APL array problem, vector convolution, gave these ... Tomcatv, one of the SPEC benchmarks, is more typical of large array ...
    (comp.lang.apl)
  • Re: Mixing C++/Fortran using Two-Dimensional Array
    ... not a subset as in Fortran. ... if you really need it you can get the effect by an array of TYPE ... the lowest-level base element pointer, which is all you actually need ... macros in C, although it can be difficult to find macro names that are ...
    (comp.lang.fortran)
  • Re: how to "translate" dynamic array in FORTRAN 90 to Java code?
    ... I am translating a Fortran program to Java code. ... is an array with size unspecified. ... I use Object array in Java to translate FORTRAN array. ...
    (comp.lang.java.programmer)

Loading