3 # Copyright (c) 2011-2023. The SimGrid Team.
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.
10 This script generates a specific deployment file for the Chord example.
11 It assumes that the platform will be a cluster.
12 Usage: python generate.py nb_nodes nb_bits end_date
13 Example: python generate.py 100000 32 1000
19 if len(sys.argv) != 4:
21 "Usage: python generate.py nb_nodes nb_bits end_date > deployment_file.xml")
24 nb_nodes = int(sys.argv[1])
25 nb_bits = int(sys.argv[2])
26 end_date = int(sys.argv[3])
28 max_id = 2 ** nb_bits - 1
31 sys.stdout.write("<?xml version='1.0'?>\n"
32 "<!DOCTYPE platform SYSTEM \"https://simgrid.org/simgrid.dtd\">\n"
33 "<platform version=\"3\">\n"
34 " <actor host=\"node-0.simgrid.org\" function=\"node\"><argument value=\"42\"/>"
35 "<argument value=\"%d\"/></actor>\n" % end_date)
37 for i in range(1, nb_nodes):
41 my_id = random.randint(0, max_id)
42 ok = my_id not in all_ids
44 known_id = all_ids[random.randint(0, len(all_ids) - 1)]
46 line = " <actor host=\"node-%d.simgrid.org\" function=\"node\"><argument value=\"%d\" />" \
47 "<argument value=\"%d\" /><argument value=\"%d\" /><argument value=\"%d\" /></actor>\n" % (
48 i, my_id, known_id, start_date, end_date)
49 sys.stdout.write(line)
52 sys.stdout.write("</platform>")