Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • CubeTest
  • GPU_swift
  • TangoSIDM
  • active_h_max_optimization
  • arm_vec
  • c11
  • c11_atomics_copy
  • comm_tasks_are_special
  • cuda_test
  • domain_zoom_nometis
  • drift_flag_debug_check
  • driven_turbulence
  • engineering
  • evrard_disc
  • expand_fof
  • fix_sink_timestep
  • fixed_hSIDM
  • fof_snapshots
  • gear_metal_diffusion
  • generic_cache
  • genetic_partitioning2
  • gizmo
  • gizmo_entropy_switch
  • gizmo_mfv_entropy
  • hashmap_mesh
  • isotropic_feedback
  • ivanova-testing
  • jsw/6dfof
  • kahip
  • lean_gparts
  • load-balance-testing
  • locked_hydro
  • logger_read_history
  • logger_read_history2
  • logger_write_hdf5
  • mass_dependent_h_max
  • master
  • mpi-one-thread
  • mpi-packed-parts
  • mpi-send-subparts
  • mpi-send-subparts-vector
  • mpi-subparts-vector-grav
  • mpi-testsome
  • mpi-threads
  • mpi_force_checks
  • numa_awareness
  • onesided-mpi-rdma
  • onesided-mpi-recv-cache
  • onesided-mpi-recv-window
  • onesided-mpi-single-recv-window
  • origin-master
  • parallel_exchange_cells
  • paranoid
  • phantom
  • planetary
  • planetary_boundary
  • queue-timers
  • queue-timers-clean
  • rdma-only
  • rdma-only-multiple-sends
  • rdma-only-subcopies
  • rdma-only-subparts
  • rdma-only-subparts-update
  • rdma-only-subparts-update-flamingo
  • rdma-only-subparts-update-flamingo-cellids
  • rdma-only-subparts-update-keep
  • rdma-only-subparts-update-keep-update
  • rdma-only-subsends
  • reweight-fitted-costs
  • reweight-scaled-costs
  • rgb-engineering
  • rt-gas-interactions
  • rt-ghost2-and-thermochemistry
  • scheduler_determinism
  • search-window-tests
  • signal-handler-dump
  • simba-stellar-feedback
  • sink_formation2
  • sink_merger
  • sink_merger2
  • skeleton
  • smarter_sends
  • snipes_data
  • spiral_potential
  • subgrid_SF_threshold
  • subsends
  • swift-rdma
  • swift_zoom_support
  • sync-send
  • thread-dump-extract-waiters
  • threadpool_rmapper
  • traphic
  • variable_hSIDM
  • whe-nu-bg-cosmo
  • when_to_proxy
  • yb-bhdev
  • yb-sndev
  • yb-sndev-dev
  • yb-varsndt-isotropic
  • yb-vi-gastrack
  • v0.0
  • v0.1
  • v0.1.0-pre
  • v0.2.0
  • v0.3.0
  • v0.4.0
  • v0.5.0
  • v0.6.0
  • v0.7.0
  • v0.8.0
  • v0.8.1
  • v0.8.2
  • v0.8.3
  • v0.8.4
  • v0.8.5
  • v0.9.0
116 results

Target

Select target project
  • dc-oman1/swiftsim
  • swift/swiftsim
  • pdraper/swiftsim
  • tkchan/swiftsim
  • dc-turn5/swiftsim
