-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(optimizer): system configuration file
- Loading branch information
1 parent
37f9916
commit 9105f2c
Showing
7 changed files
with
187 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
discopop_library/discopop_optimizer/classes/system/devices/DeviceTypeEnum.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# This file is part of the DiscoPoP software (http://www.discopop.tu-darmstadt.de) | ||
# | ||
# Copyright (c) 2020, Technische Universitaet Darmstadt, Germany | ||
# | ||
# This software may be modified and distributed under the terms of | ||
# the 3-Clause BSD License. See the LICENSE file in the package base | ||
# directory for details. | ||
|
||
from enum import IntEnum | ||
|
||
|
||
class DeviceTypeEnum(IntEnum): | ||
CPU = 0 | ||
GPU = 1 |
76 changes: 76 additions & 0 deletions
76
discopop_library/discopop_optimizer/classes/system/system_utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# This file is part of the DiscoPoP software (http://www.discopop.tu-darmstadt.de) | ||
# | ||
# Copyright (c) 2020, Technische Universitaet Darmstadt, Germany | ||
# | ||
# This software may be modified and distributed under the terms of | ||
# the 3-Clause BSD License. See the LICENSE file in the package base | ||
# directory for details. | ||
|
||
import json | ||
import os | ||
from typing import Any, Dict, List, Union | ||
|
||
from sympy import Integer | ||
|
||
from discopop_library.discopop_optimizer.classes.system.devices.CPU import CPU | ||
from discopop_library.discopop_optimizer.classes.system.devices.DeviceTypeEnum import DeviceTypeEnum | ||
from discopop_library.discopop_optimizer.classes.system.devices.GPU import GPU | ||
|
||
|
||
def generate_default_system_configuration(file_path: str): | ||
"""Generates a system configuration file using the default values if none exists so far.""" | ||
if os.path.exists(file_path): | ||
return | ||
# build default system configuration | ||
system_configuration: Dict[str, Any] = dict() | ||
devices: List[Dict[str, Union[float, int, Dict[str, float]]]] = [] | ||
# configure host device | ||
host_device: Dict[str, Union[float, int, Dict[str, float]]] = { | ||
"device_id": 0, | ||
"device_type": DeviceTypeEnum.CPU, | ||
"frequency": 3000000000, | ||
"processors": 16, | ||
"threads": 16, | ||
} | ||
# configure gpu_1 | ||
gpu_1: Dict[str, Union[float, int, Dict[str, float]]] = { | ||
"compute_init_delays": {"target_teams_distribute_parallel_for": 0.01}, | ||
"device_id": 1, | ||
"device_type": DeviceTypeEnum.GPU, | ||
"frequency": 512000000, | ||
"processors": 128, | ||
"teams": 3200, | ||
"threads": 3200, | ||
"transfer_init_delays": { | ||
"target_data_update": 3.6e-05, | ||
"target_enter_data": 6.5e-05, | ||
"target_exit_data": 2e-06, | ||
"average": 4e-05, | ||
}, | ||
"transfer_speeds": {"D2H_MB/s": 1800, "H2D_MB/s": 3600}, # MB/s | ||
} | ||
# configure gpu_2 | ||
gpu_2: Dict[str, Union[float, int, Dict[str, float]]] = { | ||
"compute_init_delays": {"target_teams_distribute_parallel_for": 0.005}, | ||
"device_id": 2, | ||
"device_type": DeviceTypeEnum.GPU, | ||
"frequency": 512000000, | ||
"processors": 128, | ||
"teams": 3200, | ||
"threads": 3200, | ||
"transfer_init_delays": { | ||
"target_data_update": 7.1e-05, | ||
"target_enter_data": 0.0002, | ||
"target_exit_data": 5e-06, | ||
"average": 6e-05, | ||
}, | ||
"transfer_speeds": {"D2H_MB/s": 1900, "H2D_MB/s": 4200}, # MB/s | ||
} | ||
# assemble system_configuration | ||
devices = [host_device, gpu_1, gpu_2] | ||
system_configuration["devices"] = devices | ||
system_configuration["host_device"] = host_device["device_id"] | ||
|
||
# output to file | ||
with open(file_path, "w") as f: | ||
json.dump(system_configuration, f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters