javamathfloating-pointgpuaparapi

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)


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?


Solution

  • 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.