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

Allocatable variables slow the code?

Allamarein
Beginner
876 Views
I read the discussion in the topic 'Allocatable array' (issued 2008) I didn't understand the answer. Allocatable variables slow the code or not? I understood this problem could be found in debug mode, but the performance should be similar in release mode. Is this? My Os is Win7 with Intel Fortran 10. Allocatable is useful, but I don't want to sacrifice computational efficiency. Since I am starting my project, I should understand this point now. Regards
0 Kudos
4 Replies
TimP
Honored Contributor III
876 Views

If your compiler is so old that it doesn't support Fortran 2003 usage (ifort option realloc_lhs), you won't run into that aspect of possible performance degradation.

If you allocate at procedure entry and deallocate at exit (as is done by default), you would likely not be able to see the difference in performance vs. plain non-SAVEd arrays.  allocate and deallocate inside inner loops could be rather slow.

You could read about the performance of allocatable derived types, if you are considering those.

I haven't heard of any significant differences in performance in Windows since Windows 7 SP1.   I hope you aren't running Windows without service packs.

0 Kudos
Allamarein
Beginner
876 Views
Thank you for your help. I have to verify my Intel Fortran 10.1. with Visual Studio 2005 allows the option you reported. Do you know my softwares are new enough? This optipn avoids the cide check variable dimension at each time? Anyway I am in the case you suggest: I allocate my variables only once time at the beginning of the run and the dimension never changes.
0 Kudos
Steven_L_Intel1
Employee
876 Views

Even with the current version, the default is to not check for reallocation on array assignment. So it doesn't matter if you have an old version as far as that goes, though you are missing out on years of optimizations and bug fixes.

0 Kudos
Allamarein
Beginner
876 Views
Thank you. I understood the key is avoiding the Allocatable check to each assignation, in order to save time. Steve is right: my version is too old. In fact I am in charge to evaluate Fortran language for my company project. For this reason it provided me this old version. However, If it was the right choice (but I am sure of that), we should buy new updated licences with training in Fall/Winter. I am thinking to buy Parallel Studio, but I have to share my opinion with my co-workers
0 Kudos
Reply