Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

The following implied Do-loop produces a bad performance at compile time

haarWPhi2D = reshape([((((((2**(-j/2))*haarWaveletPhi((2**j)*(m*dx)-k))* &
 ((2**(-j/2))*haarWaveletPhi((2**j)*(n*dt)-l)), &
  m = -grid_size, grid_size), k = -grid_size, grid_size), &
   n = 0, num_time_steps), l = 0, num_time_steps)], shape(haarWPhi2D))

I don't understand why the compilation is extremely slow and depending of the value of the finals may even never finish the compilation. For example with some of them at 100.

I'm not an expert but I expect in any case the performance to be affected at run time not at compile time.

Compiler version: GCC version 9.3.0
 Compiler options: -mtune=generic -march=x86-64 -fpre-include=/usr/include/finclude/math-vector-fortran.h

--Update--

This is a simple case that can be used to prove the problem

program main

    implicit none
        integer :: m, n
        integer :: k = 0
        integer :: l = 0
        integer, parameter :: num_time_steps = 100
        integer, parameter :: grid_size = 100
        real :: haarWPhi2D(-grid_size:grid_size, -grid_size:grid_size, 0:num_time_steps, 0:num_time_steps)
        haarWPhi2D = reshape([((((1, &
            m = -grid_size, grid_size), k = -grid_size, grid_size), &
                n = 0, num_time_steps), l = 0, num_time_steps)], shape(haarWPhi2D))

end program main
question from:https://stackoverflow.com/questions/65877589/implied-do-loop-compilation-performance

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.2k views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...