Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Allocation problems in Intel FORTRAN 16.0 update 1 64 bit in windows

PRADEEP_KUMAR_P_
Beginner
282 Views

I tried to develop a code and use LAPACK subroutines to calculate Eigen value and Eigenvector in the code and was succesful. The code runs without any errors. 

 

Since my main goal was to solve a large matrix and there are memory limitations in Windows, I tried to allocate and deallocate the arrays in the code. Before stopping the code, a pop-window shows and reports that the ***.exe has stopped working.

 

I have attached part of the code where allocation and deallocation was done for perusal. 


            IMPLICIT REAL*8(A-H, O-Z)
            real*8, allocatable :: A(:,:),U(:,:),VT(:,:),SH(:,:)
            real*8, allocatable :: UH(:,:),AN(:,:),AN1(:,:),AN2(:,:),EV(:,:)
            real*8, allocatable :: UHM(:,:),UH1(:,:),B(:,:),V(:,:)
            real*8, allocatable :: S(:),WORK(:),EVL(:)


            allocate (A(M,N),U(M,M),V(N,N),VT(N,N),SH(N,N),STAT = iERROR)
          allocate  (UH(M,M),AN(M,N),AN1(M,N),AN2(M,N),STAT = iERROR)
          allocate (S(N),WORK(LWMAX),EVL(M),UHM(M,N),STAT = iERROR)
          allocate (UH1(M,M),B(M,N),EV(N,N),STAT = iERROR)


            deallocate(A,U,V,VT,SH,UH,AN,AN1,AN2,UHM,UH1,B,EV, STAT = iERROR)
            deallocate(S,WORK,EVL,STAT = IERR7)
            

Problem  arises in deallocation. Can someone help me how to debug this error?

Thanks in advance.

Regards

-P.Pradeep Kumar

0 Kudos
3 Replies
mecej4
Honored Contributor III
282 Views

Have you checked whether all the allocations were successful? That is, did you examine the value of IERROR after the attempted allocations? If any failed, and a variable that was not allocated was not used in the program, when you try to deallocate that variable an error will occur.

If that suggestion does not help to find the problem, please go ahead and post example code that exhibits the problem.

0 Kudos
PRADEEP_KUMAR_P_
Beginner
282 Views

Thanks Mr. mecej4. I made a mistake. I have allocated some arrays and have never used it in the code and that caused the error while deallocating. 

0 Kudos
andrew_4619
Honored Contributor II
282 Views

PRADEEP KUMAR P. wrote:

Thanks Mr. mecej4. I made a mistake. I have allocated some arrays and have never used it in the code and that caused the error while deallocating. 

 

You can always use the allocated function....

IF ( allocated( array) ) deallocate(array, stat = istatus)

0 Kudos
Reply