I have a program written in java, it performs high computations and it runs an algorithm with a time complexity of O(log N). I wonder if I get a powerful GPU will make a difference in the execution time of the program? Will I need to modify my code or just set up the new GPU and run the program?
Asked
Active
Viewed 4,080 times
1
-
Java by itself, has no functionality for utilising the GPU. However, if you use a library like OpenCL, which can be called from Java. You can write **parallel programs** in Java. However, what you are attempting to do is not a simple task, and requires experience and patience. – Dylan Mar 26 '19 at 18:34
-
1here is a question that should help you: https://stackoverflow.com/questions/22866901/using-java-with-nvidia-gpus-cuda – Jeryl Cook Mar 26 '19 at 18:34
-
Possible duplicate of [Using Java with Nvidia GPU's (cuda)](https://stackoverflow.com/questions/22866901/using-java-with-nvidia-gpus-cuda) – Mr00Anderson Mar 26 '19 at 18:35
-
My thought was to do the Bcrypt hashing on the GPU since it's quite resource hungry on CPU. – sam Apr 15 '20 at 03:59
1 Answers
2
See other answers like Using Java with Nvidia GPU's (cuda). But basically it boils down to whether your program would go faster if you had a thousand super slow computers or not. Time complexity doesn't really capture the amount of forking your problem can do. Things binary search which is log N won't go faster with more processors. But, if you were doing a million binary searches on the same data then maybe.

Tatarize
- 10,238
- 4
- 58
- 64
-
Yes that what I mean, runs millions of Log N's, my algorithm is actualy Red Black Tree. Which means it guarantee to run at Time Complexity O(Log N). After the research I made, if I am not wrong, I would need to use Java to exploit the use of CUDA cores, because the traditional code would not make use of the CUDA cores, I guess operating systems should do the job for you, but I see that they don't! – Mrfrog Mar 29 '19 at 21:39
-
You could likely do multicore versions pretty easily. Assuming things aren't being inserted and changing the memory as such. It's certainly doable but making sure everything is synchronized properly is sometimes a pain. – Tatarize Mar 29 '19 at 22:25