Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ctio fft1d causes endless loop #94

Closed
MarcosIAG opened this issue Oct 10, 2019 · 4 comments · Fixed by #95
Closed

ctio fft1d causes endless loop #94

MarcosIAG opened this issue Oct 10, 2019 · 4 comments · Fixed by #95
Labels
Dist:NOAO Releases distributed by NOAO (up to 2.16.1)

Comments

@MarcosIAG
Copy link

Fresh install of IRAF and external package CTIO.
Main IRAF make sysgen and CTIO mkpkg on ubuntu 16.04 (AMD 64).
MACH and IRAFARCH = linux64

fft1d enters an endless cpu busy state.

@olebole
Copy link
Member

olebole commented Oct 12, 2019

Although CTIO is involved, this seems to be an IRAF core problem -- it finally calls sys/vops/fftx.f or sys/vops/fftr.f for the actual FFT. Differently from the other FFT routines in IRAF, this one was not marked as originated by Numerical Recipes and therefore remained original (and not replaced by ffpack in 934ea80).
Could you provide a small example file and the exact CL commands that lead to the endless loop?
Do you know whether it worked for other versions (like the original 2.16.1, or under 32bit)?

@olebole olebole changed the title ctio fft1d ctio fft1d causes endless loop Oct 12, 2019
@MarcosIAG
Copy link
Author

MarcosIAG commented Oct 13, 2019 via email

@olebole
Copy link
Member

olebole commented Oct 22, 2019

Test files:

testfiles.tar.gz

@olebole
Copy link
Member

olebole commented Oct 31, 2019

OK, first debugging gives that fftx.f is really buggy. The variable l is defined as l(15) (implicitly as real):

dimension x(*), y(*), l(15)

However, then there is a loop over the index until 31:

iraf/sys/vops/fftx.f

Lines 84 to 87 in c2bb53e

90 do 110 j=1,31
l(j) = 1
if (j-n2pow) 100, 100, 110
100 l(j) = 2**(n2pow+1-j)

This just can't work at all, and did never work, and I wonder how this passed any test at NOAO. It just randomly overwrites the stack, or wherever the l array is placed. Originally, the loop went only as do 110 j=1,15, but was extended to 31 with version 2.14 (2006), with this (supposed) changelog entry:

iraf/doc/notes.v212

Lines 1913 to 1916 in c2bb53e

sys/vops/fftr.f
sys/vops/fftx.f
Increased the check for the power-of-2 dimension to 2^31 from the
current 2^15 (4/21/06, MJF)

One may guess that the second change in this diff was done on error:@mjfitzpatrick?
In principle, one could have two ways to "fix" this:

  1. Just revert the change for this loop and hope that everything is OK
  2. Try to replace the fftx.f and fftr.f code with the libfftw, which is nowalso used elsewhere in IRAF. I would suppose this would be the clean solution.

olebole added a commit to olebole/iraf that referenced this issue Oct 31, 2019
The hand-written code is buggy (see iraf-community#94) and it is unclear where it originated
from. Instead of trying to fix it, we use a reliable library instead.

fftpack is already used in IRAF replacing the fourier transformation that was
taken from the Numerical Recipes book.
olebole added a commit to olebole/iraf that referenced this issue Oct 31, 2019
The hand-written code is buggy (see iraf-community#94) and it is unclear where it originated
from. Instead of trying to fix it, we use a reliable library instead.

fftpack is already used in IRAF replacing the fourier transformation that was
taken from the Numerical Recipes book.
@olebole olebole added the Dist:NOAO Releases distributed by NOAO (up to 2.16.1) label Oct 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dist:NOAO Releases distributed by NOAO (up to 2.16.1)
Development

Successfully merging a pull request may close this issue.

2 participants