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

Allocation size limit(Array expansion limited to 1000 nodes)

ronan2010
Beginner
2,078 Views
Hi All,

Is there any allocatation size limit for allocatable variables ? In my program alloc variable(KV) is declaraed as follows in the body of program:

[bash]INTEGER,PARAMETER::iwp=SELECTED_REAL_KIND(15)
 INTEGER::.............
 REAL(iwp)::.................
-----------------------dynamic arrays------------------------------------
 INTEGER,ALLOCATABLE::...................
 REAL(iwp),ALLOCATABLE::.........km(:,:),kv(:)[/bash]

and later in program allocation for that variable is performed in that form:

[bash]ALLOCATE(kv(kdiag(neq)))[/bash]
so the weirdness is that : When I try to debug step by step I found that kv variables size is limited to 1000 nodes, where it should be 1492.

Any help in advance will be appreciated!





0 Kudos
11 Replies
Steven_L_Intel1
Employee
2,078 Views
The "1000" limit is just the debugger view when you expand a whole array. It has nothing to do with a limit on the actual array allocation. You can override the display by viewing an explicit slice, such as A(1:1492).
0 Kudos
ronan2010
Beginner
2,078 Views
thanks for clarification,

One more thing, after running program succesfully (w/o not complaints from compiler) in outputs, probably due toill-conditioned source code or really is something wrong with code, almost all of them is NaN. It is hard for me to spot where actually vars, argsetc are getting the NaN value, but I've break it down to the malfunctioning subroutine. My question, before delving deep down, what isactually causing the variables getting NaNs?
---division by zero
--- uninitialized variable
---


Kind Regards,
0 Kudos
TimP
Honored Contributor III
2,078 Views
Uninitialized variable, or 0./0. are both possible sources of NaN.
0 Kudos
Steven_L_Intel1
Employee
2,078 Views
SQRT of a negative value is another. I have also seen datatype mismatches across calls cause this. The Diagnostics > Check Routine Interfaces option would help there.

You can try this - set the project property Fortran > Floating Point > Floating Point Exception Handling to "Underflow gives 0.0; Abort on other IEEE exceptions (/fpe:0)". This may give you an error at the point where a NaN is introduced.
0 Kudos
ronan2010
Beginner
2,078 Views
Thank you all,

SQRT of a negative value is another.

I've introduced a negative value check to eliminate that. Which still leaves, worm gnawing in my heart that I'm altering whole algorithm and this is the cause for the wrong outputs.


Ihave also seen datatype mismatches across calls cause this.

Is that Intel VF or MS VStudio issue? by chance Check Routine Interfacesis correct Yes (/warn:interfaces)

By chance I got that Floating Point Exception Handling set to correct as well (/fpe:0)

Actually it's a structural eng. FEM analyse program, and these are the FEM linear equation solutions, and I'm getting the error exactly when trying to reduce the global stifness matrix. Most of the gurus say that I should never get the negative value in Cholesky factorisation( which is stil unclear for me, so many lines todebug) if so then my input data is ill-organized and error prone. I'm not the original writer so I'm not even sure that error isbefore the global stifness formations formation subroutines or after that.

Kind Regards,

0 Kudos
Steven_L_Intel1
Employee
2,078 Views
Datatype mismatches are a programming error.

Can you identify the particular operation that is resulting in a NaN?
0 Kudos
ronan2010
Beginner
2,078 Views
[bash]IMPLICIT NONE
 INTEGER,PARAMETER::iwp=SELECTED_REAL_KIND(15)
 REAL(iwp),INTENT(IN)::kv(:)
 REAL(iwp),INTENT(IN OUT)::loads(0:)
 INTEGER,INTENT(IN)::kdiag(:)
 INTEGER::n,i,ki,l,m,j,it,k
 REAL(iwp)::x
 n=UBOUND(kdiag,1)
 loads(1)=loads(1)/kv(1)
 DO i=2,n
   ki=kdiag(i)-i
   l=kdiag(i-1)-ki+1 
   x=loads(i)
   IF(l/=i)THEN
     m=i-1
     DO j=l,m 
       x=x-kv(ki+j)*loads(j)
     END DO
   END IF
   loads(i)=x/kv(ki+i)   ! I THINK IT'S HERE BUT NOT SURE 
 END DO[/bash]
0 Kudos
Steven_L_Intel1
Employee
2,078 Views
You should be able to step through the code and examine each variable before and after the statement. See what inputs cause a NaN to be generated. If it's an element of the loads array, it might be "stomped on" by something else in your code. The key is to find out what statement or operation changes the value to a NaN, and then to figure out what its inputs are and where they came from. This means debugging the application.
0 Kudos
ronan2010
Beginner
2,078 Views
yes but takes time
0 Kudos
Steven_L_Intel1
Employee
2,078 Views
Yes, that is quite true.
0 Kudos
jimdempseyatthecove
Honored Contributor III
2,078 Views
REAL(iwp),INTENT(INOUT)::loads(0:)
...
loads(1)=loads(1)/kv(1)
...
and use of loads(?) elsewhere

loads is declared with lower bound of 0
yet, on cursory look at the code, it appears that you are using a lower bound of 1

Is this a problem, or a misunderstanding on my part?

If you are inconsistent on the lower bound, you may very well generate/use junk data which may generate NaN's (in addition to incorrect results).

Jim Dempsey

0 Kudos
Reply