Software Archive
Read-only legacy content

Memory error?

ma_poub
Beginner
460 Views
The following program crashes on comapq 6.1 and 6.1A (Win NT 2000 and Win 98) for big entries where as it does not with MS fortran 4.0 nor NAG free F90 compiler (Linux)

For small entries (nb_elem) it is fine
size(v1)=1000
size(v2)=10
Big entries
size(v1)=100000
size(v2)=10

Can someone help?
0 Kudos
2 Replies
ma_poub
Beginner
460 Views
Sorry the program:
program ess 
  implicit none 
  ! Variables 
  complex :: j 
  real , parameter :: PI = 3.14159 
  integer :: nb_elem 
 
  complex, dimension(:),pointer :: resultat 
  complex, dimension(:),allocatable :: v1 
  complex, dimension(:),allocatable :: v2 
 
  j=cmplx(0,1) 
  write(6,*) "entrer le nb_elem v1 :" 
  read(*,*) nb_elem 
  !nb_elem=100000  
  allocate(v1(nb_elem)) 
  write(6,*) "entrer le nb_elem v2 :" 
  read(*,*) nb_elem 
  !nb_elem=10 
  allocate(v2(nb_elem)) 
  v1=1+j 
  v2=3+j 
  resultat=>conv(v1,v2) 
  write(6,*) resultat(size(resultat)) 
  deallocate (resultat) 
CONTAINS 
    FUNCTION conv(val_x1,val_x2)  
      COMPLEX,dimension(:),pointer :: conv 
      COMPLEX,dimension(:),intent(in),target :: val_x1 
      COMPLEX,dimension(:),intent(in),target :: val_x2 
      COMPLEX,dimension(:),pointer :: x1 
      COMPLEX,dimension(:),pointer :: x2 
 
      !COMPLEX,dimension(:),pointer :: temp_conv 
      INTEGER :: i 
 
      allocate(conv(size(val_x1)+size(val_x2)-1)) 
      conv=0 
      IF (size(val_x1)>size(val_x2)) THEN 
         x1=>val_x1 
         x2=>val_x2 
      ELSE 
         x1=>val_x2 
         x2=>val_x1 
      END IF 
      !write(6,*) ((size(x1)-1)-(size(x2)+1)+1) 
      !write(6,*) (size(x1)-size(x2)-2+1) 
      !write(6,*) x2 
      conv(1:size(x2))=(/ (dot_product(x1(1:i),x2(i:1:-1)),i=1,size(x2)) /) 
      conv((size(x2)+1):(size(x1)-1))= & 
           & (/ (dot_product(x1(i:i+size(x2)-1),x2(size(x2):1:-1)), & 
           & i=2,size(x1)-size(x2)) /) 
      conv(size(x1):size(x1)+size(x2)-1) = & 
           & (/ (dot_product(x1(size(x1)-size(x2)+i:size(x1)), & 
           & x2(size(x2):i:-1)),i=1,size(x2)) /) 
      write (6,*) conv(size(conv)) 
    END FUNCTION conv 
 
end program ess 

0 Kudos
Steven_L_Intel1
Employee
460 Views
The error message (which you should have mentioned) is Stack Overflow. The compiler is using the stack to create an array temporary that is larger than the default 1MB. I found that by changing the stack reserve to 5000000, it ran ok. This is under Link..Output.

Steve
0 Kudos
Reply