当inc = 1时,BLAS daxpy和dcopy是否比使用(:,t)= b(:,t)更快?

时间:2021-09-21 15:50:45

Well the title says it, I'm doing following kind of operations in Fortran:

好吧标题说,我正在Fortran中进行以下操作:

a(:,t) = b(:,t)
c(:,t) = x(i,t)*d(:,t)

Is there any benefits of using daxpy and dcopy subroutines from BLAS in this case where inc=1?

在inc = 1的情况下,使用BLAS的daxpy和dcopy子程序有什么好处吗?

1 个解决方案

#1


No difference you would ever notice.

没有你会注意到的差异。

BLAS has to be compatible with Fortran 77, that I'm pretty sure didn't have those fancy features.

BLAS必须与Fortran 77兼容,我很确定它没有那些奇特的功能。

Those subroutines are in there to make array or matrix copying 1 line of code, because it's done quite a lot. Cycles tend to get hogged in other routines, like matrix inverse, so copying is not usually a performance issue.

那些子程序在那里进行数组或矩阵复制1行代码,因为它做了很多。循环往往会在其他例程中陷入困境,例如矩阵逆,因此复制通常不是性能问题。

If you're worried about performance, just code it up in a reasonable way. Then what I would do is interrupt it a few times. This will show you where the time's actually going. If it is spending much time in copying, it will tell you. If not, it will tell you.

如果您担心性能,只需以合理的方式进行编码即可。那我要做的就是打断几次。这将显示时间的实际情况。如果它花了很多时间复制,它会告诉你。如果没有,它会告诉你。

#1


No difference you would ever notice.

没有你会注意到的差异。

BLAS has to be compatible with Fortran 77, that I'm pretty sure didn't have those fancy features.

BLAS必须与Fortran 77兼容,我很确定它没有那些奇特的功能。

Those subroutines are in there to make array or matrix copying 1 line of code, because it's done quite a lot. Cycles tend to get hogged in other routines, like matrix inverse, so copying is not usually a performance issue.

那些子程序在那里进行数组或矩阵复制1行代码,因为它做了很多。循环往往会在其他例程中陷入困境,例如矩阵逆,因此复制通常不是性能问题。

If you're worried about performance, just code it up in a reasonable way. Then what I would do is interrupt it a few times. This will show you where the time's actually going. If it is spending much time in copying, it will tell you. If not, it will tell you.

如果您担心性能,只需以合理的方式进行编码即可。那我要做的就是打断几次。这将显示时间的实际情况。如果它花了很多时间复制,它会告诉你。如果没有,它会告诉你。