diff options
author | hinder <hinder@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2012-01-31 19:18:30 +0000 |
---|---|---|
committer | hinder <hinder@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2012-01-31 19:18:30 +0000 |
commit | 100c3733a8d90eadc785becbd48494c7dfa67c73 (patch) | |
tree | a2212ae951d3132ea646b98329d799929ea8e8f2 /lib/sbin | |
parent | a2309eb58c5107a4afdac9aaa2d044a7680242ce (diff) |
Merge branch 'NewSchedule' into trunk
This provides support for specifying READS and WRITES clauses for each
function scheduled in schedule.ccl. These list the variables which
the scheduled function reads from or writes to. This supports future
dependency-based scheduling. See
https://docs.einsteintoolkit.org/et-docs/Adding_requirements_to_the_Cactus_scheduler
for more information.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4788 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin')
-rw-r--r-- | lib/sbin/CreateScheduleBindings.pl | 36 | ||||
-rw-r--r-- | lib/sbin/ScheduleParser.pl | 35 |
2 files changed, 59 insertions, 12 deletions
diff --git a/lib/sbin/CreateScheduleBindings.pl b/lib/sbin/CreateScheduleBindings.pl index 045b5d7a..095d49dc 100644 --- a/lib/sbin/CreateScheduleBindings.pl +++ b/lib/sbin/CreateScheduleBindings.pl @@ -499,8 +499,11 @@ sub ScheduleBlock my($trigger_groups); my($sync_groups); my(@options); + my($tags); my(@before_list); my(@after_list); + my(@writes_list); + my(@reads_list); my(@while_list); my(@if_list); @@ -532,6 +535,8 @@ sub ScheduleBlock $rhinterface_db); @options = split(/,/, $rhschedule_db->{"\U$thorn\E BLOCK_$block OPTIONS"}); + $tags = $rhschedule_db->{"\U$thorn\E BLOCK_$block TAGS"}; + $tags = '' if ! defined $tags; @before_list = &ScheduleSelectRoutines($thorn, $implementation, $rhschedule_db->{"\U$thorn\E BLOCK_$block BEFORE"}, @@ -541,6 +546,14 @@ sub ScheduleBlock $rhschedule_db->{"\U$thorn\E BLOCK_$block AFTER"}, $rhschedule_db); + @writes_list = &ScheduleSelectRoutines($thorn, $implementation, + $rhschedule_db->{"\U$thorn\E BLOCK_$block WRITES"}, + $rhschedule_db); + + @reads_list = &ScheduleSelectRoutines($thorn, $implementation, + $rhschedule_db->{"\U$thorn\E BLOCK_$block READS"}, + $rhschedule_db); + @while_list = &ScheduleSelectVars($thorn, $implementation, $rhschedule_db->{"\U$thorn\E BLOCK_$block WHILE"}, $rhinterface_db); @@ -648,16 +661,25 @@ sub ScheduleBlock # $help .= 'IO methods to decide whether of not execution should happen.'; # &CST_error(0,$mess,$help,__LINE__,__FILE__); # } - $buffer .= $indent . scalar(@$sync_groups) . ", /* Number of SYNC groups */\n"; - $buffer .= $indent . scalar(@options) . ", /* Number of Options */\n"; - $buffer .= $indent . scalar(@before_list) . ", /* Number of BEFORE routines */\n"; - $buffer .= $indent . scalar(@after_list) . ", /* Number of AFTER routines */\n"; - $buffer .= $indent . scalar(@while_list) . ", /* Number of WHILE variables */\n"; - $buffer .= $indent . scalar(@if_list) . ", /* Number of IF variables */\n"; + $buffer .= $indent . scalar(@$sync_groups) . ", /* Number of SYNC groups */\n"; + $buffer .= $indent . scalar(@writes_list) . ", /* Number of WRITES clauses */\n"; + $buffer .= $indent . scalar(@reads_list) . ", /* Number of READS clauses */\n"; + $buffer .= $indent . scalar(@options) . ", /* Number of Options */\n"; + $buffer .= $indent . scalar(@before_list) . ", /* Number of BEFORE routines */\n"; + $buffer .= $indent . scalar(@after_list) . ", /* Number of AFTER routines */\n"; + $buffer .= $indent . scalar(@while_list) . ", /* Number of WHILE variables */\n"; + $buffer .= $indent . scalar(@if_list) . ", /* Number of IF variables */\n"; $buffer .= $indent . "cctkschedulei_tlevelarray /* Array of timelevel data for storage groups */"; foreach $item (@$mem_groups, @$comm_groups, @$trigger_groups, @$sync_groups, - @options, @before_list, @after_list, @while_list, @if_list) + @writes_list, @reads_list, @options) + { + $buffer .= ",\n$indent\"$item\""; + } + + $buffer .= ",\n$indent\"$tags\""; + + foreach $item (@before_list, @after_list, @while_list, @if_list) { $buffer .= ",\n$indent\"$item\""; } diff --git a/lib/sbin/ScheduleParser.pl b/lib/sbin/ScheduleParser.pl index 9fdff5f5..7670b19d 100644 --- a/lib/sbin/ScheduleParser.pl +++ b/lib/sbin/ScheduleParser.pl @@ -113,7 +113,8 @@ sub parse_schedule_ccl my($n_statements); my($name, $as, $type, $description, $where, $language, $mem_groups, $comm_groups, $trigger_groups, $sync_groups, - $options, $before_list, $after_list, $while_list, $if_list); + $options, $tags, $before_list, $after_list, + $writes_list, $reads_list, $while_list, $if_list); my($groups); $buffer = ""; @@ -127,8 +128,9 @@ sub parse_schedule_ccl ($line_number, $name, $as, $type, $description, $where, $language, $mem_groups, $comm_groups, $trigger_groups, $sync_groups, - $options,$before_list, $after_list, $while_list, $if_list) - = &ParseScheduleBlock($thorn,$line_number, @data); + $options, $tags, $before_list, $after_list, + $writes_list, $reads_list, $while_list, $if_list) = + &ParseScheduleBlock($thorn,$line_number, @data); $schedule_db{"\U$thorn\E BLOCK_$n_blocks NAME"} = $name; $schedule_db{"\U$thorn\E BLOCK_$n_blocks AS"} = $as; @@ -141,8 +143,11 @@ sub parse_schedule_ccl $schedule_db{"\U$thorn\E BLOCK_$n_blocks TRIG"} = $trigger_groups; $schedule_db{"\U$thorn\E BLOCK_$n_blocks SYNC"} = $sync_groups; $schedule_db{"\U$thorn\E BLOCK_$n_blocks OPTIONS"} = $options; + $schedule_db{"\U$thorn\E BLOCK_$n_blocks TAGS"} = $tags; $schedule_db{"\U$thorn\E BLOCK_$n_blocks BEFORE"} = $before_list; $schedule_db{"\U$thorn\E BLOCK_$n_blocks AFTER"} = $after_list; + $schedule_db{"\U$thorn\E BLOCK_$n_blocks WRITES"} = $writes_list; + $schedule_db{"\U$thorn\E BLOCK_$n_blocks READS"} = $reads_list; $schedule_db{"\U$thorn\E BLOCK_$n_blocks WHILE"} = $while_list; $schedule_db{"\U$thorn\E BLOCK_$n_blocks IF"} = $if_list; @@ -196,11 +201,14 @@ sub ParseScheduleBlock my($thorn,$line_number, @data) = @_; my($name, $as, $type, $description, $where, $language, $mem_groups, $comm_groups, $trigger_groups, $sync_groups, - $options, $before_list, $after_list, $while_list, $if_list); + $options, $tags, $before_list, $after_list, + $writes_list, $reads_list, $while_list, $if_list); my(@fields); my($field); my(@before_list) = (); my(@after_list) = (); + my(@writes_list) = (); + my(@reads_list) = (); my(@while_list) = (); my(@if_list) = (); my(@mem_groups) = (); @@ -208,6 +216,7 @@ sub ParseScheduleBlock my(@trigger_groups) = (); my(@sync_groups) = (); my(@options) = (); + my(@tags) = (); my($keyword) = ""; my(@current_sched_list) = (); @@ -467,10 +476,22 @@ sub ParseScheduleBlock { push(@sync_groups, split(/\s+|\s*,\s*/, $1)); } + elsif($data[$line_number] =~ m/^\s*WRITES\s*:\s*(.*)$/i) + { + push(@writes_list, split(/\s+|\s*,\s*/, $1)); + } + elsif($data[$line_number] =~ m/^\s*READS\s*:\s*(.*)$/i) + { + push(@reads_list, split(/\s+|\s*,\s*/, $1)); + } elsif($data[$line_number] =~ m/^\s*OPTI[^:]*:\s*(.*)$/i) { push(@options, split(/\s+|\s*,\s*/, $1)); } + elsif($data[$line_number] =~ m/^\s*TAGS[^:]*:\s*(.*)$/i) + { + push(@tags, $1); + } elsif($data[$line_number] =~ m/^\s*LANG[^:]*:\s*(.*)$/i) { if($language ne "") @@ -518,8 +539,11 @@ sub ParseScheduleBlock $trigger_groups = join(",", @trigger_groups); $sync_groups = join(",", @sync_groups); $options = join(",", @options); + $tags = join(" ", @tags); $before_list = join(",", @before_list); $after_list = join(",", @after_list); + $writes_list = join(",", @writes_list); + $reads_list = join(",", @reads_list); $while_list = join(",", @while_list); $if_list = join(",", @if_list); @@ -527,7 +551,8 @@ sub ParseScheduleBlock return ($line_number, $name, $as, $type, $description, $where, $language, $mem_groups, $comm_groups, $trigger_groups, $sync_groups, - $options,$before_list, $after_list, $while_list, $if_list); + $options, $tags, $before_list, $after_list, + $writes_list, $reads_list, $while_list, $if_list); } |