Login  Register

Re: Does Java use the GPU

Posted by Dr. Michael DOUBE on May 11, 2021; 1:45am
URL: http://imagej.273.s1.nabble.com/Does-Java-use-the-GPU-tp5024656p5024661.html

On 10/05/2021 23:33, Wayne Rasband wrote:

On May 9, 2021, at 3:13 PM, Robert Dougherty <[hidden email]><mailto:[hidden email]> wrote:

Dear All,
I've been asked a question about selecting a computer: is the speed of the CPU or the GPU more important?  In this case the plugins to be executed are very compute intensive and only make images of the results at the end.  So the the first thought is CPU.  But a colleague suggested that maybe Java is using the GPU for numerics behind the scene.  Clearly this could be made to happen by calling a library that finds and uses a GPU on purpose.  Is ImageJ doing this explicitly or somehow implicitly, apart from displaying graphics? I think probably not, since using the the FPU on the CPU would be faster than setting up a call to the GPU unless a lot of operations were queued up.



The speed of the CPU is more important unless you a using a plugin that uses the GPU. Neither Java or the ImageJ core use the GPU. The easiest way to speed up compute intensive code is to use multi-threading. The Process>Filter>Gaussian Blur command is 4 times slower when I change the number of threads from 8 to 1 in Edit>Options>Memory and Threads.


To muddy the water even further: RAM speed and parallelism is also important when your operation is not very computationally intensive, but does require a lot of memory access (especially random / non-sequential access). The "memory wall" can inhibit getting full use of CPU threads, because the bottleneck can be getting data to and from RAM rather than doing the calculation. Whether the much faster video RAM on GPGPUs improves the situation is likely to be application specific.

In recent work I found not much improvement in speed of a parallelised process on more than c. 10-16 threads, which seems to be a memory issue (16 DIMMs installed) rather than a CPU issue (dual Xeon with 40 CPU threads). https://doi.org/10.1098/rsos.201784

Michael

<http://www.cityu.edu.hk/ph>



<http://www.cityu.edu.hk/ph>










Disclaimer: This email (including any attachments) is for the use of the intended recipient only and may contain confidential information and/or copyright material. If you are not the intended recipient, please notify the sender immediately and delete this email and all copies from your system. Any unauthorized use, disclosure, reproduction, copying, distribution, or other form of unauthorized dissemination of the contents is expressly prohibited.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html