58#define SCC_NOT_VISITED 18446744073709551615
59#define SCC_VISITED_FW 18446744073709551614
60#define SCC_EXPLORED_FW 18446744073709551613
61#define SCC_VISITED_BW 18446744073709551612
62#define SCC_EXPLORED_BW 18446744073709551611
63#define SCC_MARKED 18446744073709551610
72 if (
debug) { printf(
"procid %d scc_bfs_fw() start\n",
procid); }
75 MPI_Barrier(MPI_COMM_WORLD);
76 elt = omp_get_wtime();
84 if (root_index !=
NULL_KEY && root_index < g->n_local)
92#pragma omp parallel default(shared)
110 printf(
"Task: %d scc_bfs_fw() GQ: %lu, TQ: %lu\n",
114#pragma omp for schedule(guided) nowait
115 for (
uint64_t i = 0; i <
q->queue_size; ++i)
133 if (out_index < g->n_local)
156 elt = omp_get_wtime() - elt;
157 printf(
"Task %d scc_bfs_fw() time %9.6f (s)\n",
procid, elt);
159 if (
debug) { printf(
"Task %d scc_bfs_fw() success\n",
procid); }
167 if (
debug) { printf(
"procid %d scc_bfs_bw() start\n",
procid); }
170 MPI_Barrier(MPI_COMM_WORLD);
171 elt = omp_get_wtime();
183 if (root_index !=
NULL_KEY && root_index < g->n_local)
191#pragma omp parallel default(shared)
201 printf(
"Task: %d scc_bfs_bw() GQ: %lu, TQ: %lu\n",
205#pragma omp for schedule(guided) nowait
206 for (
uint64_t i = 0; i <
q->queue_size; ++i)
225 if (in_index < g->n_local)
244#pragma omp for schedule(guided) reduction(+:num_unassigned) nowait
259#pragma omp for schedule(guided) nowait
278#pragma omp for schedule(guided) nowait
307 MPI_Allreduce(MPI_IN_PLACE, &num_unassigned, 1,
308 MPI_UINT64_T, MPI_SUM, MPI_COMM_WORLD);
311 elt = omp_get_wtime() - elt;
312 printf(
"Task %d scc_bfs_bw() time %9.6f (s)\n",
procid, elt);
314 if (
debug) { printf(
"Task %d scc_bfs_bw() success\n",
procid); }
316 return num_unassigned;
323 if (
debug) { printf(
"Task %d scc_color() start\n",
procid); }
326 MPI_Barrier(MPI_COMM_WORLD);
327 elt = omp_get_wtime();
339#pragma omp parallel default(shared)
368 printf(
"SCC assignment is %lu, out of bounds for n=%lu\n", scc[i], g->
n);
375 q->queue_size =
q->next_size;
379 q->queue =
q->queue_next;
380 q->queue_next = temp;
386 printf(
"Task %d Iter %lu scc_color() GQ: %lu, TQ: %lu\n",
390#pragma omp for schedule(guided) nowait
391 for (
uint64_t i = 0; i <
q->queue_size; ++i)
402 colors[in_index] > colors[vert_index])
404 colors[vert_index] = colors[in_index];
419#pragma omp for schedule(guided) nowait
420 for (
uint64_t i = 0; i <
q->send_size; ++i)
440#pragma omp for schedule(guided) nowait
441 for (
uint64_t i = 0; i <
q->send_size; ++i)
445 vert_index, colors[vert_index]);
476 elt = omp_get_wtime() - elt;
477 printf(
"Task %d, scc_color() time %9.6f (s)\n",
procid, elt);
479 if (
debug) { printf(
"Task %d scc_color() success\n",
procid); }
489 if (
debug) { printf(
"procid %d scc_find_sccs() start\n",
procid); }
492 MPI_Barrier(MPI_COMM_WORLD);
493 elt = omp_get_wtime();
503#pragma omp parallel default(shared)
519 q->queue_size =
q->next_size;
523 q->queue =
q->queue_next;
524 q->queue_next = temp;
530 printf(
"Task: %d scc_find_sccs() GQ: %lu, TQ: %lu\n",
534#pragma omp for schedule(guided) nowait
535 for (
uint64_t i = 0; i <
q->queue_size; ++i)
542 scc[vert_index] = colors[vert_index];
550 colors[in_index] == colors[vert_index])
554 if (in_index < g->n_local)
573#pragma omp for schedule(guided) reduction(+:num_unassigned) nowait
586#pragma omp for schedule(guided) nowait
605#pragma omp for schedule(guided) nowait
634 MPI_Allreduce(MPI_IN_PLACE, &num_unassigned, 1,
635 MPI_UINT64_T, MPI_SUM, MPI_COMM_WORLD);
638 elt = omp_get_wtime() - elt;
639 printf(
"Task %d scc_find_sccs() time %9.6f (s)\n",
procid, elt);
641 if (
debug) { printf(
"Task %d scc_find_sccs() success\n",
procid); }
643 return num_unassigned;
649 MPI_Barrier(MPI_COMM_WORLD);
663 MPI_Allreduce(MPI_IN_PLACE, counts, (
int32_t)g->
n,
664 MPI_UINT64_T, MPI_SUM, MPI_COMM_WORLD);
665 MPI_Allreduce(MPI_IN_PLACE, &unassigned, 1,
666 MPI_UINT64_T, MPI_SUM, MPI_COMM_WORLD);
675 if (counts[i] > max_scc)
682 printf(
"Num SCCs: %lu, Max SCC: %lu, Trivial: %lu, Unassigned %lu\n",
683 num_sccs, max_scc, num_trivial, unassigned);
693 if (
verbose) printf(
"Task %d scc assignments to %s\n",
procid, output_file);
697#pragma omp parallel for
701#pragma omp parallel for
706 MPI_Reduce(MPI_IN_PLACE, global_scc, (
int32_t)g->
n,
707 MPI_UINT64_T, MPI_MIN, 0, MPI_COMM_WORLD);
709 MPI_Reduce(global_scc, global_scc, (
int32_t)g->
n,
710 MPI_UINT64_T, MPI_MIN, 0, MPI_COMM_WORLD);
718 printf(
"SCC error: %lu not assigned\n", i);
722 std::ofstream outfile;
723 outfile.open(output_file);
726 outfile << global_scc[i] << std::endl;
733 if (
verbose) printf(
"Task %d done writing assignments\n",
procid);
741 if (
debug) { printf(
"Task %d scc_dist() start\n",
procid); }
743 MPI_Barrier(MPI_COMM_WORLD);
744 double elt = omp_get_wtime();
750 num_unassigned =
scc_bfs_bw(g, comm,
q, scc, root);
752 while (num_unassigned)
758 MPI_Barrier(MPI_COMM_WORLD);
759 elt = omp_get_wtime() - elt;
760 if (
procid == 0) printf(
"SCC time %9.6f (s)\n", elt);
772 if (
debug) printf(
"Task %d scc_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 init_recvbuf_vid_data(mpi_data_t *comm)
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 exchange_data(mpi_data_t *comm)
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)
uint64_t scc_bfs_bw(dist_graph_t *g, mpi_data_t *comm, queue_data_t *q, uint64_t *scc, uint64_t root)
int scc_dist(dist_graph_t *g, mpi_data_t *comm, queue_data_t *q, uint64_t root, char *output_file)
int scc_verify(dist_graph_t *g, uint64_t *scc)
int scc_bfs_fw(dist_graph_t *g, mpi_data_t *comm, queue_data_t *q, uint64_t *scc, uint64_t root)
uint64_t scc_find_sccs(dist_graph_t *g, mpi_data_t *comm, queue_data_t *q, uint64_t *scc, uint64_t *colors)
int scc_color(dist_graph_t *g, mpi_data_t *comm, queue_data_t *q, uint64_t *scc, uint64_t *colors)
int scc_output(dist_graph_t *g, uint64_t *scc, char *output_file)
unsigned __int64 uint64_t
uint64_t * sendcounts_temp
uint64_t global_queue_size
uint64_t * sendcounts_thread