2023-06-01 08:20:51 +00:00
|
|
|
import pickle
|
|
|
|
from warnings import warn
|
2023-06-28 16:02:56 +00:00
|
|
|
from gpu_power_func import get_sample_of_gpu
|
|
|
|
|
|
|
|
with (open("configuration.pkl", "rb")) as file:
|
|
|
|
while True:
|
|
|
|
try:
|
|
|
|
cfg = pickle.load(file)
|
|
|
|
except EOFError:
|
|
|
|
break
|
|
|
|
|
|
|
|
|
2023-06-30 10:09:54 +00:00
|
|
|
# pickle_name = "{}_wattdata_{}.pkl".format(model_t,size)
|
|
|
|
# print("GPU energy file config: {}".format(pickle_name))
|
2023-06-28 16:02:56 +00:00
|
|
|
|
2023-06-30 10:09:54 +00:00
|
|
|
# print(cfg)
|
2023-06-01 08:20:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2023-06-30 10:09:54 +00:00
|
|
|
dataDump = []
|
|
|
|
while True:
|
|
|
|
try:
|
|
|
|
dataDump.append(get_sample_of_gpu())
|
|
|
|
with open(cfg["pickle_path"], 'wb') as f:
|
|
|
|
pickle.dump(dataDump, f)
|
|
|
|
except EOFError:
|
|
|
|
warn('Pickle ran out of space')
|
|
|
|
finally:
|
|
|
|
f.close()
|