Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I have a question about MPI project. The assignment is included into the question. I have trouble implementing the part one. Above is the original,
I have a question about MPI project. The assignment is included into the question. I have trouble implementing the part one.
Above is the original, empty code.
Above is my implementation which gives me errors.
I need help parallelizing my code using MPI. I need to send result array after every iteration to each processor.
2{ HNMON = 1 int mpi_vertex_dist(graph_t *graph, int start_vertex, int *result) 3 int num_vertices = graph->num_vertices; 4 fill_n(result, num_vertices, MAX_DIST); 5 6 auto start_time Time:: now(); 7 8 int depth = 0; 9 result[start_vertex] = depth; 10 11 int keep going = true; 12 13 while (keep going) 14 { 15 keep going = false; 17 for (int vertex = 0; vertex v_adj_begin[vertex]; 21 na graph ->v_adj_begin[vertex] + graph->v_adj_length[vertex]; 22 n++) 23 { 24 int neighbor = graph->v_adj_list[n]; 25 26 if (result[neighbor] > depth+1) { 28 result[neighbor] = depth+1; 29 keep going = true; 30 mo 16 OD 0 Nm 27 CO O o } 31 } 32 } 33 } wwwwwwwww depth++; 34 35 36 37 38 39 40 } } //print_result(graph, result, depth); return std::chrono:: duration_cast
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started