working: rip why is it slower
This commit is contained in:
parent
d477611892
commit
0619d79caa
2 changed files with 26 additions and 17 deletions
|
@ -1,10 +1,10 @@
|
|||
.PHONY: run clean
|
||||
|
||||
CFLAGS += -g -pg
|
||||
# CFLAGS += -DFMT_HEADER_ONLY -O3
|
||||
# CFLAGS += -O3
|
||||
CFLAGS += -DFMT_HEADER_ONLY -g
|
||||
# LDFLAGS += $(shell pkg-config --libs fmt)
|
||||
|
||||
lpa: lpa.cpp Makefile test.gdb
|
||||
lpa: lpa.cpp Makefile
|
||||
mpic++ $(CFLAGS) $(LDFLAGS) -o $@ lpa.cpp
|
||||
|
||||
lpac: lpa.cpp
|
||||
|
|
|
@ -14,8 +14,10 @@
|
|||
#include <unistd.h>
|
||||
#include <utility>
|
||||
|
||||
// #include <fmt/format.h>
|
||||
// #include <fmt/ranges.h>
|
||||
#ifdef FMT_HEADER_ONLY
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
#endif
|
||||
|
||||
#define TAG_SEND_NUM_EDGES 1001
|
||||
#define TAG_SEND_EDGES 1002
|
||||
|
@ -163,7 +165,7 @@ int main(int argc, char **argv) {
|
|||
MPI_Barrier(MPI_COMM_WORLD);
|
||||
double step_2_start_time;
|
||||
if (rank == 0)
|
||||
step_2_start_time = MPI_Wtime();
|
||||
step_2_start_time = MPI_Wtime();
|
||||
|
||||
// Each process analyzes the non-local edges that are contained in its portion
|
||||
// of the graph.
|
||||
|
@ -225,7 +227,7 @@ int main(int argc, char **argv) {
|
|||
MPI_Barrier(MPI_COMM_WORLD);
|
||||
double step_5_start_time;
|
||||
if (rank == 0) {
|
||||
step_5_start_time = MPI_Wtime();
|
||||
step_5_start_time = MPI_Wtime();
|
||||
printf("STARTING STEP 5: %0.04fs\n", step_5_start_time - step_2_start_time);
|
||||
}
|
||||
|
||||
|
@ -291,10 +293,6 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
}
|
||||
|
||||
// std::cout << fmt::format("[{}] Helloge {}", rank,
|
||||
// fmt::join(new_labels, ", "))
|
||||
// << std::endl;
|
||||
|
||||
// Have there been any changes in the labels?
|
||||
int num_changes = new_labels.size();
|
||||
int total_changes;
|
||||
|
@ -319,7 +317,7 @@ int main(int argc, char **argv) {
|
|||
MPI_Barrier(MPI_COMM_WORLD);
|
||||
double end_time;
|
||||
if (rank == 0)
|
||||
end_time = MPI_Wtime();
|
||||
end_time = MPI_Wtime();
|
||||
|
||||
if (rank == 0) {
|
||||
printf("2-5 Time: %0.04fs\n", end_time - step_2_start_time);
|
||||
|
@ -353,11 +351,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
std::cout << "Done! " << label_count.size() << std::endl;
|
||||
} else {
|
||||
std::vector<int> flat_assignments;
|
||||
for (int i = 0; i < num_my_nodes; ++i) {
|
||||
flat_assignments.push_back(node_label_assignment_vec[i]);
|
||||
}
|
||||
MPI_Send(flat_assignments.data(), flat_assignments.size(), MPI_INT, 0,
|
||||
MPI_Send(node_label_assignment_vec, num_my_nodes, MPI_INT, 0,
|
||||
TAG_SEND_FINAL_RESULT, MPI_COMM_WORLD);
|
||||
}
|
||||
#pragma endregion
|
||||
|
@ -428,6 +422,21 @@ int lookup_assignment(int *base_node_assignment, pair my_node_range,
|
|||
int index = -1, ctr = 0;
|
||||
std::vector<int> inner(recv_map[process_from].begin(),
|
||||
recv_map[process_from].end());
|
||||
// {
|
||||
// int lo = 0, hi = count;
|
||||
// while (lo < hi) {
|
||||
// int mid = (lo + hi) / 2;
|
||||
// int midk = inner[mid];
|
||||
// if (node_number < midk)
|
||||
// hi = mid;
|
||||
// else if (node_number > midk)
|
||||
// lo = mid;
|
||||
// else {
|
||||
// index = mid;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
for (int i = 0; i < count; ++i) {
|
||||
int remote_node = inner[i];
|
||||
if (node_number == remote_node) {
|
||||
|
|
Loading…
Reference in a new issue