我在运行时收到以下警告:
...
forrtl: warning (402): fort: (1): In call to I/O Write routine, an array temporary was created for argument #2
forrtl: warning (402): fort: (1): In call to I/O Write routine, an array temporary was created for argument #3
forrtl: warning (402): fort: (1): In call to GERADHEIT_LINIAL, an array temporary was created for argument #2
forrtl: warning (402): fort: (1): In call to GERADHEIT_LINIAL, an array temporary was created for argument #3
...
对于子例程/写语句的每次调用。
子程序的调用:
integer :: l,kreise
character(*)::setname
real(8),diemnsion(:,:,:),allocatable::stripe
integer,dimension(:)s(j)
...code and allocation of arrays...
do j=n(1)
call geradheit_linial (s(j),stripe(j,1:s(j),1),
& stripe(j,1:s(j),2),setname)
end do
...
subroutine geradheit_linial (ndaten,x,r,setname)
implicit none
integer,intent(in) :: ndaten
real(8),dimension(ndaten),intent(in) :: x,r
character(*),intent(in) :: setname
和写声明:
write(91,*)'Gerade: ',gerade(maxloc(reslt(1:i)),minsumloc,1),
& gerade(maxloc(reslt(1:i)),minsumloc,2)
数组stripe
分配有每个维度预期的最大值,因此大多数时候只有一个子集通过调用。
据我了解,就准确性而言,这并不是真正的问题,但可能会减慢程序的速度,因此完成了对 RAM 的大量写入。那么它会减慢我的计算速度(stripe
可能有大约的维度stripe(100,300,3)
并且可能在以后的某个时间变大)?我怎样才能避免这样的额外数组?