Vectorized Trig functions in C?

前端 未结 2 1537
长情又很酷
长情又很酷 2021-02-15 21:40

I\'m looking to calculate highly parallelized trig functions (in block of like 1024), and I\'d like to take advantage of at least some of the parallelism that modern architectur

相关标签:
2条回答
  • 2021-02-15 22:17

    Since you said you were using GCC it looks like there are some options:

    • http://gruntthepeon.free.fr/ssemath/
      • This uses SSE and SSE2 instructions to implement it.
    • http://www.gamasutra.com/view/feature/4248/designing_fast_crossplatform_simd_.php
      • This has an alternate implementation. Some of the comments are pretty good.

    That said, I'd probably look into GPGPU for a solution. Maybe writing it in CUDA or OpenCL (If I remember correctly CUDA supports the sine function). Here are some libraries that look like they might make it easier.

    • https://code.google.com/p/slmath/
    • https://code.google.com/p/thrust/
    0 讨论(0)
  • 2021-02-15 22:20

    Since you are looking to calculate harmonics here, I have some code that addressed a similar problem. It is vectorized already and faster than anything else I have found. As a side benefit, you get the cosine for free.

    0 讨论(0)
提交回复
热议问题