Beispiel #1
0
def getCPUNormalization(reference='HS06', iterations=1):
    """ Get Normalized Power of the current CPU in [reference] units
  """
    if reference not in UNITS:
        return S_ERROR('Unknown Normalization unit %s' % str(reference))
    try:
        max(min(int(iterations), 10), 1)
    except (TypeError, ValueError) as x:
        return S_ERROR(x)

    from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
    corr = Operations().getValue('JobScheduling/CPUNormalizationCorrection',
                                 1.)

    result = singleDiracBenchmark(iterations)

    if result is None:
        return S_ERROR('Cannot get benchmark measurements')

    return S_OK({
        'CPU': result['CPU'],
        'WALL': result['WALL'],
        'NORM': result['NORM'] / corr,
        'UNIT': reference
    })
Beispiel #2
0
def main():
    Script.registerSwitch("U", "Update",
                          "Update dirac.cfg with the resulting value")
    Script.registerSwitch(
        "R:", "Reconfig=",
        "Update given configuration file with the resulting value")
    Script.parseCommandLine(ignoreErrors=True)

    update = False
    configFile = None

    for unprocSw in Script.getUnprocessedSwitches():
        if unprocSw[0] in ("U", "Update"):
            update = True
        elif unprocSw[0] in ("R", "Reconfig"):
            configFile = unprocSw[1]

    result = singleDiracBenchmark(1)

    if result is None:
        gLogger.error('Cannot make benchmark measurements')
        DIRAC.exit(1)

    db12Measured = round(result['NORM'], 1)
    corr = Operations().getValue('JobScheduling/CPUNormalizationCorrection',
                                 1.)
    norm = round(result['NORM'] / corr, 1)

    gLogger.notice('Estimated CPU power is %.1f HS06' % norm)

    if update:
        gConfig.setOptionValue('/LocalSite/CPUNormalizationFactor', norm)
        gConfig.setOptionValue('/LocalSite/DB12measured', db12Measured)

        if configFile:
            gConfig.dumpLocalCFGToFile(configFile)
        else:
            gConfig.dumpLocalCFGToFile(gConfig.diracConfigFilePath)

    DIRAC.exit()
Beispiel #3
0
def getCPUNormalization(reference='HS06', iterations=1):
  """ Get Normalized Power of the current CPU in [reference] units
  """
  if reference not in UNITS:
    return S_ERROR('Unknown Normalization unit %s' % str(reference))
  try:
    max(min(int(iterations), 10), 1)
  except (TypeError, ValueError) as x:
    return S_ERROR(x)

  from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
  corr = Operations().getValue('JobScheduling/CPUNormalizationCorrection', 1.)

  result = singleDiracBenchmark(iterations)

  if result is None:
    return S_ERROR('Cannot get benchmark measurements')

  return S_OK({'CPU': result['CPU'],
               'WALL': result['WALL'],
               'NORM': result['NORM'] / corr,
               'UNIT': reference})
Beispiel #4
0
        configFile = unprocSw[1]

if __name__ == "__main__":

    from DIRAC import gLogger, gConfig
    from DIRAC.WorkloadManagementSystem.Client.DIRACbenchmark import singleDiracBenchmark
    from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
    from DIRAC.Core.Utilities import MJF

    mjf = MJF.MJF()
    mjf.updateConfig()

    db12JobFeature = mjf.getJobFeature('db12')
    hs06JobFeature = mjf.getJobFeature('hs06')

    result = singleDiracBenchmark(1)

    if result is None:
        gLogger.error('Cannot make benchmark measurements')
        DIRAC.exit(1)

    db12Measured = round(result['NORM'], 1)
    corr = Operations().getValue('JobScheduling/CPUNormalizationCorrection',
                                 1.)
    norm = round(result['NORM'] / corr, 1)

    gLogger.notice('Estimated CPU power is %.1f HS06' % norm)

    if update:
        gConfig.setOptionValue(
            '/LocalSite/CPUScalingFactor',
Beispiel #5
0
  return maxCPUTime

def getCPUNormalization( reference = 'HS06', iterations = 1 ):
  """ Get Normalized Power of the current CPU in [reference] units
  """
  if reference not in UNITS:
    return S_ERROR( 'Unknown Normalization unit %s' % str( reference ) )
  try:
    max( min( int( iterations ), 10 ), 1 )
  except ( TypeError, ValueError ), x :
    return S_ERROR( x )

  from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
  corr = Operations().getValue( 'JobScheduling/CPUNormalizationCorrection', 1. )

  result = singleDiracBenchmark( iterations )

  if result is None:
    return S_ERROR( 'Cannot get benchmark measurements' )

  return S_OK( {'CPU' : result['CPU'],
                'WALL': result['WALL'],
                'NORM': result['NORM'] / corr,
                'UNIT': reference } )

def getCPUTime( cpuNormalizationFactor ):
  """ Trying to get CPUTime left for execution (in seconds).

      It will first look to get the work left looking for batch system information useing the TimeLeft utility.
      If it succeeds, it will convert it in real second, and return it.

if __name__ == "__main__":

  from DIRAC import gLogger, gConfig
  from DIRAC.WorkloadManagementSystem.Client.DIRACbenchmark import singleDiracBenchmark
  from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
  from DIRAC.Core.Utilities import MJF

  mjf = MJF.MJF()
  mjf.updateConfig()

  db12JobFeature = mjf.getJobFeature('db12')
  hs06JobFeature = mjf.getJobFeature('hs06')

  result = singleDiracBenchmark(1)

  if result is None:
    gLogger.error('Cannot make benchmark measurements')
    DIRAC.exit(1)

  db12Measured = round(result['NORM'], 1)
  corr = Operations().getValue('JobScheduling/CPUNormalizationCorrection', 1.)
  norm = round(result['NORM'] / corr, 1)

  gLogger.notice('Estimated CPU power is %.1f HS06' % norm)

  if update:
    gConfig.setOptionValue('/LocalSite/CPUScalingFactor', hs06JobFeature if hs06JobFeature else norm)  # deprecate?
    gConfig.setOptionValue('/LocalSite/CPUNormalizationFactor', norm)  # deprecate?
    gConfig.setOptionValue('/LocalSite/DB12measured', db12Measured)