This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Memory for large arrays in cygwin/g77


Dante R. Chialvo wrote:
Thanks for the suggestions
Bottom line both ideas work fine in my case:

1) Install the g95 compiler, or
2) Use g77 using the Wl option, ie,


g77 -O2 -o mybigprogram -Wl,--stack,100000000 mybigprogram.f

So thanks a lot,

That's odd. Increasing the stack size definitely does not work for me. It just causes the program to terminate silently, with no output.


My test script is below. with comments describing the results on my system. Would anyone care to try it out and compare?

I have an up-to-date Cygwin system on Windows 2000. Very ordinary and uncustomised except for heap_chunk_in_mb set to 1024. G77 version is...

hadfield $ g77 -v
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/specs
Configured with: /gcc/gcc-3.3.3-3/configure --verbose --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,ada,c++,d,f77,java,objc,pascal --enable-nls --without-included-gettext --enable-libgcj --with-system-zlib --enable-interpreter --enable-threads=posix --enable-java-gc=boehm --enable-sjlj-exceptions --disable-version-specific-runtime-libs --disable-win32-registry
Thread model: posix
gcc version 3.3.3 (cygwin special)


Test script:
---------------------------------
#! /bin/bash

# Investigate g77/Cygwin memory limits

set -e

srcfile=/tmp/g77test.f
exefile=/tmp/g77test.exe

# With g77 -mno-cygwin, the program works for n of at least
# 250000000. With this value the program requires 954 MiB and
# takes 10-20 s to execute, so I haven't pushed it any further.

# With default g77 command, producing a Cygwin executable, the
# maximum value of n supported is 40876200 (corresponding to an
# array size of 156 MiB). Beyond that it produces the error:
#   D:\Temp\g77test.exe (1788): *** MapViewOfFileEx(0x224, in_h 0x224)
#   failed, Win32 error 6

# I can increase the stack size with -Wl,--stack=s. However if I
# set s much above (what I believe to be) the default of 2 MiB
# (s=2097162) then no output is produced. The maximum value of
# s for which output is produced with n=40876200 is 2162688, and
# there seems to be no value of s which allows n to be increased
# above 40876200.

cat > $srcfile << EOF

program main

      integer n
      parameter (n=40876200)

real a(n)

integer i

      do i=1,n
        a(i) = i
      end do

write (unit=*, fmt=*) a(1), a(n)

      end
EOF

g77 -Wl,--stack=2097152 $srcfile -o $exefile

$exefile

---------------------------------

--
Mark Hadfield            "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)


-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]