64 if (
debug) { printf(
"Task %d create_graph() start\n",
procid); }
68 MPI_Barrier(MPI_COMM_WORLD);
69 elt = omp_get_wtime();
83 if (out_edges == NULL || out_degree_list == NULL || temp_counts == NULL)
84 throw_err(
"create_graph(), unable to allocate out edge storage",
procid);
90 out_degree_list[i] = 0;
99 out_degree_list[i+1] = out_degree_list[i] + temp_counts[i];
112 if (in_edges == NULL || in_degree_list == NULL)
113 throw_err(
"create_graph(), unable to allocate in edge storage\n",
procid);
117#pragma omp for nowait
119 in_degree_list[i] = 0;
120#pragma omp for nowait
128 in_degree_list[i+1] = in_degree_list[i] + temp_counts[i];
142#pragma omp parallel for
147 elt = omp_get_wtime() - elt;
148 printf(
"Task %d create_graph() %9.6f (s)\n",
procid, elt);
151 if (
debug) { printf(
"Task %d create_graph() success\n",
procid); }
157 if (
debug) { printf(
"Task %d create_graph_serial() success\n",
procid); }
160 MPI_Barrier(MPI_COMM_WORLD);
161 elt = omp_get_wtime();
177 if (out_edges == NULL || out_degree_list == NULL || temp_counts == NULL)
178 throw_err(
"create_graph_serial(), unable to allocate out edge storage\n",
procid);
182#pragma omp for nowait
184 out_degree_list[i] = 0;
185#pragma omp for nowait
193 out_degree_list[i+1] = out_degree_list[i] + temp_counts[i];
203 if (in_edges == NULL || in_degree_list == NULL)
204 throw_err(
"create_graph_serial(), unable to allocate in edge storage\n",
procid);
208#pragma omp for nowait
210 in_degree_list[i] = 0;
211#pragma omp for nowait
219 in_degree_list[i+1] = in_degree_list[i] + temp_counts[i];
243 elt = omp_get_wtime() - elt;
244 printf(
"Task %d create_graph_serial() %9.6f (s)\n",
procid, elt);
246 if (
debug) { printf(
"Task %d create_graph_serial() success\n",
procid); }
253 if (
debug) { printf(
"Task %d clear_graph() start\n",
procid); }
266 if (
debug) { printf(
"Task %d clear_graph() success\n",
procid); }
273 if (
debug) { printf(
"Task %d relabel_edges() start\n",
procid); }
276 MPI_Barrier(MPI_COMM_WORLD);
277 elt = omp_get_wtime();
331#pragma omp parallel for
342 elt = omp_get_wtime() - elt;
343 printf(
" Task %d relabel_edges() %9.6f (s)\n",
procid, elt);
346 if (
debug) { printf(
"Task %d relabel_edges() success\n",
procid); }
353 if (
debug) { printf(
"Task %d relabel_edges() start\n",
procid); }
356 MPI_Barrier(MPI_COMM_WORLD);
357 elt = omp_get_wtime();
411#pragma omp parallel for
422 elt = omp_get_wtime() - elt;
423 printf(
" Task %d relabel_edges() %9.6f (s)\n",
procid, elt);
426 if (
debug) { printf(
"Task %d relabel_edges() success\n",
procid); }
432 if (
debug) { printf(
"Task %d repart_graph() start\n",
procid); }
435 MPI_Barrier(MPI_COMM_WORLD);
436 elt = omp_get_wtime();
442#pragma omp parallel for
444 global_parts[i] = -1;
448 std::ifstream outfile;
449 outfile.open(part_file);
452 outfile >> global_parts[i];
458 if (global_parts[i] == -1)
460 printf(
"Part Error: %lu not assigned\n", i);
465 MPI_Bcast(global_parts, (
int32_t)g->
n, MPI_INT32_T, 0, MPI_COMM_WORLD);
467#pragma omp parallel for
483 elt = omp_get_wtime() - elt;
484 printf(
"Task %d repart_graph() %9.6f (s)\n",
procid, elt);
487 if (
debug) { printf(
"Task %d repart_graph() success\n",
procid); }
494 for (
int i = 0; i <
nprocs; ++i)
520 if (recvbuf_vids == NULL ||
521 recvbuf_deg_out == NULL || recvbuf_deg_in == NULL)
524 uint64_t max_transfer = total_send > total_recv ? total_send : total_recv;
526 MPI_Allreduce(MPI_IN_PLACE, &num_comms, 1,
527 MPI_UINT64_T, MPI_MAX, MPI_COMM_WORLD);
530 printf(
"Task %d repart_graph() num_comms %lu total_send %lu total_recv %lu\n",
procid, num_comms, total_send, total_recv);
533 for (
uint64_t c = 0; c < num_comms; ++c)
537 if (c == (num_comms-1))
547 printf(
"Task %d send_begin %lu send_end %lu\n",
procid, send_begin, send_end);
548 for (
uint64_t i = send_begin; i < send_end; ++i)
554 MPI_Alltoall(comm->
sendcounts, 1, MPI_INT32_T,
555 comm->
recvcounts, 1, MPI_INT32_T, MPI_COMM_WORLD);
572 if (sendbuf_vids == NULL ||
573 sendbuf_deg_out == NULL || sendbuf_deg_in == NULL)
576 for (
uint64_t i = send_begin; i < send_end; ++i)
588 MPI_UINT64_T, MPI_COMM_WORLD);
592 MPI_UINT64_T, MPI_COMM_WORLD);
596 MPI_UINT64_T, MPI_COMM_WORLD);
599 free(sendbuf_deg_out);
600 free(sendbuf_deg_in);
608 for (
int i = 0; i <
nprocs; ++i)
632 if (recvbuf_e_out == NULL)
641 printf(
"Task %d repart_graph() num_comms %lu total_send %lu total_recv %lu\n",
procid, num_comms, total_send, total_recv);
644 for (
uint64_t c = 0; c < num_comms; ++c)
648 if (c == (num_comms-1))
657 for (
uint64_t i = send_begin; i < send_end; ++i)
663 MPI_Alltoall(comm->
sendcounts, 1, MPI_INT32_T,
664 comm->
recvcounts, 1, MPI_INT32_T, MPI_COMM_WORLD);
679 if (sendbuf_e_out == NULL)
682 for (
uint64_t i = send_begin; i < send_end; ++i)
696 sendbuf_e_out[snd_index++] = out;
702 MPI_UINT64_T, MPI_COMM_WORLD);
703 sum_recv_e_out += (
uint64_t)cur_recv;
713 for (
uint64_t i = 0; i < sum_recv_deg; ++i)
716 free(recvbuf_deg_out);
724 for (
int i = 0; i <
nprocs; ++i)
748 if (recvbuf_e_in == NULL)
757 printf(
"Task %d repart_graph() num_comms %lu total_send %lu total_recv %lu\n",
procid, num_comms, total_send, total_recv);
760 for (
uint64_t c = 0; c < num_comms; ++c)
764 if (c == (num_comms-1))
773 for (
uint64_t i = send_begin; i < send_end; ++i)
779 MPI_Alltoall(comm->
sendcounts, 1, MPI_INT32_T,
780 comm->
recvcounts, 1, MPI_INT32_T, MPI_COMM_WORLD);
795 if (sendbuf_e_in == NULL)
798 for (
uint64_t i = send_begin; i < send_end; ++i)
812 sendbuf_e_in[snd_index++] = in;
818 MPI_UINT64_T, MPI_COMM_WORLD);
819 sum_recv_e_in += (
uint64_t)cur_recv;
829 for (
uint64_t i = 0; i < sum_recv_deg; ++i)
832 free(recvbuf_deg_in);
838 for (
uint64_t i = 0; i < sum_recv_deg; ++i)
848 if (
debug) { printf(
"Task %d get_max_degree_vert() start\n",
procid); }
851 MPI_Barrier(MPI_COMM_WORLD);
852 elt = omp_get_wtime();
864 if (this_degree > my_max_degree)
866 my_max_degree = this_degree;
880 MPI_Allreduce(&my_max_out_degree, &max_out_degree, 1, MPI_UINT64_T,
881 MPI_MAX, MPI_COMM_WORLD);
882 MPI_Allreduce(&my_max_in_degree, &max_in_degree, 1, MPI_UINT64_T,
883 MPI_MAX, MPI_COMM_WORLD);
884 MPI_Allreduce(&my_max_degree, &max_degree, 1, MPI_UINT64_T,
885 MPI_MAX, MPI_COMM_WORLD);
886 if (my_max_degree == max_degree)
887 max_vert = my_max_vert;
890 MPI_Allreduce(MPI_IN_PLACE, &max_vert, 1, MPI_UINT64_T,
891 MPI_MIN, MPI_COMM_WORLD);
898 elt = omp_get_wtime() - elt;
899 printf(
"Task %d, max_degree %lu, max_vert %lu, max_in_degree %lu, max_out_degree %lu, %f (s)\n",
900 procid, max_degree, max_vert, max_in_degree, max_out_degree, elt);
903 if (
debug) { printf(
"Task %d get_max_degree_vert() success\n",
procid); }
int clear_graph(dist_graph_t *g)
int repart_graph(dist_graph_t *g, mpi_data_t *comm, char *part_file)
int relabel_edges(dist_graph_t *g)
int create_graph(graph_gen_data_t *ggi, dist_graph_t *g)
int create_graph_serial(graph_gen_data_t *ggi, dist_graph_t *g)
int get_max_degree_vert(dist_graph_t *g)
#define out_vertices(g, n)
#define in_vertices(g, n)
void clear_map(fast_map *map)
void init_map_nohash(fast_map *map, uint64_t init_size)
bool is_init(fast_map *map)
void init_map(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)
unsigned __int64 uint64_t
uint64_t * in_degree_list
uint64_t * out_degree_list
uint64_t * sendcounts_temp
uint64_t * recvcounts_temp
void throw_err(char const *err_message)