[ImageJ-devel] [fiji-devel] Imglib2: using threadpools in core algorithms

Tobias Pietzsch pietzsch at mpi-cbg.de
Fri Dec 6 05:15:26 CST 2013


Hi JY,

exactly. That's what I meant when I wrote
> One thing that I'm missing with the ExecutorService is getting an estimate of many worker threads there are. This is useful to guide a heuristic of how many tasks a problem should be split.
> We now just use Runtime.getRuntime().availableProcessors() for that purpose, but it would be nice to have something better. 

Maybe I wasn't being clear enough.

Usually (also in the Gauss) I split the task into number of subtasks that is a multiple of the number available workers.
The reasoning behind this is that the workers might finish a task at different speeds. This can be caused by other stuff (even outside the JVM) using resources. Or it can be caused by simply the tasks being more or less demanding. For instant in spot detection, probably a frame that is completely black will finish a bit earlier than a normal frame.
So if there are N workers and N tasks, N-1 workers are waiting for the slowest task to finish. Splitting into more tasks, once a worker is finished, it will just pick the next unprocessed task.
With very many tasks, I guess there is a point where the task management overhead is slowing it down, so a reasonable heuristic is required (to be defined:-)

best regards,
Tobias

On Dec 6, 2013, at 9:29 AM, Jean-Yves Tinevez <jean-yves.tinevez at pasteur.fr> wrote:

> Hi all
> 
> Ok thank you very much this is inspiring. 
> 
> I see the discussion is still going on and that we (the team) did not reach a definitive conclusion yet. 
> 
> I just want to add a question item to the discussion: 
> Sometimes you need to have information on the multithreading configuration that has been set upstream.
> 
> For instance, taking the example of TrackMate spot detection:
> 
> Each frame of a movie can be processed concurrently: I generate a task for each frame, and can feed this task to any interface we are discussing right now. For this, I do not need to know how many threads are allocated to the service: it will decide how to process the tasks I generated. 
> 
> By there are many algorithms in imglib2 that can process a single image in a multithreaded way, by splitting it into small pieces. For instance, you can compute the Gauss convolution on 2 threads, and it will split the source image in 2. For this, the algorithm needs to have some info on the "multitasking resources" available right? If you have 24 workers, and that each worker receives one frame to segment, the segmenter needs to know it is unwise to split the source image over several extra workers. No?
> 
> How is this achieved in real world applications?
> best
> jy

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://imagej.net/pipermail/imagej-devel/attachments/20131206/d70a0cc5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://imagej.net/pipermail/imagej-devel/attachments/20131206/d70a0cc5/attachment.pgp>


More information about the ImageJ-devel mailing list