我已经创建了一个应该向量化的非常简单的循环的简短示例。消息
调用函数log10f无法进行矢量化
是我不明白的。
为什么库中没有alog10
的矢量化版本?
program test
real a(100)
do i = 1,100
a(i) = a(i) = 4.31 + alog10(max(50.0, real(i)))
end do
call sub(a)
stop
end
使用ifort编译
ifort -o x.o -c -O3 -xAVX -mkl -ip -fp-model precise -w -ftz -align all -fno-alias -FR
-convert big_endian -g -vec_report3 -opt_report_phase hlo -opt-report-phase hpo
-opt-report-phase ipo_inl x.f90
我收到报告
INLINING OPTION VALUES:
-inline-factor: 100
-inline-min-size: 30
-inline-max-size: 230
-inline-max-total-size: 2000
-inline-max-per-routine: disabled
-inline-max-per-compile: disabled
<x.f90;1:12;IPO INLINING;MAIN__;0>
INLINING REPORT: (MAIN__) [1/1=100.0%]
-> for_stop_core(EXTERN)
-> sub_(EXTERN)
-> log10f(EXTERN)
-> for_set_reentrancy(EXTERN)
-> for_set_fpe_(EXTERN)
HPO VECTORIZER REPORT (MAIN__) LOG OPENED ON Wed Dec 31 12:48:17 2014
<x.f90;-1:-1;hpo_vectorization;MAIN__;0>
HPO Vectorizer Report (MAIN__)
x.f90(6:11-6:11):VEC:MAIN__: vectorization support: call to function log10f cannot be
vectorized
x.f90(6): (col. 11) remark: loop was not vectorized: statement cannot be vectorized
loop was not vectorized: statement cannot be vectorized
答案 0 :(得分:0)
更多评论而不是答案......
为什么不尝试使用矢量化表达式?也许
a = log10([(I, I=1, 100)])
警告您有责任确保代码段的语法正确无误。