Archive for January 2012
UPDATE: I have investigated further and it seems that it is somehow related to differences between stdin when read from a redirected file and a pipe stream. I tested with Sun Studio and received a similar error, so it seems that this is not compiler specific. Btw. the code I am testing/wrapping fails when trying to “BACKSPACE” (previous record) in the read input. Found some info that might relate somehow to the difficulties I am facing at the Intel Forum.
My current hobby project is trying to wrap a NASA legacy program for chemical equilibrium calculations (NASA CEA) in python. The first step has been tweaking the program to read input from stdin (unit 5 in fortran) and write output to stdout (unit 6 in fortran). In its current state it reads from an input file and writes to another file. This was faily easy to accomplish by changing the unit numbers. So far so good. It works fine if a run the program with stdin and stdout redirected like
cea2 < input > output
However, things go wrong if i use piped stdin like
cat input | cea2 > output
I really need this, since I would like to use the subprocess.Popen in python in order to communicate with the program through piped input.
I am not a fortran programmer, and it is likely that I have done something wrong. This has been my working hypothesis so far. The program fails with a message saying somthing like “Illegal seek” and the IOSTAT exit code is 29 (STATUS= specifier on an OPEN statement is invalid. According to this site), and it happens when the program tries to “backspace” in the read input. Somehow it may be stock at the end of file or something like that. A lot of googling didn’t bring up much, except this bug report for gfortran. According to the mail archive it should be fixed in versions 4.4, 4.5, and 4.6. I am running Linux Mint 11 with gcc 4.5.2. However, the upstream bug fix may not have surfaced in the downstream gcc package installed on Mint 11. I will try a live distro with gcc 4.6 one of these days, likely Mint 12, to see if it helps.
I have set up a google code site in order to maintain the work done, I have called the python wrap for cea2py.