Fortran¶
Additional code snippets and notes can be found at RMeli/fortran-playground.
ScaLAPACK¶
numroc¶
numroc computes the NUMber of Rows Or Columns of a distributed matrix owned by the process indicated by iproc.
Trying to use numroc in a Fortran program, results in the following error:
In order to avoid this error, the function needs to be declared as external.
external statement
The external statement specifies procedures or dummy procedures as external, and allows their symbolic names to be used as actual arguments.
Busy Wait¶
subroutine busywait(wait_time)
real(kind=dp), intent(in) :: wait_time ! (1)!
real(kind=dp) :: t_start, t_now, elapsed_time
elapsed_time = 0.0_dp
call cpu_time(t_start)
do while (elapsed_time < wait_time)
call cpu_time(t_now)
elapsed_time = t_now - t_start
end do
end subroutine
- Time to wait in seconds.