0

Increase maximum number of elements/connections

Hi,

I’m trying to increase the maximum number of elements/connections by recompiling the source code ( I’m on a Windows 7 64 bit pc and access gfortran through Cygwin).

When I increase MNEL and MNCON to 200000 in the file T2 and use the command below a working .exe file is created

gfortran -o eos1_n -g -fdefault-real-8 -fno-align-commons eos1.f t2fm.f t2cg22.f meshm.f t2f.f t2solv.f

(although a warning like this is signalling several times:
Named COMMON block ‘l2’ at <1> shall be of the same size as alsewhere (3968000 vs 4 bytes).
I’m assuming this warning has something to do with the –fno-align-commons statement. When I change that to -falign-commons, as instructed in the manual, no .exe is created, and several warnings stating  ‘…padding of 4 bytes required…’ are flagging.)

 

However, when I further increase MNCON to 600000 and use exactly the same command as the one that worked for MNCON=200000, no .exe is created and, I get several error messages stating:

 ‘…relocation truncated to fit...’

and the error message ends with:
‘…additional relocation overflows omitted from the output. Collect2: error: ld returned 1 exit status’

Does anyone know what goes wrong and how to solve it?

Thank you very much in advance!

Katrijn

7replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hi Katrijn,

     

    Please add -mcmodel=medium to the compile command and try again.  It is typically needed when large static memory is requested.

     

    George

    Like
  • Hi Katrijn,

    In addition to George's suggestion, add the following flag so all integers are the same size:

    -fdefault-integer-8

    If mcmodel=medium doesn't doesn't work, for TOUGHREACT, I use the following flags for gfortran on Mac and similar ones on Linux:

     -O2 -fstack-arrays -fdefault-integer-8 -fdefault-real-8 -fdefault-double-8 -malign-double -Wl,-stack_size,0x80000000

    I haven't tried this on TOUGH2 V2. I'm not sure if Cygwin uses the -Wl,-stack_size,0x80000000. Definitely use the latest gfortran (v6 or later) since it is less buggy and much faster.

    For running a problem this large, optimization (-O2) will also make a big difference in cpu time.

    regards,

    Eric

    Like
  • Dear George and Eric,

    Thank you for your quick replies.

    Unfortunately, I didn’t manage to solve the issue. I added everything you said, including –mcmodel=medium, and changed “-Wl,-stack_size” to “-Wl,--stack” according to the instructions in this post. I also tried changing the Cygwin stack size using peflags as instructed in this post. However, the error message remains the same.

    The only workaround I’ve found so far is to force the number of MNEL and MNCON below some threshold that creates the error. It works when I limit MNEL and MNCON to 190000 and 400000, respectively.

    Other ideas to solve this are always welcome.

    Regards,
    Katrijn

    Like
    • Andri Arnaldsson
    • Senior Geothermal Scientist - Vatnaskil Consulting Engineers
    • Andri_Arnaldsson
    • 5 yrs ago
    • Reported - view

    Doubt it will help but there is also an -mcmodel=large option.

    Can you post your T2 file?

    Like
  • Hi Katrijn,

    You may have reached the Windows 2 GB static limit. Try reducing all other variables in T2 to the minimum you need, such as these, and MNOGN, MGTAB:

    C---  MNK: Number of components (needs to be 3 for ECO2n: water, salt, co2)
          PARAMETER (MNK = 2)
    C---  MNEQ: Number of equations per element (# of Primary variables)
          PARAMETER (MNEQ = 3)
    C---  MNPH: Number of phases (needs to be 3 for ECO2n: water, salt, co2)
          PARAMETER (MNPH = 2)
    C---  MNB: Number of phase-dependent secondary variables
          PARAMETER (MNB = 12)
     

    Eric

    Like
  • No, I already tried that, it didn't change anything.
    My T2 file is attached!

    Like
  • Hey,

    Ok, that makes sense. Playing with the variables definitely helps.

    Thanks a lot for all the quick replies and help!!

    Katrijn

    Like
Like Follow
  • 5 yrs agoLast active
  • 7Replies
  • 624Views
  • 4 Following