5 results
Select Git revision
  • 840-unit-test-testtimeline-fails
  • 875-wendland-c6-missing-neighbour-contributions
  • 887-code-does-not-compile-with-parmetis-installed-locally-but-without-metis
  • CubeTest
  • FS_Del
  • GEARRT_Iliev1
  • GEARRT_Iliev3
  • GEARRT_Iliev4
  • GEARRT_Iliev5
  • GEARRT_Iliev5-fixed-nr-subcycles
  • GEARRT_Iliev7
  • GEARRT_Iliev_static
  • GEARRT_Ivanova
  • GEARRT_fixed_nr_subcycles
  • GEARRT_injection_tests_Iliev0
  • GPU_swift
  • GrackleCoolingUpdates2
  • Lambda-T-table
  • MAGMA2
  • MAGMA2_matthieu
  • MHD_FS
  • MHD_FS_TESTs
  • MHD_FS_VP_AdvectGauge
  • MHD_Orestis
  • MHD_canvas
  • MHD_canvas_RF_128
  • MHD_canvas_RF_growth_rate
  • MHD_canvas_RobertsFlow
  • MHD_canvas_SPH_errors
  • MHD_canvas_matthieu
  • MHD_canvas_nickishch
  • MHD_canvas_nickishch_Lorentz_force_test
  • MHD_canvas_nickishch_track_everything
  • MHD_canvas_sid
  • OAK/CPAW_updates
  • OAK/LoopAdvectionTest
  • OAK/adaptive_divv
  • OAK/kinetic_dedner
  • REMIX_cosmo
  • RT_dualc
  • RT_recombination_radiation
  • RT_test_mladen
  • SIDM
  • SIDM_wKDSDK
  • SNdust
  • SPHM1RT_CosmologicalStromgrenSphere
  • SPHM1RT_bincheck
  • SPHM1RT_smoothedRT
  • TangoSIDM
  • TestPropagation3D
  • Test_fixedhProb
  • activate_fewer_comms
  • active_h_max_optimization
  • adaptive_softening_Lieuwe
  • add_2p5D
  • add_black_holes_checks
  • adding_sidm_to_master
  • agn_crksph
  • agn_crksph_subtask_speedup
  • amd-optimization
  • arm_vec
  • automatic_tasks
  • better_ray_RNG
  • black_holes_accreted_angular_momenta_from_gas
  • burkert-potential
  • c11
  • c11_atomics_copy
  • cancel_all_sorts
  • cell_exchange_improvements
  • cell_types
  • cherry-pick-cd1c39e0
  • comm_tasks_are_special
  • conduction_velocities
  • cpp-fixes
  • cuda_test
  • darwin/adaptive_softening
  • darwin/gear_chemistry_fluxes
  • darwin/gear_mechanical_feedback
  • darwin/gear_preSN_feedback
  • darwin/gear_radiation
  • darwin/simulations
  • darwin/sink_formation_proba
  • darwin/sink_mpi
  • darwin/sink_mpi_physics
  • dead-time-stats
  • derijcke_cooling
  • dev_cms
  • do-not-activate-empty-star-pairs
  • domain_zoom_nometis
  • drift_flag_debug_check
  • driven_turbulence
  • driven_turbulence_forcings
  • engineering
  • eos_updates
  • evrard_disc
  • expand_fof_2022
  • explict_bkg_cdim
  • fewer_gpart_comms
  • fewer_star_comms
  • fewer_timestep_comms_no_empty_pairs
  • v0.0
  • v0.1
  • v0.1.0-pre
  • v0.2.0
  • v0.3.0
  • v0.4.0
  • v0.5.0
  • v0.6.0
  • v0.7.0
  • v0.8.0
  • v0.8.1
  • v0.8.2
  • v0.8.3
  • v0.8.4
  • v0.8.5
  • v0.9.0
  • v1.0.0
  • v2025.01
  • v2025.04
