aadler/Delaporte

Possible to avoid requiring `ieee_arithmetic`?

Closed this issue ยท 5 comments

@aadler ieee_arithmetic is not universally supported. If it can be avoided without sacrificing functionality, it is desirable to do so.

aadler commented

Sadly, I am well aware of that as you may be able to tell from the NEWS. However, the only platform with which I had a problem was Solaris SPARC due to its other-endianness. ieee_arithmetic is supported by all the remaining CRAN platforms as of Fortran 2008, which is over 15 years old at this point. Using those intrinsics makes the code more efficient (some functions can now be elemental) and easier to maintain. At this point, I am not willing to revert back to the more kludged code needed for passing NaN and Inf from R or rolling my own log_gamma. If it is an absolute impediment, version 8.0.3 and prior did not rely on ieee_arithmetic. Thank you.

@aadler Thank you. My concern is macOS on PowerPC, where GCC does not yet have ieee_arithmetic in either upstream or Macports โ€“ I have an experimental implementation of it, which seems to work fine, mostly, but requires some further testing. But yet, SPARC and MIPS (at least Irix) may be in trouble as well.

BTW, what was the problem on SPARC specifically? I think there is no ieee_arithmetic on SunOS or any other SPARC-specific system, but it should not be related to endianness at all. The problem is that gfortran lacks support for ieee_arithmetic for a number of platforms, and that has to be written from scratch.

P. S. I can actually modify Macports portfile for Delaporte so that it uses 8.0.3 on Darwin PowerPC until my ieee_arithmetic fixes are merged. That will solve the problem.

aadler commented

Now that I recall, it wasn't precisely a Solaris SPARC issue. When Windows was still on GCC 4.3, it didn't have ieee_artithmetic either. I was trying to use bit-patterns for NaN and Inf, but Solaris's endianness prevented that. I also made the mistake of passing logicals as C booleans, which SPARC didn't like either. I still pass the booleans as integers but now that I can use ieee_arithmetic, I can make the singleton d/p/q (and thus r) functions elemental (see [fc8e86b]) since I no longer need to call set_nan and set_inf from C.

Do you have any idea if ieee_arithmetic will enter PowerPC anytime soon?

@aadler The matter is discussed here: iains/darwin-toolchains-start-here#40
(Iain and FX Coudert are from GCC upstream.)

I was planning to submit patches in summer, in fact, but for unrelated reasons that got postponed. I will try making it this month.

The current issue is that some tests in gfortran test-suite fail, and there was a discrepancy between the two rewrites of ieee_arithmetic implementation: while overall performance improved, I got a couple of test cases failing which passed before. (If you could and have interest to take a look and possibly help us, that would be great.)