Changeset 3e9ec44
- Timestamp:
- Sep 16, 2021, 12:05:18 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- f46b26b8
- Parents:
- fa6233a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/rmit.py
rfa6233a r3e9ec44 16 16 import random 17 17 import re 18 import socket 18 19 import subprocess 19 20 import sys … … 95 96 return nopts 96 97 98 # returns the first option with key 'opt' 99 def search_option(action, opt): 100 i = 0 101 while i < len(action): 102 if action[i] == opt: 103 i += 1 104 if i != len(action): 105 return action[i] 106 i += 1 107 108 return None 109 97 110 def actions_eta(actions): 98 111 time = 0 99 112 for a in actions: 100 i = 0 101 while i < len(a): 102 if a[i] == '-d': 103 i += 1 104 if i != len(a): 105 time += int(a[i]) 106 i += 1 113 o = search_option(a, '-d') 114 if o : 115 time += int(o) 107 116 return time 117 118 taskset_maps = None 119 120 def init_taskset_maps(): 121 global taskset_maps 122 known_hosts = { 123 "jax": { 124 range( 1, 24) : "48-71", 125 range( 25, 48) : "48-71,144-167", 126 range( 49, 96) : "48-95,144-191", 127 range( 97, 144) : "24-95,120-191", 128 range(145, 192) : "0-95,96-191", 129 }, 130 } 131 132 if (host := socket.gethostname()) in known_hosts: 133 taskset_maps = known_hosts[host] 134 return True 135 136 print("Warning unknown host '{}', disable taskset usage".format(host), file=sys.stderr) 137 return False 138 139 140 def settaskset_one(action): 141 o = search_option(action, '-p') 142 if not o: 143 return action 144 try: 145 oi = int(o) 146 except ValueError: 147 return action 148 149 m = "Not found" 150 for key in taskset_maps: 151 if oi in key: 152 return ['taskset', '-c', taskset_maps[key], *action] 153 154 print("Warning no mapping for {} cores".format(oi), file=sys.stderr) 155 return action 156 157 def settaskset(actions): 158 return [settaskset_one(a) for a in actions] 108 159 109 160 if __name__ == "__main__": … … 115 166 parser.add_argument('--file', nargs='?', type=argparse.FileType('w'), default=sys.stdout) 116 167 parser.add_argument('--trials', help='Number of trials to run per combinaison', type=int, default=3) 168 parser.add_argument('--notaskset', help='If specified, the trial will not use taskset to match the -p option', action='store_true') 117 169 parser.add_argument('command', metavar='command', type=str, nargs=1, help='the command prefix to run') 118 170 parser.add_argument('candidates', metavar='candidates', type=str, nargs='*', help='the candidate suffix to run') … … 170 222 171 223 # ================================================================================ 172 # Figure out all the combinations to run 224 # Fixup the different commands 225 226 # Add tasksets 227 if not options.notaskset and init_taskset_maps(): 228 actions = settaskset(actions) 229 230 # ================================================================================ 231 # Now that we know what to run, print it. 173 232 if options.list: 174 233 for a in actions:
Note: See TracChangeset
for help on using the changeset viewer.