https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91512

--- Comment #18 from Sunil Pandey <skpgkp2 at gmail dot com> ---
(In reply to Thomas Koenig from comment #17)
> Simply passing on a huge number of arguments is not enough to trigger this.
> 
> Here's a perl script to generate test cases:
> 
> while ($n=shift)
> {
>     open FOO, ">foo-$n.f90";
> 
>     print FOO <<EOF;
> module foo
>   implicit none
> contains
> EOF
> 
>     print FOO "subroutine foo_proc";
>     for ($i=0; $i<$n; $i++)
>     {
>         push (@var, "a" . sprintf("%3.3d", $i));
>     }
> 
>     @call = ();
>     push (@call, "(");
> 
>     for ($i=0; $i<$n-1; $i++)
>     {
>         push (@call, "&\n  ") if ($i%10 == 0);
>         push (@call, $var[$i] . ", ");
>     }
>     push (@call, $var[$n-1],")\n");
>     print FOO @call;
> 
>     for ($i=0; $i<$n; $i++)
>     {
>         print FOO "  real, dimension(:,:) :: $var[$i]\n";
>     }
> 
>     print FOO "  call bar";
>     print FOO @call;
>     print FOO "  end subroutine\n";
>     print FOO "end module\n";
> }
> 
> Running this script with
> 
> for a in 50 100 200 500 1000; do perl gener.pl $a; echo -n "$a ";
> /usr/bin/time -f "%e %M" gfortran -c -O2 foo-$a.f90; done
> 
> gave me
> 
> 50 3.21 272668
> 100 8.44 581860
> 200 20.15 1046780
> 500 52.32 1208684
> 1000 167.43 3493456
> 
> so the CPU time does not come close to what is reported here.
> Memory use is quite high, though.
> 
> What is the memory footprint of the compilation? Is your machine possibly
> starting to swap?

My system has plenty of memory. I don't think it's swapping issue. Here is
memory profile for before and after commit.

Before commit:
==============

$ /usr/bin/time -f "%e %M"
/local/skpandey/gccwork/gcc_trunk/tools-build/gcc-debug/release.a4ba5c3ec624008e899a8bcb687359db25140c23/usr/gcc-10.0.0-x86-64/bin/gfortran
 -m64 -c -o module_first_rk_step_part1.fppized.o -I. -I./netcdf/include -I./inc
-fno-unsafe-math-optimizations -mfpmath=sse -O3 -march=skylake -funroll-loops
-fconvert=big-endian module_first_rk_step_part1.fppized.f90
41.88 214612
$ /usr/bin/time -f "%e %M"
/local/skpandey/gccwork/gcc_trunk/tools-build/gcc-debug/release.a4ba5c3ec624008e899a8bcb687359db25140c23/usr/gcc-10.0.0-x86-64/bin/gfortran
 -m64 -c -o module_first_rk_step_part1.fppized.o -I. -I./netcdf/include -I./inc
-fno-unsafe-math-optimizations -mfpmath=sse -O3 -march=skylake
-fconvert=big-endian module_first_rk_step_part1.fppized.f90
40.88 214716
$ /usr/bin/time -f "%e %M"
/local/skpandey/gccwork/gcc_trunk/tools-build/gcc-debug/release.a4ba5c3ec624008e899a8bcb687359db25140c23/usr/gcc-10.0.0-x86-64/bin/gfortran
 -m64 -c -o module_first_rk_step_part1.fppized.o -I. -I./netcdf/include -I./inc
-fno-unsafe-math-optimizations -mfpmath=sse -O2 -march=skylake
-fconvert=big-endian module_first_rk_step_part1.fppized.f90
40.38 214652

After commit:
=============

$ /usr/bin/time -f "%e %M"
/local/skpandey/gccwork/gcc_trunk/tools-build/gcc-debug/release/usr/gcc-10.0.0-x86-64/bin/gfortran
 -m64 -c -o module_first_rk_step_part1.fppized.o -I. -I./netcdf/include -I./inc
-fno-unsafe-math-optimizations -mfpmath=sse -O3 -march=skylake -funroll-loops
-fconvert=big-endian module_first_rk_step_part1.fppized.f90
1548.42 10111860
$ /usr/bin/time -f "%e %M"
/local/skpandey/gccwork/gcc_trunk/tools-build/gcc-debug/release/usr/gcc-10.0.0-x86-64/bin/gfortran
 -m64 -c -o module_first_rk_step_part1.fppized.o -I. -I./netcdf/include -I./inc
-fno-unsafe-math-optimizations -mfpmath=sse -O3 -march=skylake
-fconvert=big-endian module_first_rk_step_part1.fppized.f90
1088.74 2924072
$ /usr/bin/time -f "%e %M"
/local/skpandey/gccwork/gcc_trunk/tools-build/gcc-debug/release/usr/gcc-10.0.0-x86-64/bin/gfortran
 -m64 -c -o module_first_rk_step_part1.fppized.o -I. -I./netcdf/include -I./inc
-fno-unsafe-math-optimizations -mfpmath=sse -O2 -march=skylake
-fconvert=big-endian module_first_rk_step_part1.fppized.f90
544.56 3129568

Reply via email to