按照这个最佳实践指南,我的 Fortran 代码中有一个模块定义了双精度类型,
module kind_parameters
implicit none
public
! Double precision real numbers, 15 digits, range 10^-307 to 10^307-1; 64 bits
integer, parameter :: dp = selected_real_kind(15, 307)
end module kind_parameters
我的代码在所有浮点运算中都使用这种双精度类型,并经常使用 MKL。在这里,我总是使用 MKL 子程序的双精度版本,即 DGEMM 和 DSYEVD。
我不清楚我的用户定义类型是否与 MKL 期望的双精度类型一致。到目前为止,我使用 ifort/ifx 进行的所有测试似乎都运行良好,但我的做法是否存在潜在的缺陷?有没有更好的方法?