Could we show more in the comment? E.g.,

  # &create_hostlist("node[1-3],nodeXXX", 16)
  # Expands to: node1:16 node2:16 node3:16 nodeXXX:16
  # 
  # &create_hostlist("node,nodeXXX", 16);
  # Expands to: node:16 nodeXXX:16

Also, don't forget to update the CHANGES file with any new INI
funclets, predefined vars, etc.

-Ethan

On Tue, Sep/15/2009 07:04:59AM, mi...@osl.iu.edu wrote:
> Author: miked
> Date: 2009-09-15 07:04:58 EDT (Tue, 15 Sep 2009)
> New Revision: 1316
> URL: https://svn.open-mpi.org/trac/mtt/changeset/1316
> 
> Log:
> added new funclet: create_hostlist
> Text files modified: 
>    trunk/lib/MTT/Values/Functions.pm |    24 ++++++++++++++++++++++++         
>        
>    1 files changed, 24 insertions(+), 0 deletions(-)
> 
> Modified: trunk/lib/MTT/Values/Functions.pm
> ==============================================================================
> --- trunk/lib/MTT/Values/Functions.pm (original)
> +++ trunk/lib/MTT/Values/Functions.pm 2009-09-15 07:04:58 EDT (Tue, 15 Sep 
> 2009)
> @@ -2963,4 +2963,28 @@
>       my $val = $current_report->{$param};
>       return $val;
>  }
> +# generates hostlist for mtt
> +# example: create_hostlist("node[1-100],nodeXXX", 16)
> +sub create_hostlist {
> +     my ($host_list, $cpu_per_node) = @_;
> +
> +     my @hosts = split(/,/,$host_list);
> +
> +     my @expanded_hosts = ();
> +     for (my $x=0; $x < $#hosts + 1; $x++) {
> +             my $h = $hosts[$x];
> +             $h=~s/[\[\]]//g;
> +             if ($h =~ /^([^\d]+)(\d+)-(\d+)$/) {
> +                     my $n = $1;
> +                     for (my $i=$2; $i<=$3;$i++) {
> +                             push @expanded_hosts, $n . $i . ":" . 
> $cpu_per_node;
> +                     }
> +             } else {
> +                     push @expanded_hosts, $h . ":" . $cpu_per_node;
> +             }
> +     }
> +     my $ret = join(" ", @expanded_hosts);
> +     $ret;
> +
> +}
>  1;
> _______________________________________________
> mtt-svn mailing list
> mtt-...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/mtt-svn

Reply via email to