Login  Register

Re: Does Java use the GPU

Posted by Wayne Rasband-2 on May 10, 2021; 3:33pm
URL: http://imagej.273.s1.nabble.com/Does-Java-use-the-GPU-tp5024656p5024659.html

> On May 9, 2021, at 3:13 PM, Robert Dougherty <[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.

The Plugins>Utilities>Benchmark command in the latest ImageJ daily build (1.53j42) is partially multi-threaded and it outputs a table useful for comparing speeds.

      Time       Computer
  1  10.9   MacBook Air (M1, 2020, Native)
  2  17.2   iMac Pro (2017)
  3  18.1   MacBook Air (M1, 2020, Rosetta)
  4  19.8   <<THIS MACHINE>>
  5  24.7   27" iMac (Early 2015)
  6  29.7   13" MacBook Pro (Late 2015)
  7  29.7   15" MacBook Pro (Early 2013)
  8  62.3   Acer Aspire laptop (Core i5, 2014)

-wayne

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