Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Fix another bunch of shebang with env
[simgrid.git] / examples / simdag / dax / generate_forkjoin.pl
1 #! /usr/bin/env perl
2
3 # Copyright (c) 2009, 2014. The SimGrid Team.
4 # All rights reserved.
5
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of the license (GNU LGPL) which comes with this package.
8
9 use strict;
10
11 my $node_count = int($ARGV[0]) || die "Usage: $0 node_count level_count\n";
12 my $level_count = int($ARGV[1]) || die "Usage: $0 node_count level_count\n";
13
14 print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
15 print "<!-- generated: ".(localtime())." -->\n";
16 print "<adag xmlns=\"http://pegasus.isi.edu/schema/DAX\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://pegasus.isi.edu/schema/DAX http://pegasus.isi.edu/schema/dax-2.1.xsd\" version=\"2.1\" count=\"1\" index=\"0\" name=\"test\" jobCount=\"25\" fileCount=\"0\" childCount=\"20\">\n";
17
18 for (my $level=1;$level<=$level_count;$level++) {
19     for (my $i=1;$i<=$node_count;$i++) {
20         print "<job id=\"node$i\" namespace=\"ForkJoin\" name=\"level$level\" version=\"1.0\" runtime=\"10\">\n";
21         print "  <uses file=\"n${i}_l${level}_in\" link=\"input\" register=\"true\" transfer=\"true\" optional=\"false\" type=\"data\" size=\"1000\"/>\n";
22         print "  <uses file=\"n${i}_l${level}_out\" link=\"output\" register=\"true\" transfer=\"true\" optional=\"false\" type=\"data\" size=\"1000\"/>\n";
23         print "</job>\n";
24     }
25
26     if ($level<$level_count) {
27         print "<job id=\"join$level\" namespace=\"ForkJoin\" name=\"join\" version=\"1.0\" runtime=\"10\">\n";
28         for (my $i=1;$i<=$node_count;$i++) {
29             print "  <uses file=\"n${i}_l${level}_out\" link=\"input\" register=\"true\" transfer=\"true\" optional=\"false\" type=\"data\" size=\"1000\"/>\n";
30             print "  <uses file=\"n${i}_l".(${level}+1)."_in\" link=\"output\" register=\"true\" transfer=\"true\" optional=\"false\" type=\"data\" size=\"1000\"/>\n";
31         }
32         print "</job>\n";
33     }
34 }
35
36 print "</adag>\n";