Large arrays in AViz, don't use shape function if possible

Large arrays in AViz, don't use shape function if possible

This information has been discussed in the Fortran Compiler forum, I thought I would add a note here. I recently started using some large arrays with over 300,000 rows and perhaps 1,000 colmns. My problems arose when I wanted to use the AVStartWatch routine. According to the User Manual, one would invoke an expression like this:

call avStartWatch(LOC(XYPlotData(1:nRows,(iSubCol):(iSubCol))), 2, &
shape(XYPlotData(1:nRows,(iSubCol):(iSubCol))), AV_REAL4, Ydatastring(i), status)

This would generate a program exception - stack overflow because the XZPlotData array, the biggie, was getting copied temporarily and passed onto the stack. Since I already knew the shape of the array I was sending, I just set it up "by hand" the array nShape is a2-element arrayof integers. Just call the routine like so:

nShape(1)=nRows
nShape(2)=1
call avStartWatch(LOC(XYPlotData(1:nRows,1:1)), 2, &
nShape, AV_REAL4, Xdatastring(1), status)

publicaciones de 3 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

>>...I recently started using some large arrays with over 300,000 rows and perhaps 1,000 columns...

Let's do some calculations how much memory your application willneed:

Case #1:

Single-Precision FP ( 4 bytes ): 300,000 x 1,000 x 4 = 1,200,000,000 bytes= 1.18 GB
Since a copy will be created it will alsoneed1.18 GB. In total, 1.18 GB + 1.18 GB = 2.36 GB

Summary: A 32-bitapplication on a 32-bit platformwill fail. For example, for a 32-bit Windows an
application cannot use more than 2 GB of memory. It looks OK for a 64-bit Windows.

Case #2:

Double-Precision FP (8 bytes ): 300,000 x 1,000 x8 = 2,400,000,000 bytes= 2.24 GB
Since a copy will be created it will alsoneed2.24 GB. In total, 2.24 GB + 2.24 GB = 4.48 GB

Summary: See Summary for theCase #1. An address space for a32-bitplatform is 4 GB. It looks OK
for a 64-bit platform.

Conclusion:

Are you working on a32-bit platform or 64-bit platform?

If you're workingon a32-bit Windows platformhave you considered to use a 32-bitWindows with
Address Windowing Extensions ( AWE ) or a 64-bit platform?

Sergey,

The problem is not with copy of the array created for use by avStartWatch. As it uses the memory in-place.
The problem is shape(XYPlotData(1:nRows,(iSubCol):(iSubCol)) Created a temporary array of the plot data, then returned the/a integer array(2) containing the shape of the (temporary) array. I think this is a bug in the compiler with respect to shape(...) in treating "(...)" as an expression, instead of using "..." as a reference. By treating "(...)" as an expression, a copy of the array is made... thus causing the stack overflow.

Jim Dempsey

www.quickthreadprogramming.com

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya