SIMD or not SIMD - cross platform

后端 未结 6 1614
别跟我提以往
别跟我提以往 2021-02-04 08:59

I need some idea how to write a C++ cross platform implementation of a few parallelizable problems in a way so I can take advantage of SIMD (SSE, SPU, etc) if available. As well

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-04 09:05

    Notice that the given example decides what to execute at compile time (since you're using the preprocessor), in this case you can use more complex techniques to decide what you actually want to execute; For example, Tag Dispatch: http://cplusplus.co.il/2010/01/03/tag-dispatching/ Following the example shown there, you could have the fast implementation be with SIMD, and the slow without.

提交回复
热议问题