Why is vectorization, faster in general, than loops?

后端 未结 3 2156
我在风中等你
我在风中等你 2020-11-28 19:13

Why, at the lowest level of the hardware performing operations and the general underlying operations involved (i.e.: things general to all programming languages\' actual imp

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-28 19:49

    Vectorization is a type of parallel processing. It enables more computer hardware to be devoted to performing the computation, so the computation is done faster.

    Many numerical problems, especially solution of partial differential equations, require the same calculation to be performed for a large number of cells, elements or nodes. Vectorization performs the calculation for many cells/elements/nodes in parallel.

    Vectorization uses special hardware. Unlike a multicore CPU, for which each of the parallel processing units is a fully functional CPU core, vector processing units can perform only simple operations, and all the units perform the same operation at the same time, operating on a sequence of data values (a vector) simultaneously.

提交回复
热议问题