bayesiancnn/amd_sample_draw.py

31 lines
701 B
Python
Raw Normal View History

2024-05-10 09:59:24 +00:00
import pickle
from warnings import warn
2024-05-10 09:59:24 +00:00
from gpu_power_func import get_sample_of_gpu
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)
if __name__ == "__main__":
2024-05-10 09:59:24 +00:00
dataDump = []
while True:
try:
dataDump.append(get_sample_of_gpu())
with open(cfg["pickle_path"], "wb") as f:
2024-05-10 09:59:24 +00:00
pickle.dump(dataDump, f)
except EOFError:
warn("Pickle ran out of space")
2024-05-10 09:59:24 +00:00
finally:
f.close()