53#include <unordered_map>
61#define LABEL_NOT_ASSIGNED 18446744073709551615
70 if (
debug) { printf(
"Task %d run_labelprop() start\n",
procid); }
73 MPI_Barrier(MPI_COMM_WORLD);
74 elt = omp_get_wtime();
82#pragma omp parallel default(shared)
105#pragma omp for schedule(guided) nowait
124#pragma omp for schedule(guided) nowait
152 for (
uint32_t iter = 0; iter < num_iter; ++iter)
155 printf(
"Task %d Iter %u run_labelprop()\n",
procid, iter);
158#pragma omp for schedule(guided) nowait
173 uint64_t label_out = labels[out_index];
202 uint64_t label_in = labels[in_index];
228 if (labels_next[vert_index] ==
NULL_KEY)
229 labels_next[vert_index] = labels[vert_index];
248 labels = labels_next;
260 elt = omp_get_wtime() - elt;
261 printf(
"Task %d, run_labelprop() time %9.6f (s)\n",
procid, elt);
263 if (
debug) { printf(
"Task %d run_labelprop() success\n",
procid); }
272 if (
debug) printf(
"Task %d labels to %s\n",
procid, output_file);
276#pragma omp parallel for
280#pragma omp parallel for
286 MPI_Reduce(MPI_IN_PLACE, global_labels, (
int32_t)g->
n,
287 MPI_UINT64_T, MPI_MIN, 0, MPI_COMM_WORLD);
289 MPI_Reduce(global_labels, global_labels, (
int32_t)g->
n,
290 MPI_UINT64_T, MPI_MIN, 0, MPI_COMM_WORLD);
298 printf(
"Labels error: %lu not assigned\n", i);
299 global_labels[i] = 0;
302 std::ofstream outfile;
303 outfile.open(output_file);
306 outfile << global_labels[i] << std::endl;
313 if (
debug) printf(
"Task %d done writing labels\n",
procid);
320 if (
debug) { printf(
"Task %d labelprop_verify() start\n",
procid); }
325#pragma omp parallel for
329#pragma omp parallel for
334 MPI_Reduce(MPI_IN_PLACE, global_labels, (
int32_t)g->
n,
335 MPI_UINT64_T, MPI_MIN, 0, MPI_COMM_WORLD);
337 MPI_Reduce(global_labels, global_labels, (
int32_t)g->
n,
338 MPI_UINT64_T, MPI_MIN, 0, MPI_COMM_WORLD);
342#pragma omp parallel for
347 ++label_counts[global_labels[i]];
351 for (
uint64_t i = 0; i < num_to_output; ++i)
352 printf(
"LP VERIFY %lu: label: %lu, size: %lu\n", i, global_labels[i], label_counts[i]);
358 if (
debug) { printf(
"Task %d labelprop_verify() success\n",
procid); }
364 uint32_t num_iter,
char* output_file)
366 if (
debug) { printf(
"Task %d labelprop_dist() start\n",
procid); }
368 MPI_Barrier(MPI_COMM_WORLD);
369 double elt = omp_get_wtime();
374 MPI_Barrier(MPI_COMM_WORLD);
375 elt = omp_get_wtime() - elt;
376 if (
procid == 0) printf(
"LabelProp time %9.6f (s)\n", elt);
388 if (
debug) printf(
"Task %d labelprop_dist() success\n",
procid);
void init_thread_comm(thread_comm_t *tc)
void init_recvbuf_vid_data(mpi_data_t *comm)
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 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 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)
void empty_map(fast_map *map)
void init_map(fast_map *map)
uint64_t get_max_key(fast_map *map)
void set_value(fast_map *map, uint64_t key, uint64_t value)
uint64_t get_value(fast_map *map, uint64_t key)
void set_value_uq(fast_map *map, uint64_t key, uint64_t value)
#define LABEL_NOT_ASSIGNED
int labelprop_output(dist_graph_t *g, uint64_t *labels, char *output_file)
int labelprop_dist(dist_graph_t *g, mpi_data_t *comm, uint32_t num_iter, char *output_file)
int labelprop_verify(dist_graph_t *g, uint64_t *labels, uint64_t num_to_output)
int run_labelprop(dist_graph_t *g, mpi_data_t *comm, uint64_t *&labels, uint32_t num_iter)
unsigned __int64 uint64_t
uint64_t * sendcounts_temp
uint64_t * sendcounts_thread
void quicksort_dec(uint64_t *arr1, uint64_t *arr2, int64_t left, int64_t right)