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

Is there anyway to see big arrrays?

nileshjrane
Beginner
1,101 Views
I am trying to debug a code which has arrays of number of elements upto 10000. idb does not show as much elements. Is there any way i can see all the elements? it some times showa 1024 elements and sometimes only 1st element.
0 Kudos
11 Replies
ZlamalJakub
New Contributor III
1,101 Views

you can use for example array(1000:2000) in watch to see elements from 1000 to 2000.

another way is to print array to file.

another way is to use intel array visualiser (I used it in CVF, did not tried in intel).

Jakub

0 Kudos
abhimodak
New Contributor I
1,101 Views

Array visualizer works great! Unfortunately, it is not (yet) integrated with 64bit. Hence, you may also want to try out something like DISLIN.

Abhi

0 Kudos
nileshjrane
Beginner
1,101 Views

Thanks for the reply,

But how to use this array visualiser?? I mean what command etc??

I am having 32-bit system so no worries..[:)] and well i am using print command, it prints the variables' value. but i am having strange problem. My arrays are 3dimensional, a(k,j,i) types. but the indices idb shows are like 1,2,3....etc. If i say print a(1,1,1) it gives error that the array a is one dimensional rather than 3-dimensional..how is so??? Can anyone tell me how to handle this?? as its difficult to convert (k,j,i) to single dimension..its a big array..

0 Kudos
ZlamalJakub
New Contributor III
1,101 Views

Can you post your code to forum? Or some simplified version?

Jakub

0 Kudos
nileshjrane
Beginner
1,101 Views
Quoting Quba

Can you post your code to forum? Or some simplified version?

Jakub

I can't..its a big 7000+ line code. And its not my own code. I am using it for my project.

Is there anything like aligning the memory locations of the arrays???

As the declarations are made in separate files as:


Common/flux/ r,pa1,u,pa2,v,pa3,w,pa4,p,pa5,c,pa6,t,pa7,tv,pa8,
1 cv,pa9,re,pb1,rev,pb2,rmu,pb3,rkap,pb4,gcon,pb5,
2 res,pb6,evs,pb7,rhos,pb8,duex
CDIR$ CACHE_ALIGN/flux/
Real*8 pa1(32),pa2(32),pa3(32),pa4(32),pa5(32),pa6(32),pa7(32)
Real*8 pb1(32),pb2(32),pb3(32),pb4(32),pb5(32),pb6(32),pb7(32)
Real*8 pa8(32),pa9(32),pb8(32)
Real*8 u(nv2),v(nv2),w(nv2),r(nv2),c(nv2),t(nv2)
Real*8 p(nv2),re(nv2),cv(nv2),rev(nv2),gcon(nv2),tv(nv2)
Real*8 res(nv1),rmu(nv1),rkap(nv1),dtt(nv1)
Real*8 rhos(ns*nv2),duex((ne+2)*nv1),evs(nv*nv1)
Real*8 ak(nv2),eps(nv2),rkapt(nv1),rmut(nv1)

here the array size is total memory size needed for it, e.g nv2 is number of all veriables i.e. nv2=kmax*jmax*imax and so on....Could this be the reason??

In the code the arrays are used as:

Real*8 u(0:mz+1,0:my+1,0:mx+1),v(0:mz+1,0:my+1,0:mx+1)
Real*8 w(0:mz+1,0:my+1,0:mx+1),r(0:mz+1,0:my+1,0:mx+1)
Real*8 t(0:mz+1,0:my+1,0:mx+1),c(0:mz+1,0:my+1,0:mx+1)
Real*8 p(0:mz+1,0:my+1,0:mx+1),re(0:mz+1,0:my+1,0:mx+1)
Real*8 cv(0:mz+1,0:my+1,0:mx+1),rev(0:mz+1,0:my+1,0:mx+1) etc....


u(k,j,i) = qu*ri
v(k,j,i) = qv*ri
w(k,j,i) = qw*ri ..........etc..........

But i rember, the debuger showed the arrays properly only once. So it cant be the error in the code.

0 Kudos
ZlamalJakub
New Contributor III
1,101 Views

you declared u(kmax*jmax*jimax) so itis 1D array and use it like this n routine where it was eclared, but when you call

call sub(u,imax,jmax,kmax)

where

subroutine sub(u,imax,jmax,kmax)

real*8 u(kmax,jmax,imax)

...

end

in this routine you use array u as to be 3D.

