numpy 的基本操作是否矢量化,即它们是否使用 SIMD 操作? [英] Are numpy's basic operations vectorized, i.e. do they use SIMD operations?
本文介绍了numpy 的基本操作是否矢量化,即它们是否使用 SIMD 操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在做一些性能分析,我想知道 numpy
是否在数据类型已知(双精度)时对其标准数组操作进行矢量化.
I am doing some performance analysis, and i wonder, whether numpy
vectorizes its standard array operations, when the datatype is known (double).
a, b = (some numpy arrays)
c = a + b #Is this vectorized?
此操作是否向量化,即计算是否包含 SIMD 操作?
Is this operation vectorized, i.e. will the computation consist of SIMD operations?
推荐答案
是的,他们是.
/*
* This file is for the definitions of simd vectorized operations.
*
* Currently contains sse2 functions that are built on amd64, x32 or
* non-generic builds (CFLAGS=-march=...)
* In future it may contain other instruction sets like AVX or NEON detected
* at runtime in which case it needs to be included indirectly via a file
* compiled with special options (or use gcc target attributes) so the binary
* stays portable.
*/
链接:Numpy simd.inc.src 在 github 上.
这篇关于numpy 的基本操作是否矢量化,即它们是否使用 SIMD 操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文