119 results
Show changes
Commits on Source (2)
...@@ -181,6 +181,11 @@ void queue_insert(struct queue *q, struct task *t) { ...@@ -181,6 +181,11 @@ void queue_insert(struct queue *q, struct task *t) {
/* Increase the incoming count. */ /* Increase the incoming count. */
atomic_inc(&q->count_incoming); atomic_inc(&q->count_incoming);
#ifdef SWIFT_DEBUG_TASKS
/* Start timing how long we are in the queue. */
t->queued_tic = getticks();
#endif
} }
/** /**
...@@ -268,6 +273,11 @@ struct task *queue_gettask(struct queue *q, const struct task *prev, ...@@ -268,6 +273,11 @@ struct task *queue_gettask(struct queue *q, const struct task *prev,
/* Send it down the binary heap. */ /* Send it down the binary heap. */
if (queue_sift_down(q, ind) != ind) ind -= 1; if (queue_sift_down(q, ind) != ind) ind -= 1;
} }
#ifdef SWIFT_DEBUG_TASKS
/* One more miss. */
qtasks[entries[ind].tid].nr_task_locks++;
#endif
} }
/* Did we get a task? */ /* Did we get a task? */
......
...@@ -1266,6 +1266,10 @@ struct task *scheduler_addtask(struct scheduler *s, enum task_types type, ...@@ -1266,6 +1266,10 @@ struct task *scheduler_addtask(struct scheduler *s, enum task_types type,
t->tic = 0; t->tic = 0;
t->toc = 0; t->toc = 0;
t->total_ticks = 0; t->total_ticks = 0;
#ifdef SWIFT_DEBUG_TASKS
t->queued_tic = 0;
t->nr_task_locks = 0;
#endif
if (ci != NULL) cell_set_flag(ci, cell_flag_has_tasks); if (ci != NULL) cell_set_flag(ci, cell_flag_has_tasks);
if (cj != NULL) cell_set_flag(cj, cell_flag_has_tasks); if (cj != NULL) cell_set_flag(cj, cell_flag_has_tasks);
......
...@@ -1082,7 +1082,7 @@ void task_dump_all(struct engine *e, int step) { ...@@ -1082,7 +1082,7 @@ void task_dump_all(struct engine *e, int step) {
/* Add some information to help with the plots and conversion of ticks to /* Add some information to help with the plots and conversion of ticks to
* seconds. */ * seconds. */
fprintf(file_thread, " %03d 0 0 0 0 %lld %lld %lld %lld %lld 0 0 %lld\n", fprintf(file_thread, " %03d 0 0 0 0 %lld %lld %lld %lld %lld 0 0 0 0 %lld\n",
engine_rank, (long long int)e->tic_step, engine_rank, (long long int)e->tic_step,
(long long int)e->toc_step, e->updates, e->g_updates, (long long int)e->toc_step, e->updates, e->g_updates,
e->s_updates, cpufreq); e->s_updates, cpufreq);
...@@ -1091,7 +1091,8 @@ void task_dump_all(struct engine *e, int step) { ...@@ -1091,7 +1091,8 @@ void task_dump_all(struct engine *e, int step) {
if (!e->sched.tasks[l].implicit && if (!e->sched.tasks[l].implicit &&
e->sched.tasks[l].tic > e->tic_step) { e->sched.tasks[l].tic > e->tic_step) {
fprintf( fprintf(
file_thread, " %03i %i %i %i %i %lli %lli %i %i %i %i %lli %i\n", file_thread,
" %03i %i %i %i %i %lli %lli %i %i %i %i %lli %i %lli %zu\n",
engine_rank, e->sched.tasks[l].rid, e->sched.tasks[l].type, engine_rank, e->sched.tasks[l].rid, e->sched.tasks[l].type,
e->sched.tasks[l].subtype, (e->sched.tasks[l].cj == NULL), e->sched.tasks[l].subtype, (e->sched.tasks[l].cj == NULL),
(long long int)e->sched.tasks[l].tic, (long long int)e->sched.tasks[l].tic,
...@@ -1104,7 +1105,8 @@ void task_dump_all(struct engine *e, int step) { ...@@ -1104,7 +1105,8 @@ void task_dump_all(struct engine *e, int step) {
: 0, : 0,
(e->sched.tasks[l].cj != NULL) ? e->sched.tasks[l].cj->grav.count (e->sched.tasks[l].cj != NULL) ? e->sched.tasks[l].cj->grav.count
: 0, : 0,
e->sched.tasks[l].flags, e->sched.tasks[l].sid); e->sched.tasks[l].flags, e->sched.tasks[l].sid,
e->sched.tasks[l].queued_tic, e->sched.tasks[l].nr_task_locks);
} }
count++; count++;
} }
...@@ -1124,14 +1126,14 @@ void task_dump_all(struct engine *e, int step) { ...@@ -1124,14 +1126,14 @@ void task_dump_all(struct engine *e, int step) {
/* Add some information to help with the plots and conversion of ticks to /* Add some information to help with the plots and conversion of ticks to
* seconds. */ * seconds. */
fprintf(file_thread, " %d %d %d %d %lld %lld %lld %lld %lld %d %lld\n", -2, fprintf(file_thread, " %d %d %d %d %lld %lld %lld %lld %lld 0 0 0 %lld\n", -2,
-1, -1, 1, (unsigned long long)e->tic_step, -1, -1, 1, (unsigned long long)e->tic_step,
(unsigned long long)e->toc_step, e->updates, e->g_updates, (unsigned long long)e->toc_step, e->updates, e->g_updates,
e->s_updates, 0, cpufreq); e->s_updates, cpufreq);
for (int l = 0; l < e->sched.nr_tasks; l++) { for (int l = 0; l < e->sched.nr_tasks; l++) {
if (!e->sched.tasks[l].implicit && e->sched.tasks[l].tic > e->tic_step) { if (!e->sched.tasks[l].implicit && e->sched.tasks[l].tic > e->tic_step) {
fprintf( fprintf(
file_thread, " %i %i %i %i %lli %lli %i %i %i %i %i\n", file_thread, " %i %i %i %i %lli %lli %i %i %i %i %i %lli %zu\n",
e->sched.tasks[l].rid, e->sched.tasks[l].type, e->sched.tasks[l].rid, e->sched.tasks[l].type,
e->sched.tasks[l].subtype, (e->sched.tasks[l].cj == NULL), e->sched.tasks[l].subtype, (e->sched.tasks[l].cj == NULL),
(unsigned long long)e->sched.tasks[l].tic, (unsigned long long)e->sched.tasks[l].tic,
...@@ -1142,7 +1144,8 @@ void task_dump_all(struct engine *e, int step) { ...@@ -1142,7 +1144,8 @@ void task_dump_all(struct engine *e, int step) {
: e->sched.tasks[l].cj->hydro.count, : e->sched.tasks[l].cj->hydro.count,
(e->sched.tasks[l].ci == NULL) ? 0 : e->sched.tasks[l].ci->grav.count, (e->sched.tasks[l].ci == NULL) ? 0 : e->sched.tasks[l].ci->grav.count,
(e->sched.tasks[l].cj == NULL) ? 0 : e->sched.tasks[l].cj->grav.count, (e->sched.tasks[l].cj == NULL) ? 0 : e->sched.tasks[l].cj->grav.count,
e->sched.tasks[l].sid); e->sched.tasks[l].sid, e->sched.tasks[l].queued_tic,
e->sched.tasks[l].nr_task_locks);
} }
} }
fclose(file_thread); fclose(file_thread);
......
...@@ -265,6 +265,14 @@ struct task { ...@@ -265,6 +265,14 @@ struct task {
/* Total time spent running this task */ /* Total time spent running this task */
ticks total_ticks; ticks total_ticks;
#ifdef SWIFT_DEBUG_TASKS
/*! Time task was queued. */
ticks queued_tic;
/*! Number of time the task was rejected by locks. */
size_t nr_task_locks;
#endif
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
/* When was this task last run? */ /* When was this task last run? */
integertime_t ti_run; integertime_t ti_run;
......
...@@ -190,7 +190,7 @@ full_step = data[0, :] ...@@ -190,7 +190,7 @@ full_step = data[0, :]
# Do we have an MPI file? # Do we have an MPI file?
full_step = data[0, :] full_step = data[0, :]
if full_step.size == 13: if full_step.size == 15:
print("# MPI mode") print("# MPI mode")
mpimode = True mpimode = True
nranks = int(max(data[:, 0])) + 1 nranks = int(max(data[:, 0])) + 1
...@@ -201,6 +201,8 @@ if full_step.size == 13: ...@@ -201,6 +201,8 @@ if full_step.size == 13:
subtaskcol = 3 subtaskcol = 3
ticcol = 5 ticcol = 5
toccol = 6 toccol = 6
qticcol = 13
nunlockscol = 14
updates = int(full_step[7]) updates = int(full_step[7])
g_updates = int(full_step[8]) g_updates = int(full_step[8])
s_updates = int(full_step[9]) s_updates = int(full_step[9])
...@@ -214,6 +216,8 @@ else: ...@@ -214,6 +216,8 @@ else:
subtaskcol = 2 subtaskcol = 2
ticcol = 4 ticcol = 4
toccol = 5 toccol = 5
qticcol = 11
nunlockscol = 12
updates = int(full_step[6]) updates = int(full_step[6])
g_updates = int(full_step[7]) g_updates = int(full_step[7])
s_updates = int(full_step[8]) s_updates = int(full_step[8])
...@@ -271,6 +275,7 @@ for rank in ranks: ...@@ -271,6 +275,7 @@ for rank in ranks:
start_t = float(tic_step) start_t = float(tic_step)
data[:, ticcol] -= start_t data[:, ticcol] -= start_t
data[:, toccol] -= start_t data[:, toccol] -= start_t
data[:, qticcol] -= start_t
end_t = (toc_step - start_t) / CPU_CLOCK end_t = (toc_step - start_t) / CPU_CLOCK
tasks = {} tasks = {}
...@@ -284,11 +289,13 @@ for rank in ranks: ...@@ -284,11 +289,13 @@ for rank in ranks:
thread = int(data[line, threadscol]) thread = int(data[line, threadscol])
tic = int(data[line, ticcol]) / CPU_CLOCK tic = int(data[line, ticcol]) / CPU_CLOCK
toc = int(data[line, toccol]) / CPU_CLOCK toc = int(data[line, toccol]) / CPU_CLOCK
qtic = int(data[line, qticcol]) / CPU_CLOCK
nunlocks = int(data[line, nunlockscol])
tasktype = int(data[line, taskcol]) tasktype = int(data[line, taskcol])
subtype = int(data[line, subtaskcol]) subtype = int(data[line, subtaskcol])
sid = int(data[line, -1]) sid = int(data[line, -1])
tasks[thread].append([tic, toc, tasktype, subtype, sid]) tasks[thread].append([tic, toc, tasktype, subtype, sid, qtic, nunlocks])
# Sort by tic and gather used threads. # Sort by tic and gather used threads.
threadids = [] threadids = []
...@@ -302,26 +309,51 @@ for rank in ranks: ...@@ -302,26 +309,51 @@ for rank in ranks:
print("# Task times:") print("# Task times:")
print("# -----------") print("# -----------")
print( print(
"# {0:<17s}: {1:>7s} {2:>9s} {3:>9s} {4:>9s} {5:>9s} {6:>9s}".format( "# {0:<22s}: {1:>7s} {2:>9s} {3:>9s} {4:>9s} {5:>9s} {6:>9s} {7:>9s} {8:>9s} {9:>9s} {10:>9s} {11:>14s} {12:>14s} {13:>14s} {14:>14s} ".format(
"type/subtype", "count", "minimum", "maximum", "sum", "mean", "percent" "type/subtype", "count", "min", "max", "sum", "mean",
"percent",
"qmin", "qmax", "qsum", "qmean",
"unlocks_min", "unlocks_max", "unlocks_sum", "unlocks_mean",
) )
) )
alltasktimes = {} alltasktimes = {}
alltaskqtimes = {}
alltaskunlocks = {}
sidtimes = {} sidtimes = {}
for i in threadids: for i in threadids:
tasktimes = {} tasktimes = {}
taskqtimes = {}
taskunlocks = {}
for task in tasks[i]: for task in tasks[i]:
key = TASKTYPES[task[2]] + "/" + SUBTYPES[task[3]] key = TASKTYPES[task[2]] + "/" + SUBTYPES[task[3]]
dt = task[1] - task[0] dt = task[1] - task[0]
dtq = task[0] - task[5]
if not key in tasktimes: if not key in tasktimes:
tasktimes[key] = [] tasktimes[key] = []
tasktimes[key].append(dt) tasktimes[key].append(dt)
if not key in taskqtimes:
taskqtimes[key] = []
taskqtimes[key].append(dtq)
if not key in taskunlocks:
taskunlocks[key] = []
taskunlocks[key].append(task[6])
if not key in alltasktimes: if not key in alltasktimes:
alltasktimes[key] = [] alltasktimes[key] = []
alltasktimes[key].append(dt) alltasktimes[key].append(dt)
if not key in alltaskqtimes:
alltaskqtimes[key] = []
alltaskqtimes[key].append(dtq)
if not key in alltaskunlocks:
alltaskunlocks[key] = []
alltaskunlocks[key].append(task[6])
my_sid = task[4] my_sid = task[4]
if my_sid > -1: if my_sid > -1:
if not my_sid in sidtimes: if not my_sid in sidtimes:
...@@ -335,8 +367,14 @@ for rank in ranks: ...@@ -335,8 +367,14 @@ for rank in ranks:
taskmin = min(tasktimes[key]) taskmin = min(tasktimes[key])
taskmax = max(tasktimes[key]) taskmax = max(tasktimes[key])
tasksum = sum(tasktimes[key]) tasksum = sum(tasktimes[key])
taskqmin = min(taskqtimes[key])
taskqmax = max(taskqtimes[key])
taskqsum = sum(taskqtimes[key])
taskunlockmin = min(taskunlocks[key])
taskunlockmax = max(taskunlocks[key])
taskunlocksum = sum(taskunlocks[key])
print( print(
"{0:24s}: {1:7d} {2:9.4f} {3:9.4f} {4:9.4f} {5:9.4f} {6:9.2f}".format( "{0:24s}: {1:7d} {2:9.4f} {3:9.4f} {4:9.4f} {5:9.4f} {6:9.2f} {7:9.4f} {8:9.4f} {9:9.4f} {10:9.4f} {11:14.4f} {12:14.4f} {13:14.4f} {14:14.4f} ".format(
key, key,
len(tasktimes[key]), len(tasktimes[key]),
taskmin, taskmin,
...@@ -344,6 +382,14 @@ for rank in ranks: ...@@ -344,6 +382,14 @@ for rank in ranks:
tasksum, tasksum,
tasksum / len(tasktimes[key]), tasksum / len(tasktimes[key]),
tasksum / total_t * 100.0, tasksum / total_t * 100.0,
taskqmin,
taskqmax,
taskqsum,
taskqsum / len(tasktimes[key]),
taskunlockmin,
taskunlockmax,
taskunlocksum,
taskunlocksum / len(tasktimes[key]),
) )
) )
print() print()
...@@ -352,20 +398,34 @@ for rank in ranks: ...@@ -352,20 +398,34 @@ for rank in ranks:
print('<div id="all"></div>') print('<div id="all"></div>')
print("# All threads : ") print("# All threads : ")
for key in sorted(alltasktimes.keys()): for key in sorted(alltasktimes.keys()):
taskmin = min(alltasktimes[key]) taskmin = min(alltasktimes[key])
taskmax = max(alltasktimes[key]) taskmax = max(alltasktimes[key])
tasksum = sum(alltasktimes[key]) tasksum = sum(alltasktimes[key])
print( taskqmin = min(alltaskqtimes[key])
"{0:23s}: {1:7d} {2:9.4f} {3:9.4f} {4:9.4f} {5:9.4f} {6:9.2f}".format( taskqmax = max(alltaskqtimes[key])
key, taskqsum = sum(alltaskqtimes[key])
len(alltasktimes[key]), taskunlockmin = min(alltaskunlocks[key])
taskmin, taskunlockmax = max(alltaskunlocks[key])
taskmax, taskunlocksum = sum(alltaskunlocks[key])
tasksum, print(
tasksum / len(alltasktimes[key]), "{0:24s}: {1:7d} {2:9.4f} {3:9.4f} {4:9.4f} {5:9.4f} {6:9.2f} {7:9.4f} {8:9.4f} {9:9.4f} {10:9.4f} {11:14.4f} {12:14.4f} {13:14.4f} {14:14.4f} ".format(
tasksum / (len(threadids) * total_t) * 100.0, key,
len(alltasktimes[key]),
taskmin,
taskmax,
tasksum,
tasksum / len(alltasktimes[key]),
tasksum / total_t * 100.0,
taskqmin,
taskqmax,
taskqsum,
taskqsum / len(alltasktimes[key]),
taskunlockmin,
taskunlockmax,
taskunlocksum,
taskunlocksum / len(alltasktimes[key]),
)
) )
)
print() print()
# For pairs, show stuff sorted by SID # For pairs, show stuff sorted by SID
......
...@@ -40,7 +40,7 @@ matplotlib.use('TkAgg') ...@@ -40,7 +40,7 @@ matplotlib.use('TkAgg')
import numpy as np import numpy as np
import matplotlib.backends.backend_tkagg as tkagg import matplotlib.backends.backend_tkagg as tkagg
from matplotlib.figure import Figure from matplotlib.figure import Figure
import Tkinter as tk import tkinter as tk
import matplotlib.collections as collections import matplotlib.collections as collections
import matplotlib.ticker as plticker import matplotlib.ticker as plticker
import pylab as pl import pylab as pl
...@@ -361,7 +361,7 @@ data = pl.loadtxt(infile) ...@@ -361,7 +361,7 @@ data = pl.loadtxt(infile)
# Do we have an MPI file? # Do we have an MPI file?
full_step = data[0, :] full_step = data[0, :]
if full_step.size == 13: if full_step.size == 15:
print("# MPI mode") print("# MPI mode")
mpimode = True mpimode = True
ranks = list(range(int(max(data[:, 0])) + 1)) ranks = list(range(int(max(data[:, 0])) + 1))
...@@ -372,6 +372,8 @@ if full_step.size == 13: ...@@ -372,6 +372,8 @@ if full_step.size == 13:
subtaskcol = 3 subtaskcol = 3
ticcol = 5 ticcol = 5
toccol = 6 toccol = 6
qticcol = 13
unlockscol = 14
else: else:
print("# non MPI mode") print("# non MPI mode")
mpimode = False mpimode = False
...@@ -381,6 +383,8 @@ else: ...@@ -381,6 +383,8 @@ else:
subtaskcol = 2 subtaskcol = 2
ticcol = 4 ticcol = 4
toccol = 5 toccol = 5
qticcol = 11
unlockscol = 12
# Get CPU_CLOCK to convert ticks into milliseconds. # Get CPU_CLOCK to convert ticks into milliseconds.
CPU_CLOCK = float(full_step[-1]) / 1000.0 CPU_CLOCK = float(full_step[-1]) / 1000.0
...@@ -425,6 +429,7 @@ if data.size == 0: ...@@ -425,6 +429,7 @@ if data.size == 0:
start_t = float(tic_step) start_t = float(tic_step)
data[:, ticcol] -= start_t data[:, ticcol] -= start_t
data[:, toccol] -= start_t data[:, toccol] -= start_t
data[:, qticcol] -= start_t
end_t = (toc_step - start_t) / CPU_CLOCK end_t = (toc_step - start_t) / CPU_CLOCK
tasks = {} tasks = {}
...@@ -443,8 +448,12 @@ for line in range(num_lines): ...@@ -443,8 +448,12 @@ for line in range(num_lines):
tasks[thread][-1]["subtype"] = subtype tasks[thread][-1]["subtype"] = subtype
tic = int(data[line, ticcol]) / CPU_CLOCK tic = int(data[line, ticcol]) / CPU_CLOCK
toc = int(data[line, toccol]) / CPU_CLOCK toc = int(data[line, toccol]) / CPU_CLOCK
qtic = int(data[line, qticcol]) / CPU_CLOCK
unlocks = int(data[line, unlockscol])
tasks[thread][-1]["tic"] = tic tasks[thread][-1]["tic"] = tic
tasks[thread][-1]["toc"] = toc tasks[thread][-1]["toc"] = toc
tasks[thread][-1]["qtic"] = qtic
tasks[thread][-1]["unlocks"] = unlocks
if "fof" in tasktype: if "fof" in tasktype:
tasks[thread][-1]["colour"] = TASKCOLOURS[tasktype] tasks[thread][-1]["colour"] = TASKCOLOURS[tasktype]
elif ("self" in tasktype) or ("pair" in tasktype) or ("recv" in tasktype) or ("send" in tasktype): elif ("self" in tasktype) or ("pair" in tasktype) or ("recv" in tasktype) or ("send" in tasktype):
...@@ -463,27 +472,37 @@ ax.set_xlim(-delta_t * 0.01 / CPU_CLOCK, delta_t * 1.01 / CPU_CLOCK) ...@@ -463,27 +472,37 @@ ax.set_xlim(-delta_t * 0.01 / CPU_CLOCK, delta_t * 1.01 / CPU_CLOCK)
ax.set_ylim(0.5, nthread + 1.0) ax.set_ylim(0.5, nthread + 1.0)
ltics = [] ltics = []
lqtics = []
ltocs = [] ltocs = []
llabels = [] llabels = []
lunlocks = []
for i in range(nthread): for i in range(nthread):
# Collect ranges and colours into arrays. Also indexed lists for lookup tables. # Collect ranges and colours into arrays. Also indexed lists for lookup tables.
tictocs = [] tictocs = []
qtictocs = []
colours = [] colours = []
tics = [] tics = []
tocs = [] tocs = []
qtics = []
unlocks = []
labels = [] labels = []
for task in tasks[i]: for task in tasks[i]:
tictocs.append((task["tic"], task["toc"] - task["tic"])) tictocs.append((task["tic"], task["toc"] - task["tic"]))
qtictocs.append((task["qtic"], task["tic"] - task["qtic"]))
colours.append(task["colour"]) colours.append(task["colour"])
tics.append(task["tic"]) tics.append(task["tic"])
tocs.append(task["toc"]) tocs.append(task["toc"])
qtics.append(task["qtic"])
unlocks.append(task["unlocks"])
labels.append(task["type"] + "/" + task["subtype"]) labels.append(task["type"] + "/" + task["subtype"])
# Add to look up tables. # Add to look up tables.
ltics.append(tics) ltics.append(tics)
ltocs.append(tocs) ltocs.append(tocs)
lqtics.append(qtics)
lunlocks.append(unlocks)
llabels.append(labels) llabels.append(labels)
# Now plot. # Now plot.
...@@ -502,7 +521,8 @@ ax.yaxis.set_major_locator(loc) ...@@ -502,7 +521,8 @@ ax.yaxis.set_major_locator(loc)
ax.grid(True, which="major", axis="y", linestyle="-") ax.grid(True, which="major", axis="y", linestyle="-")
class Container: class Container:
def __init__(self, window, figure, motion, nthread, ltics, ltocs, llabels): def __init__(self, window, figure, motion, nthread, ltics, ltocs,
llabels, lqtics, lunlocks):
self.window = window self.window = window
self.figure = figure self.figure = figure
self.motion = motion self.motion = motion
...@@ -510,6 +530,8 @@ class Container: ...@@ -510,6 +530,8 @@ class Container:
self.ltics = ltics self.ltics = ltics
self.ltocs = ltocs self.ltocs = ltocs
self.llabels = llabels self.llabels = llabels
self.lqtics = lqtics
self.lunlocks = lunlocks
def plot(self): def plot(self):
canvas = tkagg.FigureCanvasTkAgg(self.figure, master=self.window) canvas = tkagg.FigureCanvasTkAgg(self.figure, master=self.window)
...@@ -517,7 +539,7 @@ class Container: ...@@ -517,7 +539,7 @@ class Container:
wcanvas.config(width=1000, height=300) wcanvas.config(width=1000, height=300)
wcanvas.pack(side=tk.TOP, expand=True, fill=tk.BOTH) wcanvas.pack(side=tk.TOP, expand=True, fill=tk.BOTH)
toolbar = tkagg.NavigationToolbar2TkAgg(canvas, self.window) toolbar = tkagg.NavigationToolbar2Tk(canvas, self.window)
toolbar.update() toolbar.update()
self.output = tk.StringVar() self.output = tk.StringVar()
label = tk.Label(self.window, textvariable=self.output, bg="white", fg="red", bd=2) label = tk.Label(self.window, textvariable=self.output, bg="white", fg="red", bd=2)
...@@ -540,15 +562,20 @@ class Container: ...@@ -540,15 +562,20 @@ class Container:
tics = self.ltics[thread] tics = self.ltics[thread]
tocs = self.ltocs[thread] tocs = self.ltocs[thread]
labels = self.llabels[thread] labels = self.llabels[thread]
qtics = self.lqtics[thread]
unlocks = self.lunlocks[thread]
for i in range(len(tics)): for i in range(len(tics)):
if event.xdata > tics[i] and event.xdata < tocs[i]: if event.xdata > tics[i] and event.xdata < tocs[i]:
tic = "{0:.3f}".format(tics[i]) tic = "{0:.3f}".format(tics[i])
toc = "{0:.3f}".format(tocs[i]) toc = "{0:.3f}".format(tocs[i])
outstr = "task = " + labels[i] + ", tic/toc = " + tic + " / " + toc qtic = "{0:.3f}".format(qtics[i])
unlock = "{0:d}".format(unlocks[i])
outstr = "task = " + labels[i] + ", tic/toc = " + tic + " / " + toc + " qtic = " + qtic + " unlocks = " + unlock
self.output.set(outstr) self.output.set(outstr)
break break
except TypeError: except TypeError:
# Ignore out of bounds. # Ignore out of bounds.
print("out of bounds")
pass pass
def quit(self): def quit(self):
...@@ -556,6 +583,7 @@ class Container: ...@@ -556,6 +583,7 @@ class Container:
window = tk.Tk() window = tk.Tk()
window.protocol("WM_DELETE_WINDOW", window.quit) window.protocol("WM_DELETE_WINDOW", window.quit)
container = Container(window, fig, args.motion, nthread, ltics, ltocs, llabels) container = Container(window, fig, args.motion, nthread, ltics, ltocs,
llabels, lqtics, lunlocks)
container.plot() container.plot()
window.mainloop() window.mainloop()