If or function pointers in fortran

前端 未结 4 757
南旧
南旧 2021-01-21 01:39

as it is so common with Fortran, I\'m writing a massively parallel scientific code. In the beginning of my code I read my configuration file which tells me which type of solver

4条回答
  •  孤街浪徒
    2021-01-21 01:52

    If you solver routines take a non-trivial runtime, then the trivial runtime of the IF statements is likely to be immaterial. If the sovler routines have a comparable runtine to the IF statement, then the total runtime is very short, so why do your care? This seems an optimization unlikely to pay off.

    The first rule of runtime optimization is to profile your code is see what portions are consuming the runtime. Otherwise you are likely to optimize portions that are unimportant, which will accomplish nothing.

    For what its worth, someone else recently had a very similar concern: Fortran Subroutine Pointers for Mismatching Array Dimensions

提交回复
热议问题