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?
Asked
Active
Viewed 138 times
1
-
Try using Java 32-bit. Just be wary that operations on ```long``` and ```double``` are not thread-safe. – Radu Mirea Apr 04 '20 at 11:28
-
@MireaRadu Java 32-bit has nothing to do with the size of double. All types in Java are the same regardless of architectures – phuclv Apr 04 '20 at 14:49
1 Answers
2
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.

Joni
- 108,737
- 14
- 143
- 193