iraf-v216 · Code · Issues (50) · Pull requests (81)
iraf.net Issue #8
Upgrade IRAF to use fortran 95
open joequant opened this issue on 2017-04-30 · 3 comments
joequant commented on 2017-04-30
This is a placeholder for upgrading IRAF to handle fortran 95.
In principle, this should be simple since everything gets compiled to assembly, but there is a big gotcha, and everything accept for one blocker works if you just replace the calls to f77 with a f95 native compiler.
IRAF uses an internal dynamic memory system, and to locate the base of the dynamic memory, IRAF uses a dummy array with an equivalence and does pointer arithmetic from that variable. The array is not a real array and is used only to get the base address of the dynamic memory.
However, this creates a problem since fortran 95 views this as an invalid statement since it is hand creating a dynamic memory system that is unnecesary in fortran 95.
Would like to throw out this issue to see if someone can come up with some fix. It would be a big enhancement to be able to use f95 with IRAF.
iraf commented on 2017-04-30
On Sat, Apr 29, 2017 at 10:13 PM, Joseph Wang wrote:
IRAF uses an internal dynamic memory system, and to locate the base of the
dynamic memory, IRAF uses a dummy array with an equivalence and does
pointer arithmetic from that variable. The array is not a real array and is
used only to get the base address of the dynamic memory.
Not quite: The mem common equivalence has it’s address fixed at zero (in
the zsvjmp.s file) so that IRAF pointers are a simple multiple of the
pointer address allocated in the iraf kernel (see unix$libc/kernel.h).
Support for this is gradually eroding in some compilers and we may be
forced to switch to using a dynamic base address, but this can be handled
in the iraf kernel and memio interface.
Would like to throw out this issue to see if someone can come up with some
fix. It would be a big enhancement to be able to use f95 with IRAF.
Fortran is used in as an intermediate language in the compilation of SPP
and by about 10% of the system in the form of legacy library code. There’s
no proven benefit that compiling this code with an f95 compiler would be
any faster and no new code being developed that would take advantage of F95
language features. Modifying the SPP compile chain to produce F95 code
endangers the stability of the system with no way to test for bugs being
introduced, and again with no proven benefit for the effort/risk. I’ve
experimented with things like using the Intel compilers or
platform-optimized build flags and haven’t seen enough speedup to warrant
either a new iraf architecture or the disruption of requiring a
non-standard compiler installation by the user.
F95 support could be done in an experimental fork by interested developers
but there are many more higher-priority items to be dealt with first.
joequant commented on 2017-04-30
1) The reason for using fortran 95 as a compilation system is that way people can start writing filters that use fortran95 functions. Fortran 95 is a vast improvement over F77, and the whole point is to set up the system so that people can generate new f95 code.
2) So we use travis ci to create an automated testing suite. That’s necessary in order to do anything non trivial
3) Nice thing about having more developers is that people can figure out what’s on their priority list
iraf commented on 2017-04-30
On Sun, Apr 30, 2017 at 1:16 PM, Joseph Wang wrote:
The reason for using fortran 95 as a compilation system is that way
people can start writing filters that use fortran95 functions. Fortran 95
is a vast improvement over F77, and the whole point is to set up the system
so that people can generate new f95 code.Fortran is not (and cannot be) used as a task development language, it is
used for math libraries like SLALIB. I don’t see any desire in the
community to develop new libraries and to specifically do so in F95. I
also don’t see any benefit to changing to F95 as an intermediate language
given what else needs to be changed to support it. If you want to put
effort into language support people will use, try python.
Last updated on 2017-04-30