Mercurial > hg > GearsTemplate
comparison src/parallel_execution/generate_stub.pl @ 402:e958a409943c
Change iterator implement from oneDim to multiDim
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 01 Sep 2017 06:18:53 +0900 |
parents | 408b4aab7610 |
children | 83c9aeb1fe3e |
comparison
equal
deleted
inserted
replaced
401:408b4aab7610 | 402:e958a409943c |
---|---|
418 my $codeGearName = $2; | 418 my $codeGearName = $2; |
419 my $inputCount = $codeGear{$codeGearName}->{'input'}; | 419 my $inputCount = $codeGear{$codeGearName}->{'input'}; |
420 my $outputCount = $codeGear{$codeGearName}->{'output'}; | 420 my $outputCount = $codeGear{$codeGearName}->{'output'}; |
421 my @dataGears = split(/,\s*/, $3); | 421 my @dataGears = split(/,\s*/, $3); |
422 my $nextCodeGear = pop(@dataGears); | 422 my $nextCodeGear = pop(@dataGears); |
423 my $iterateCount; | 423 my $iterateCounts; |
424 # parse examples 'par goto(.., iterate(10), exit);' | 424 # parse examples 'par goto(.., iterate(10), exit);' |
425 if ($3 =~ /iterate\((\d*)\)/) { | 425 if ($3 =~ /iterate\((.*)?\)/) { |
426 $iterateCount = $1; | 426 $iterateCounts = $1; |
427 $inputCount--; | 427 $inputCount--; |
428 # pop iterate statement | 428 # pop iterate statement |
429 pop(@dataGears); | 429 pop(@dataGears); |
430 } | 430 } |
431 if (! $inParGoto) { | 431 if (! $inParGoto) { |
443 ${prev}task->maxIdg = task->idg + $inputCount; | 443 ${prev}task->maxIdg = task->idg + $inputCount; |
444 ${prev}task->odg = task->maxIdg; | 444 ${prev}task->odg = task->maxIdg; |
445 ${prev}task->maxOdg = task->odg + $outputCount; | 445 ${prev}task->maxOdg = task->odg + $outputCount; |
446 EOFEOF | 446 EOFEOF |
447 print $fd $initTask; | 447 print $fd $initTask; |
448 if (defined $iterateCount) { | 448 if (defined $iterateCounts) { |
449 print $fd "${prev}task->iterate = 0;\n"; | 449 print $fd "${prev}task->iterate = 0;\n"; |
450 print $fd "${prev}task->iterator = createOneDimIterator(context, $iterateCount);\n"; | 450 print $fd "${prev}task->iterator = createMultiDimIterator(context, $iterateCounts);\n"; |
451 } | 451 } |
452 for my $i (0..$inputCount-1) { | 452 for my $i (0..$inputCount-1) { |
453 print $fd "${prev}task->data[task->idg+$i] = (union Data*)@dataGears[$i];\n"; | 453 print $fd "${prev}task->data[task->idg+$i] = (union Data*)@dataGears[$i];\n"; |
454 } | 454 } |
455 | 455 |