Quantcast
Channel: Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2583

Huge slowdown when packing arguments into derived type with pointers

$
0
0

Hello everybody,

I have a complicated structure which a driver subroutine calls several user libraries. Many arguments need to be passed. To avoid the possibility of making a mistake, I decided to pack the arguments in a derived type structure and use pointers. I've noticed that this packing makes a big slow-down. I've made a working example with the two alternatives. working_example.f90 uses the derived type while the working_example_alt.f90 passes the arguments directly. The real system is much more complicated than this but this is representative of what happens.

I compile both with -O2 and use time to measure their performance:

p3tris@Odysseus:~/Desktop$ ifort -O2 -o test working_example_alt.f90
p3tris@Odysseus:~/Desktop$ time ./test
real    0m0.003s
user    0m0.000s
sys    0m0.000s

p3tris@Odysseus:~/Desktop$ ifort -O2 -o test working_example.f90
p3tris@Odysseus:~/Desktop$ time ./test
real    0m0.210s
user    0m0.204s
sys    0m0.004s

I expected some overhead but not that significant... Is this normal? Is it due to the association or some optimizations are disabled or simply the passing of a derived type?

Thanks in advance,

Petros


Viewing all articles
Browse latest Browse all 2583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>