As others suggested a profile of your code before thinking about changing it.
BUT the best thing you can do is carefully read the compiler manual, in turn, word for word, and carefully monitor all the options that it gives you. In my experience (I have a lot of experience in HPC for computational electromagnets, not that you have to believe what you read here!), You get the most hits for your dollars in optimizing performance through the intelligent use of the compiler.
Once you have exhausted the compiler (and, as one of the other respondents said, make sure you have a good compiler - they are not expensive, and I get a c40% reduction in execution time for most programs coming from g95 for a paid compiler), then you You should NOT start doing things like:
- scan cycle;
- reordering the team;
- attachment function;
- other things that we did all the time back during the day.
Currently, most of these code tuning tools are better than ours, carbon-based life forms can do this thanks to the good compiler optimizer.
If you have to mess around, mess with memory access - for example, you can use your array access to use the cache. If you do, set the tile size parameters (etc.), so that in the next year or year after that you move it to another architecture, you only need to configure a few parameters, and not change the code again.
Finally, have fun optimizing the performance of Fortran programs — a great way to spend your day!
High performance mark
source share