title: gprof on both OpenMP and without OpenMP codes produces different flat profile
body: <p>After successfully implementing OpenMP to my code, I am trying to check how much the implementation has improved my code performance, but using gprof it gives me totally different flat profile. Below is my main program calling all subroutines.</p>
  
  <pre><code>program main
    use my_module
    call inputf       !to read inputs from a file
  ! call echo         !to check if the inputs are read in correctly, but is muted
    call allocv       !to allocate dimension to all array variable
    call bathyf       !to read in the computational domain
    call inicon       !to setup initial conditions
    call comput       !computation from iteration 1 to n
    call deallv       !to deallocate all array variables
  end program main
  </code></pre>
  
  <p>Following is the <code>cpu_time</code> and <code>OMP_GET_WTIME()</code> for both serial and parallel codes. The OpenMP parallel region is within <code>subroutine comput</code>.</p>
  
  <pre><code>!serial code
  CPU time elapsed =   260.5080 seconds.
  !parallel code
  CPU time elapsed =   153.3600 seconds.
  OMP time elapsed =    49.3521 seconds.
  </code></pre>
  
  <p>And the following are the flat profile for both serial and parallel codes.</p>
  
  <pre><code>!Serial code
  Flat profile:
  Each sample counts as 0.01 seconds.
    %   cumulative   self              self     total
   time   seconds   seconds    calls   s/call   s/call  name
   96.26    227.63   227.63        1   227.63   236.45  comput_
    3.60    236.13     8.50     2001     0.00     0.00  update_
    0.08    236.32     0.19     2000     0.00     0.00  openbc_
    0.05    236.45     0.13       41     0.00     0.00  output_
    0.01    236.47     0.02        1     0.02     0.02  bathyf_
    0.01    236.49     0.02        1     0.02     0.03  inicon_
    0.00    236.50     0.01        1     0.01     0.01  opwmax_
    0.00    236.50     0.00     1001     0.00     0.00  timser_
    0.00    236.50     0.00        2     0.00     0.00  timestamp_
    0.00    236.50     0.00        1     0.00     0.00  allocv_
    0.00    236.50     0.00        1     0.00     0.00  deallv_
    0.00    236.50     0.00        1     0.00     0.00  inputf_
  
  !Parallel code
  Flat profile:
  Each sample counts as 0.01 seconds.
    %   cumulative   self              self     total
   time   seconds   seconds    calls   s/call   s/call  name
   95.52     84.90    84.90                             openbc_
    1.68     86.39     1.49     2001     0.74     0.74  update_
    0.10     86.48     0.09       41     2.20     2.20  output_
    0.00     86.48     0.00     1001     0.00     0.00  timser_
    0.00     86.48     0.00        2     0.00     0.00  timestamp_
    0.00     86.48     0.00        1     0.00     0.00  allocv_
    0.00     86.48     0.00        1     0.00     0.00  bathyf_
    0.00     86.48     0.00        1     0.00     0.00  deallv_
    0.00     86.48     0.00        1     0.00     2.20  inicon_
    0.00     86.48     0.00        1     0.00     0.00  inputf_
    0.00     86.48     0.00        1     0.00     0.00  comput_
    0.00     86.48     0.00        1     0.00     0.00  opwmax_
  </code></pre>
  
  <p><code>subroutine update</code>, <code>openbc</code>, <code>output</code> and <code>timser</code> are called within <code>subroutine comput</code>. As you can see, the <code>subroutine comput</code> is suppose to spend the most runtime, but the flat profile of the parallel code shows otherwise. Please let me know if you need other information.</p>