Get link Facebook X Pinterest Email Other Apps - March 07, 2015 I need ideas about practical and interesting examples using TParallel.Join. Anyone? :) Get link Facebook X Pinterest Email Other Apps Comments AsbjĆørn HeidMarch 7, 2015 at 7:58 AMPetar 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?ReplyDeleteRepliesReplyPetar GeorgievMarch 7, 2015 at 8:13 AMAsbjĆørn Heid I was thinking about implementation details. For example each handler should receive information for which column/row it should work.ReplyDeleteRepliesReplyAsbjĆørn HeidMarch 7, 2015 at 8:22 AMPetar Georgiev Something like this (not tested):for dim := 0 to Data.NumDims-1 dobegin 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.ReplyDeleteRepliesReplyAdd commentLoad more... Post a Comment
Petar Georgiev I was refering to the parallel library in general.
ReplyDeleteI'm not sure what you mean when you say passing arguments would be a nightmare?
AsbjĆørn Heid I was thinking about implementation details. For example each handler should receive information for which column/row it should work.
ReplyDeletePetar Georgiev Something like this (not tested):
ReplyDeletefor 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.