I have a Fortran90 program (Packmol) which, until, was implemented with static memory allocation.
I changed the code to use dynamic allocation, in such a way that all arrays are allocated at the beginning. I had a performance loss of 400% in some examples.
Then, I verified that even if the sizes of the arrays are the same as those when I used static allocation, the problem persists. That is, if I change the allocations from
to something like
double precision :: x(1000)
That is enough to cause the performance loss. Of course, when that is done for all arrays that need to be allocated dynamically, which are about 30.double precision, allocatable :: x(:)
allocate(x(1000))
Is there a way to allocate the arrays in a more efficient manner to reduce the performance penalty? Or do someone has a different suggestion?
Thank you very much.
EDIT: Somehow the problem was solved. The Dynamic version is now only slightly slower than the static version, which is expected. I do not know, really, what was causing the major slowdown before.