I need ideas about practical and interesting examples using TParallel.Join. Anyone? :)

Comments

  1. Petar Georgiev I was refering to the parallel library in general.

    I'm not sure what you mean when you say passing arguments would be a nightmare?

    ReplyDelete
  2. AsbjĆørn Heid I was thinking about implementation details. For example each handler should receive information for which column/row it should work.

    ReplyDelete
  3. Petar Georgiev Something like this (not tested):

    for dim := 0 to Data.NumDims-1 do
    begin
      SetLength(tasks, Data.NumElements[dim]);

      for i := 0 to Data.NumElements[dim]-1 do
      begin
        tasks[i] :=
          procedure
          begin
            GaussianBlur1D(Data, dim, i);
          end;
       end;

       TParallel.Join(tasks).Wait;

       tasks := nil;
    end;

    In the real world you'd probably want to operate on slices and not just one row/column at a time, but that's an optimization detail.

    ReplyDelete

Post a Comment