7 Replies Latest reply on Jan 7, 2012 4:10 AM by milos

    openf95 problem with record lengths

    milos
      openf95 problem with record lengths

      Hi,

      I am trying to compile a Fortran 90 code that has previously run successfully using the Intel compiler (and many others, like Compaq, Cray, etc.)

      I get an error like the below, when the code tries to write formatted output to a file, and the complaint is about record length:

       

      lib-4211 : UNRECOVERABLE library error 

        A WRITE operation tried to write a record that was too long.

      Encountered during a sequential formatted WRITE to unit 30

      Fortran unit 30 is connected to a sequential formatted text file: "diel01"

       Current format:   100 FORMAT(9999e15.6)

      I have verified by hand testing that this happens because the "record length" is by default not large enough.  I opened the file with:
         OPEN(unit=30,file='diel'//ext,status = 'unknown')
      If I change this to include a larger record length like this:
         OPEN(unit=30,file='diel'//ext,status = 'unknown',recl=1500000)
      My questions:
      1) Why is this happening?  No other compiler needs the recl, so the default values must be different..
      2) I don't want to go through my whole code and change insert the recl specification into every open statement.  Does the openf95 compiler have a flag that can set the default record length or something like that?
      3) Is there another clean way to solve this?
      4) Is this openf95 not following Fortran standards, other compilers not doing so, or neither?
      Thanks very much for any help in advance!
      Milos


        • openf95 problem with record lengths
          santosh.zanjurne

          Hello Milos,

          These kind of errors are mostly seen when there is not enough stack space available.  Can you please increase it using 'ulimit -s n' command, where n is an appropriate value for your app.  Let me know if this helps you.

          Thanks & Regards,

          Santosh 

            • openf95 problem with record lengths
              milos

               

              Originally posted by: santosh.zanjurne Hello Milos,

               

              These kind of errors are mostly seen when there is not enough stack space available.  Can you please increase it using 'ulimit -s n' command, where n is an appropriate value for your app.  Let me know if this helps you.

               

              Santosh, thanks for the suggestion.  Running ulimit -s unlimited (and verifying that it was set to unlimited, by running "ulimit -s" or "ulimit -a" after that) did not change the situation, still same error, as well as when I increase it to 102400 from 10240.  I am running on RHEL Server 5.5.

              I have to admit that 10240 is very close to the record length where it failed, and that was the default setting for ulimit -s.  At the same time, I'm having problems changing ulimit sometimes..  I first set ulimit -s 102400, and that didn't help, then I tried ulimit -s 204800 and 500000, and got the error:

              -bash: ulimit: stack size: cannot modify limit: Operation not permitted

              The weird thing is that it's not the size that trips up the above error.  If I start a new shell, I can set ulimit to anything.  After I set it, if I try to set it again, it craps out, no matter what the number.. sometimes it works to make the number smaller, but when I try to go back up to the same value as before I get the above error.. a bit confusing, so I wonder if I have a problem with ulimit..  Edit: never mind, looking here: http://ss64.com/bash/ulimit.html I see that the ulimit can be reduced "irreversibly", so I guess above behavior is normal.  However, still doesn't solve the Fortran problem, even when increased to 500MB or infinite.

              By the way, without playing with "ulimit -s" the code works with Intel Fortran compiler.  It also works with open64 but only if I explicitly add recl=1500000 into the file open statement.  Wouldn't it still fail in these cases if ulimit were the issue?

              Thanks,

              Milos