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

Optimization of routines allocating and initializing arrays

a_leonard
Novice
327 Views
I have a file with several routines that allocate a total of about 2000 different arrays, based on the model size, and give them some initial value. They look something like this:
[plain]      subroutine ALLOC1

use MOD_1, only : n_1, A_1, B_1, C_1

allocate( A_1(n_1))
allocate( B_1(n_1))
allocate( C_1(n_1))

A_1 = 0.
B_1 = 0.
C_1 = 0.

return
end[/plain]

When I compile this file with optimization turned on, it takes about 90 seconds to compile. Without optimization, it only takes 2 or 3 seconds. Any idea what the compiler is doing that takes so long? If I turn off optimization for this file, will it somehow affect run time when I use these arrays?
0 Kudos
1 Reply
Steven_L_Intel1
Employee
327 Views
Can you provide the actual code that shows such a difference? "looks like this" isn't enough to be able to analyze.

I'd guess that vectorization is trying to optimize the initialization loops - yes, turning off optimization would make it slower, but you can test this yourself. Also, which compiler version are you using and what compile options?
0 Kudos
Reply