exA: make sure file is written with newline at the end

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2025-09-23 15:19:49 +03:00
parent 1ca1e216f6
commit bc08d288c9

View file

@ -24,8 +24,9 @@ elapsed_time = time.time() - start_time
print(f'Time used for matrix multiplication: {elapsed_time:.2f} s') print(f'Time used for matrix multiplication: {elapsed_time:.2f} s')
# Check if timings folder exists # Check if timings folder exists
if not os.path.isdir('timings/'): os.mkdir('timings') if not os.path.isdir('timings/'):
os.mkdir('timings')
# IO: Save the timing to a unique txt file # IO: Save the timing to a unique txt file
with open(f'timings/{threads}_threads_t{timestamp}.txt', 'w') as file: with open(f'timings/{threads}_threads_t{timestamp}.txt', 'w') as file:
file.write(f'{threads},{elapsed_time:.6f}') print(f'{threads},{elapsed_time:.6f}', file=file)