does it help

Jakub

0 Kudos
nileshjrane
Beginner
1,101 Views
Quoting Quba

you declared u(kmax*jmax*jimax) so itis 1D array and use it like this n routine where it was eclared, but when you call

call sub(u,imax,jmax,kmax)

where

subroutine sub(u,imax,jmax,kmax)

real*8 u(kmax,jmax,imax)

...

end

in this routine you use array u as to be 3D.

does it help

Jakub

but i thought the declaration as done below:

CDIR$ CACHE_ALIGN/flux/
Real*8 pa1(32),pa2(32),pa3(32),pa4(32),pa5(32),pa6(32),pa7(32)
Real*8 pb1(32),pb2(32),pb3(32),pb4(32),pb5(32),pb6(32),pb7(32)
Real*8 pa8(32),pa9(32),pb8(32)
Real*8 u(nv2),v(nv2),w(nv2),r(nv2),c(nv2),t(nv2)
Real*8 p(nv2),re(nv2),cv(nv2),rev(nv2),gcon(nv2),tv(nv2)
Real*8 res(nv1),rmu(nv1),rkap(nv1),dtt(nv1)
Real*8 rhos(ns*nv2),duex((ne+2)*nv1),evs(nv*nv1)
Real*8 ak(nv2),eps(nv2),rkapt(nv1),rmut(nv1)

just allocates the memory block for a perticular array and not declare the array itself (with the number of array elements and dimensions). I mean i may define u as whatever dimensional array i want, only thing is total num of array elements shouldn't be greater that nv2. So by that logic the debugger should show me the variables as u(k,j,i) and not u(i).. Isn't it right??

0 Kudos
nileshjrane
Beginner
1,101 Views

1 more blunder...

This is a loop to read values from a file. nblk=1, so the loop will run only once. and jblk is also 1. the input in the file is: 1,3,10,3,10,3

do n = 1,nblk
read(10,*) (nbc(m), m=1,6)
if (n .eq. jblk) ibc(:) = nbc(:)
enddo

now after this i expected the values to be stored as:

nbc(1)=ibc(1)=1

nbc(2)=ibc(2)=3

nbc(3)=ibc(3)=10

nbc(4)=ibc(4)=3

nbc(5)=ibc(5)=10

nbc(6)=ibc(6)=3

But the idb shows the array in the window "locals" as follows:

nbc(0)=ibc(0)=1

nbc(1)=ibc(1)=3

nbc(2)=ibc(2)=10

nbc(3)=ibc(3)=3

nbc(4)=ibc(4)=10

nbc(5)=ibc(5)=3

What the heck is wrong with idb????

Here i specified the indices as 1-6 explicitly. Still its nt taking it correctly. This is making the code run in wrong way, as when i have a conditional statement:

if (ibc(6)=3)

it doesnt make any sense, as there is some garbage value in ibc(6) and its true value gets stored in ibc(5). This is happening every where in the code.

0 Kudos
ZlamalJakub
New Contributor III
1,101 Views

Yes

Real*8 ak(nv2),eps(nv2),rkapt(nv1),rmut(nv1)

allocates memory for array ak for index 1 to nv2. But you cannot use statement like

ak(1,5,3) because compiler knows ak is 1D array. But when you pass this rray to another routine and in routine say that ak is 3D array, compiler will handle array's memory space as to be 3D array. (It can be only when no interface is checked) another way to turn 1D array to 3D is to use RESHAPE.

Jakub

0 Kudos
ZlamalJakub
New Contributor III
1,101 Views

idb is Debugger?

How is nbc declared?

integer*4 nbc(6) ! this declares array nbc(1) -- nbc(6)

integer*4 nbc(0:5) ! this declares array nbc(0) -- nbc(5)

(if you have disabled array bounds checking it is possible to access nbc(6) even if it is ut of array bounds)

Is your program mixed C and FORTRAN?

I think there can be problem with your FORTRAN installation, i hope that Steve Lionel helps you.

Jakub

0 Kudos
Steven_L_Intel1
Employee
1,101 Views

idb is the Intel Debugger that was supplied with older versions of Intel Visual Fortran, but isn't any more. Which debugger are you actually using?

The suggestion of viewing an array slice, such as A(1000:2000) works - I don't think there is any limit on the number of elements if you do it that way. The 1000-element limit is there to prevent problems when very large arrays are looked at.

0 Kudos
Reply