Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't get DO loop to iterate past 20018392. ???????

Status
Not open for further replies.

RamonetB

Technical User
Oct 20, 2003
4
US
Hello all.
Disclaimer: I'm not a professional Fortran programmer. So forgive me if I sound incompetent in some areas. With that said....


I'm running a code, specifically RSICC neutron transport code, and I'm running into a limitation that I can't seem to verify. I'm asked to allocate a certain length of memory. What I need is 40,000,000 words. An array is created and each element initialized to zero ranging from a starting value to this 40million number. However, the do loop that initializes the array, half way through, stops itterating. No error codes of any kind. it simple stops. It stops on iteration 20018392.

Here is the code:

subroutine clearx (a,n1,n2)
dimension a(0)

c - - - - - sets (a(i),i=n1,n2) to 0 if n1.le.n2
if(n2.lt.n1) go to 9900
do 10 n=n1,n2
10 a(n) = 0.
9900 return
end

n1 starts at 10,000,001
n2, the word size requested, is 40,000,000

Another interesting note: On iteration 20,000,053, n2 is no longer 40,000,000 but 0 and remains 0 for all subsequent iterations until it terminates.


Can anyone lend a hand to this dillemma? I'm at a loss and getting very frustrated!

Compiler: Intel Fortran Compiler V8.0
With MS C++ .NET 2003 Standard

Thanks in advanced!

-kirk
 
You may have some kind of memory overwite, possibly because the arguments passed to the function do not have the same size as the formal arguments. Try declaring them explicitly.

subroutine clearx (a,n1,n2)
real*4 a(*) ! real*8 ?
integer*4 n1,n2

integer*4 n

c - - - - - sets (a(i),i=n1,n2) to 0 if n1.le.n2
if(n2.lt.n1) go to 9900
do 10 n=n1,n2
10 a(n) = 0.
9900 return
end
C
C --- in the calling program
C
C....
real*4 a1(40000000)
integer*4 n1,n2

n1 = 10000000
n2 = 40000000
call clearx(a1,n1,n2)
C....

CaKiwi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top