2024-05-10 09:59:24 +00:00
|
|
|
import pickle
|
|
|
|
from warnings import warn
|
2025-01-15 10:26:48 +00:00
|
|
|
|
2024-05-10 09:59:24 +00:00
|
|
|
from gpu_power_func import get_sample_of_gpu
|
|
|
|
|
2025-01-15 10:26:48 +00:00
|
|
|
with open("configuration.pkl", "rb") as file:
|
2024-05-10 09:59:24 +00:00
|
|
|
while True:
|
|
|
|
try:
|
|
|
|
cfg = pickle.load(file)
|
|
|
|
except EOFError:
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
# pickle_name = "{}_wattdata_{}.pkl".format(model_t,size)
|
|
|
|
# print("GPU energy file config: {}".format(pickle_name))
|
|
|
|
|
|
|
|
# print(cfg)
|
|
|
|
|
|
|
|
|
2025-01-15 10:26:48 +00:00
|
|
|
if __name__ == "__main__":
|
2024-05-10 09:59:24 +00:00
|
|
|
dataDump = []
|
|
|
|
while True:
|
|
|
|
try:
|
|
|
|
dataDump.append(get_sample_of_gpu())
|
2025-01-15 10:26:48 +00:00
|
|
|
with open(cfg["pickle_path"], "wb") as f:
|
2024-05-10 09:59:24 +00:00
|
|
|
pickle.dump(dataDump, f)
|
|
|
|
except EOFError:
|
2025-01-15 10:26:48 +00:00
|
|
|
warn("Pickle ran out of space")
|
2024-05-10 09:59:24 +00:00
|
|
|
finally:
|
|
|
|
f.close()
|