|
11 | 11 | CPUNormalizationFactor = 23.7 # corrected value (by JobScheduling/CPUNormalizationCorrection)
|
12 | 12 | DB12measured = 15.4
|
13 | 13 | }
|
14 |
| -
|
15 |
| -DB12measured is up to now wrote down but never used. |
16 | 14 | """
|
17 |
| -from db12 import single_dirac_benchmark |
| 15 | +from db12 import multiple_dirac_benchmark |
18 | 16 |
|
19 | 17 | import DIRAC
|
20 | 18 | from DIRAC.Core.Base.Script import Script
|
|
25 | 23 |
|
26 | 24 | @Script()
|
27 | 25 | def main():
|
| 26 | + Script.registerSwitch("N:", "NumberOfProcessors=", "Run n parallel copies of the benchmark") |
28 | 27 | Script.registerSwitch("U", "Update", "Update dirac.cfg with the resulting value")
|
29 | 28 | Script.registerSwitch("R:", "Reconfig=", "Update given configuration file with the resulting value")
|
30 | 29 | Script.parseCommandLine(ignoreErrors=True)
|
31 | 30 |
|
32 | 31 | update = False
|
33 | 32 | configFile = None
|
| 33 | + numberOfProcessors = 0 |
34 | 34 |
|
35 | 35 | for unprocSw in Script.getUnprocessedSwitches():
|
36 | 36 | if unprocSw[0] in ("U", "Update"):
|
37 | 37 | update = True
|
38 | 38 | elif unprocSw[0] in ("R", "Reconfig"):
|
39 | 39 | configFile = unprocSw[1]
|
| 40 | + elif unprocSw[0] in ("N", "NumberOfProcessors"): |
| 41 | + try: |
| 42 | + numberOfProcessors = int(unprocSw[1]) |
| 43 | + except ValueError: |
| 44 | + gLogger.warn("Cannot make benchmark measurements: NumberOfProcessors is not a number") |
| 45 | + |
| 46 | + # if numberOfProcessors has not been provided, try to get it from the configuration |
| 47 | + if not numberOfProcessors: |
| 48 | + numberOfProcessors = gConfig.getValue("/Resources/Computing/CEDefaults/NumberOfProcessors", 1) |
| 49 | + |
| 50 | + gLogger.info("Computing benchmark measurements on", "%d processor(s)..." % numberOfProcessors) |
40 | 51 |
|
41 | 52 | # we want to get the logs coming from db12
|
42 | 53 | gLogger.enableLogsFromExternalLibs()
|
43 |
| - result = single_dirac_benchmark() |
| 54 | + |
| 55 | + # multiprocessor allocations generally have a CPU Power lower than single core one. |
| 56 | + # in order to avoid having wrong estimations, we run multiple copies of the benchmark simultaneously |
| 57 | + result = multiple_dirac_benchmark(numberOfProcessors) |
44 | 58 |
|
45 | 59 | if result is None:
|
46 | 60 | gLogger.error("Cannot make benchmark measurements")
|
47 | 61 | DIRAC.exit(1)
|
48 | 62 |
|
49 |
| - db12Measured = round(result["NORM"], 1) |
| 63 | + # we take a conservative approach and use the minimum value returned as the CPU Power |
| 64 | + db12Result = min(result["raw"]) |
| 65 | + # because hardware is continuously evolving, original benchmark scores might need a correction |
50 | 66 | corr = Operations().getValue("JobScheduling/CPUNormalizationCorrection", 1.0)
|
51 |
| - norm = round(result["NORM"] / corr, 1) |
52 | 67 |
|
53 |
| - gLogger.notice("Estimated CPU power is %.1f HS06" % norm) |
| 68 | + gLogger.info("Applying a correction on the CPU power:", corr) |
| 69 | + cpuPower = round(db12Result / corr, 1) |
| 70 | + |
| 71 | + gLogger.notice("Estimated CPU power is %.1f HS06" % cpuPower) |
54 | 72 |
|
55 | 73 | if update:
|
56 |
| - gConfig.setOptionValue("/LocalSite/CPUNormalizationFactor", norm) |
57 |
| - gConfig.setOptionValue("/LocalSite/DB12measured", db12Measured) |
| 74 | + gConfig.setOptionValue("/LocalSite/CPUNormalizationFactor", cpuPower) |
58 | 75 |
|
59 | 76 | if configFile:
|
60 | 77 | gConfig.dumpLocalCFGToFile(configFile)
|
|
0 commit comments