英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论