Is there a way to get 32 bit (float) values out of Math.sin() or a similar class, maybe smth like Math.sin(float a)

huangapple go评论81阅读模式
英文:

Is there a way to get 32 bit (float) values out of Math.sin() or a similar class, maybe smth like Math.sin(float a)

问题

我正在尝试在Java中利用我的GPU进行实验,我正在使用Aparapi,但我遇到了一个问题,即如果我使用(float)Math.sin(x),它仍会回退到CPU,因为我的GPU不支持F64。是否有适用于浮点数的数学库?我是否应该在GPU上计算正弦值?

英文:

I am experimenting with using my GPU in java, I am using Aparapi but I have an issue where if I use (float)Math.sin(x) it still falls back to the CPU because my GPU doesn't support F64. is there a Math library for floats? should I be using the gpu to calculate sins at all?

答案1

得分: 2

我会期望这样的项目自带数学例程,以便您可以调用在GPU上实现的函数。

而且它确实有:Aparapi中的Kernel.sin(float)应该会映射到对OpenCL sin函数的调用。

至于在GPU上进行三角运算是否有意义,这就由您来评估了。

英文:

I would expect a project like this to come with math routines of its own so that you can call functions implemented on the GPU.

And it does: Kernel.sin(float) in Aparapi should map to a call to the OpenCL sin function.

Whether it makes sense to do trig on the GPU, that's for you to evaluate.

huangapple
  • 本文由 发表于 2020年4月4日 18:20:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/61026673.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定