Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add threaded-timer support to hpc-benchmark #14

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions hpc_benchmark/hpc_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,14 +487,20 @@ def run_simulation():
d.update(final_kernel_status)

# Subtract timer information from presimulation period
timers = ['time_collocate_spike_data', 'time_communicate_prepare',
'time_communicate_spike_data', 'time_deliver_spike_data',
'time_gather_spike_data', 'time_update', 'time_simulate']
timers = ['time_collocate_spike_data', 'time_communicate_prepare', 'time_communicate_spike_data', 'time_communicate_target_data', 'time_construction_connect', 'time_construction_create', 'time_deliver_secondary_data', 'time_deliver_spike_data', 'time_gather_secondary_data', 'time_gather_spike_data', 'time_gather_target_data', 'time_omp_synchronization_construction', 'time_omp_synchronization_simulation', 'time_mpi_synchronization', 'time_simulate', 'time_update']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Construction related timers like time_construction_connect and time_gather_target_data should not be used later for subtraction of the presim timers, since they are not part of the presim time. The logfiles should only contain these timers once without distinction into presim and sim.

timers.extend([timer + '_cpu' for timer in timers])

for timer in timers:
try:
d[timer + '_presim'] = intermediate_kernel_status[timer]
d[timer] -= intermediate_kernel_status[timer]
if type(d[timer]) == tuple or type(d[timer]) == list:
timer_array = tuple(d[timer][tid] - intermediate_kernel_status[timer][tid] for tid in range(len(d[timer])))
d[timer] = timer_array[0]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for adding only the first value of the tuple to the logfile? And why is this handled differently for the presim timers?

d[timer + "_max"] = max(timer_array)
d[timer + "_max"] = min(timer_array)
Copy link
Collaborator

@mlober mlober Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: d[timer + "_max"] = min(timer_array) must be d[timer + "_min"] = min(timer_array)

d[timer + "_avg"] = np.mean(timer_array)
else:
d[timer] -= intermediate_kernel_status[timer]
except KeyError:
# KeyError if compiled without detailed timers, except time_simulate
continue
Expand Down