58#define WCC_NOT_VISITED 18446744073709551615
59#define WCC_VISITED 18446744073709551614
68 if (
debug) { printf(
"procid %d wcc_bfs() start\n",
procid); }
71 MPI_Barrier(MPI_COMM_WORLD);
72 elt = omp_get_wtime();
80 if (root_index !=
NULL_KEY && root_index < g->n_local)
88#pragma omp parallel default(shared)
106 printf(
"Task: %d wcc_bfs() GQ: %lu, TQ: %lu\n",
110#pragma omp for schedule(guided) nowait
111 for (
uint64_t i = 0; i <
q->queue_size; ++i)
115 if (wcc[vert_index] == root)
117 wcc[vert_index] = root;
128 if (out_index < g->n_local)
144 if (in_index < g->n_local)
167 elt = omp_get_wtime() - elt;
168 printf(
"Task %d wcc_bfs() time %9.6f (s)\n",
procid, elt);
170 if (
debug) { printf(
"Task %d wcc_bfs() success\n",
procid); }
179 if (
debug) { printf(
"Task %d wcc_color() start\n",
procid); }
182 MPI_Barrier(MPI_COMM_WORLD);
183 elt = omp_get_wtime();
195#pragma omp parallel default(shared)
222 q->queue_size =
q->next_size;
226 q->queue =
q->queue_next;
227 q->queue_next = temp;
233 printf(
"Task %d Iter %lu wcc_color() GQ: %lu, TQ: %lu\n",
237#pragma omp for schedule(guided) nowait
238 for (
uint64_t i = 0; i <
q->queue_size; ++i)
248 if (wcc[out_index] > wcc[vert_index])
250 wcc[vert_index] = wcc[out_index];
260 if (wcc[in_index] > wcc[vert_index])
262 wcc[vert_index] = wcc[in_index];
277#pragma omp for schedule(guided) nowait
278 for (
uint64_t i = 0; i <
q->send_size; ++i)
298#pragma omp for schedule(guided) nowait
299 for (
uint64_t i = 0; i <
q->send_size; ++i)
303 vert_index, wcc[vert_index]);
334 elt = omp_get_wtime() - elt;
335 printf(
"Task %d, wcc_color() time %9.6f (s)\n",
procid, elt);
337 if (
debug) { printf(
"Task %d wcc_color() success\n",
procid); }
344 MPI_Barrier(MPI_COMM_WORLD);
357 MPI_Allreduce(MPI_IN_PLACE, counts, (
int32_t)g->
n,
358 MPI_UINT64_T, MPI_SUM, MPI_COMM_WORLD);
366 if (counts[i] > max_wcc)
371 printf(
"Num CCs: %lu, Max CC: %lu, Unassigned %lu\n",
372 num_wccs, max_wcc, unassigned);
382 if (
verbose) printf(
"Task %d wcc assignments to %s\n",
procid, output_file);
386#pragma omp parallel for
390#pragma omp parallel for
395 MPI_Reduce(MPI_IN_PLACE, global_wcc, (
int32_t)g->
n,
396 MPI_UINT64_T, MPI_MIN, 0, MPI_COMM_WORLD);
398 MPI_Reduce(global_wcc, global_wcc, (
int32_t)g->
n,
399 MPI_UINT64_T, MPI_MIN, 0, MPI_COMM_WORLD);
407 printf(
"WCC error: %lu not assigned\n", i);
411 std::ofstream outfile;
412 outfile.open(output_file);
415 outfile << global_wcc[i] << std::endl;
422 if (
verbose) printf(
"Task %d done writing assignments\n",
procid);
430 if (
debug) { printf(
"Task %d wcc_dist() start\n",
procid); }
432 MPI_Barrier(MPI_COMM_WORLD);
433 double elt = omp_get_wtime();
439 MPI_Barrier(MPI_COMM_WORLD);
440 elt = omp_get_wtime() - elt;
441 if (
procid == 0) printf(
"WCC time %9.6f (s)\n", elt);
453 if (
debug) printf(
"Task %d wcc_dist() success\n",
procid);
Mac OS X ATTR com apple quarantine q
void init_thread_comm(thread_comm_t *tc)
void init_thread_queue(thread_queue_t *tq)
void clear_thread_queue(thread_queue_t *tq)
void init_sendbuf_vid_data(mpi_data_t *comm)
void clear_allbuf_vid_data(mpi_data_t *comm)
void clear_thread_comm(thread_comm_t *tc)
void empty_vid_data(thread_comm_t *tc, mpi_data_t *comm)
void empty_queue(thread_queue_t *tq, queue_data_t *q)
void add_vid_to_queue(thread_queue_t *tq, queue_data_t *q, uint64_t vertex_id)
void exchange_verts(dist_graph_t *g, mpi_data_t *comm, queue_data_t *q)
void update_vid_data_queues(dist_graph_t *g, thread_comm_t *tc, mpi_data_t *comm, uint64_t vert_index, uint64_t data)
void add_vid_to_send(thread_queue_t *tq, queue_data_t *q, uint64_t vertex_id)
void exchange_vert_data(dist_graph_t *g, mpi_data_t *comm, queue_data_t *q)
void empty_send(thread_queue_t *tq, queue_data_t *q)
void update_sendcounts_thread(dist_graph_t *g, thread_comm_t *tc, uint64_t vert_index)
#define out_vertices(g, n)
#define in_vertices(g, n)
uint64_t get_value(fast_map *map, uint64_t key)
unsigned __int64 uint64_t
uint64_t * sendcounts_temp
uint64_t global_queue_size
uint64_t * sendcounts_thread
int wcc_color(dist_graph_t *g, mpi_data_t *comm, queue_data_t *q, uint64_t *wcc)
int wcc_output(dist_graph_t *g, uint64_t *wcc, char *output_file)
int wcc_verify(dist_graph_t *g, uint64_t *wcc)
int wcc_bfs(dist_graph_t *g, mpi_data_t *comm, queue_data_t *q, uint64_t *wcc, uint64_t root)
int wcc_dist(dist_graph_t *g, mpi_data_t *comm, queue_data_t *q, uint64_t root, char *output_file)