dynamic memory allocated fortran code takes more time to execute 
Author Message
 dynamic memory allocated fortran code takes more time to execute

I am running a fortran code on an SGI INDY/INDIGO. I spent a lot of effort
changing the code lines so it allocates memory dynamically to arrays. The
most time consuming subroutine (which contains nested do loops) now takes
60% more time to execute compared to when the memory was allocated statically.
A simple loop counter placed inside the innermost loop indicates it is the
same in both situations. However profiling with pixie option indicates it
is spending correspondingly more no. of cycles in the code which does dynamic
memory allocation (there are no memory allocation code lines inside any do
loop). I am clueless; has anyone experienced this kind of behaviour?

thanks
SS



Fri, 24 Oct 1997 03:00:00 GMT  
 dynamic memory allocated fortran code takes more time to execute

Quote:

> I am running a fortran code on an SGI INDY/INDIGO. I spent a lot of effort
> changing the code lines so it allocates memory dynamically to arrays. The
> most time consuming subroutine (which contains nested do loops) now takes
> 60% more time to execute compared to when the memory was allocated statically.
> A simple loop counter placed inside the innermost loop indicates it is the
> same in both situations. However profiling with pixie option indicates it
> is spending correspondingly more no. of cycles in the code which does dynamic
> memory allocation (there are no memory allocation code lines inside any do
> loop). I am clueless; has anyone experienced this kind of behaviour?

> thanks
> SS

I guess it is some kind of optimization problem.
Have you tried to test it with different degrees of optimization ?

How did you allocate the memory, just a pointer and malloc or ?

arne

--
--------------------------------------------------------
               From: Arne Elofsson

  WWW:  http://www.doe-mbi.ucla.edu/arne/main.html      



Sun, 26 Oct 1997 03:00:00 GMT  
 dynamic memory allocated fortran code takes more time to execute

Quote:


>> I am running a fortran code on an SGI INDY/INDIGO. I spent a lot of effort
>> changing the code lines so it allocates memory dynamically to arrays. The
>> most time consuming subroutine (which contains nested do loops) now takes
>> 60% more time to execute compared to when the memory was allocated statically.
>> A simple loop counter placed inside the innermost loop indicates it is the
>> same in both situations. However profiling with pixie option indicates it
>> is spending correspondingly more no. of cycles in the code which does dynamic
>> memory allocation (there are no memory allocation code lines inside any do
>> loop). I am clueless; has anyone experienced this kind of behaviour?

>> thanks
>> SS

>I guess it is some kind of optimization problem.
>Have you tried to test it with different degrees of optimization ?
>How did you allocate the memory, just a pointer and malloc or ?
>arne

Aren't dynamically-allocated arrays always slower than static arrays?
I mean, isn't there more overhead at every array reference, because of
bounds-checking?

Maybe you can overcome your problem (to a certain extent) by assigning
array elements to temporary variables, ex.:

        do i=1,100
         t1 = a(i)
           do 20 j=100
            c(i,j) = t1+b(j)
         enddo
      enddo

instead of:

        do i=1,100
           do 20 j=100
            c(i,j) = a(i)+b(j)
         enddo
      enddo

Of course this kind of practice works only when an array element is
referenced more than once in a do loop.

Athanasios Nenes



Fri, 14 Nov 1997 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Executing Fortran Code One Line at a Time

2. Help needed on dynamic memory allocated by GAWK.

3. Help needed with dynamic memory allocated by GAWK.

4. experience with dynamic memory allocating in VHDL

5. allocating dynamic memory HELP wanted

6. Allocating/Deallocating memory for pointers (w/ Code Example)

7. c <== fortran ; allocating memory

8. How to Dynamically allocate Memory in Fortran

9. VMS/VAX Fortran - Allocating Memory

10. SGI Fortran: static vs allocated memory

11. execute code every set time

12. Fortran with Dynamic Allocation Memory for Linux

 

 
Powered by phpBB® Forum Software