Skip to content

Commit

Permalink
[Automated Commit] Format Codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
mlcommons-bot committed Nov 29, 2024
1 parent a899fd7 commit 5f206aa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
1 change: 0 additions & 1 deletion script/get-spec-ptd/customize.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def postprocess(i):
# Add execute permissions for the user
os.chmod(file_path, current_permissions | stat.S_IXUSR)


env['CM_SPEC_PTD_PATH'] = env['CM_MLPERF_PTD_PATH']

return {'return': 0}
21 changes: 14 additions & 7 deletions script/run-mlperf-power-server/customize.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ def preprocess(i):
os_info = i['os_info']
env = i['env']


# Initialize ConfigParser
config = configparser.ConfigParser()

Expand All @@ -22,7 +21,8 @@ def preprocess(i):

# Read the configuration file with error handling
if not os.path.exists(server_config_file):
raise FileNotFoundError(f"Server config file not found: {server_config_file}")
raise FileNotFoundError(
f"Server config file not found: {server_config_file}")

config.read(server_config_file)
# Update the server section
Expand All @@ -34,7 +34,10 @@ def preprocess(i):

# Define number of analyzers and network port start
num_analyzers = int(env.get('CM_MLPERF_POWER_NUM_ANALYZERS', 1))
network_port_start = int(env.get('CM_MLPERF_POWER_NETWORK_PORT_START', 8888))
network_port_start = int(
env.get(
'CM_MLPERF_POWER_NETWORK_PORT_START',
8888))

# Ensure 'ptd' section exists
if 'ptd' in config:
Expand All @@ -50,10 +53,14 @@ def preprocess(i):
config.add_section(analyzer_section)

# Add the analyzer subsection as keys under the 'ptd' section
config[f'{analyzer_section}']['interfaceFlag'] = str(env.get('CM_MLPERF_POWER_INTERFACE_FLAG', ''))
config[f'{analyzer_section}']['deviceType'] = str(env.get('CM_MLPERF_POWER_DEVICE_TYPE', ''))
config[f'{analyzer_section}']['devicePort'] = str(env.get('CM_MLPERF_POWER_DEVICE_PORT', ''))
config[f'{analyzer_section}']['networkPort'] = str(network_port_start + aid - 1)
config[f'{analyzer_section}']['interfaceFlag'] = str(
env.get('CM_MLPERF_POWER_INTERFACE_FLAG', ''))
config[f'{analyzer_section}']['deviceType'] = str(
env.get('CM_MLPERF_POWER_DEVICE_TYPE', ''))
config[f'{analyzer_section}']['devicePort'] = str(
env.get('CM_MLPERF_POWER_DEVICE_PORT', ''))
config[f'{analyzer_section}']['networkPort'] = str(
network_port_start + aid - 1)

with open('power-server.conf', 'w') as configfile:
config.write(configfile)
Expand Down

0 comments on commit 5f206aa

Please sign in to comment.