Skip to content

Apply dynamic scheduling to cc_sv hooking loop - #48

Open
hcoffey1 wants to merge 1 commit into
sbeamer:masterfrom
hcoffey1:cc_sv-dynamic-schedule
Open

hcoffey1 wants to merge 1 commit into
sbeamer:masterfrom
hcoffey1:cc_sv-dynamic-schedule

Conversation

@hcoffey1

@hcoffey1 hcoffey1 commented Sep 13, 2026

Copy link
Copy Markdown

This PR adjusts the OpenMP scheduler for the hooking loop in cc_sv.

The current scheduler performs a static partitioning of the loop iterations, but for structured graphs like twitter.sg where connections are concentrated in certain node index ranges, this leads to thread workload imbalance.

If we use 4 worker threads on the twitter graph and examine how the current static partitioning works, we see threads 0, 2, and 3 are assigned less intensive portions of the graph.
twitter_degree_static

Below is a bandwidth-estimate measurement with a tool I worked on, ZRay. The run is performing 5 trials. Threads 0, 2, and 3 are largely idle.
Screenshot_select-area_20260913165432

Updating the OpenMP pragma to match the scheduler currently used in cc, the thread imbalance is resolved.
#pragma omp parallel for schedule(dynamic, 16384)
Screenshot_select-area_20260913165458

This leads to about a 2.5X speedup when processing the twitter.sg graph.

Before:

/mydata/gapbs (cc_sv-dynamic-schedule) » OMP_NUM_THREADS=4 numactl --m 0 -N 0 ./cc_sv -f ./benchmark/graphs/twitter.sg -n 5
Read Time:           47.86347
Graph has 61578171 nodes and 1053505858 directed edges for degree: 17
Shiloach-Vishkin took 4 iterations
Trial Time:          29.98726
Shiloach-Vishkin took 4 iterations
Trial Time:          29.99018
Shiloach-Vishkin took 4 iterations
Trial Time:          29.99191
Shiloach-Vishkin took 4 iterations
Trial Time:          29.98698
Shiloach-Vishkin took 4 iterations
Trial Time:          29.98203
Average Time:        29.98767

After:

/mydata/gapbs (cc_sv-dynamic-schedule*) » OMP_NUM_THREADS=4 numactl --m 0 -N 0 ./cc_sv -f ./benchmark/graphs/twitter.sg -n 5
Read Time:           47.89368
Graph has 61578171 nodes and 1053505858 directed edges for degree: 17
Shiloach-Vishkin took 4 iterations
Trial Time:          11.70602
Shiloach-Vishkin took 4 iterations
Trial Time:          11.32988
Shiloach-Vishkin took 3 iterations
Trial Time:          8.99948
Shiloach-Vishkin took 4 iterations
Trial Time:          11.71223
Shiloach-Vishkin took 4 iterations
Trial Time:          11.71172
Average Time:        11.09187

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant