This commit is contained in:
Michael Zhang 2023-11-25 01:32:19 -06:00
parent db37ce6a18
commit 755185ca26
2 changed files with 22 additions and 16 deletions

View file

@ -1,18 +1,15 @@
.PHONY: run clean
CFLAGS += -g -O3
CFLAGS += -DFMT_HEADER_ONLY
LDFLAGS += $(shell pkg-config --libs fmt)
clean:
rm -f lpa
lpac: lpa.cpp
mpicc $(CFLAGS) $(LDFLAGS) -o $@ $<
CFLAGS += -g
# CFLAGS += -DFMT_HEADER_ONLY -O3
# LDFLAGS += $(shell pkg-config --libs fmt)
lpa: lpa.cpp Makefile test.gdb
mpic++ $(CFLAGS) $(LDFLAGS) -o $@ lpa.cpp
lpac: lpa.cpp
mpicc $(CFLAGS) $(LDFLAGS) -o $@ $<
run:
watchexec -c clear 'make lpa && mpirun -n 4 ./lpa dataset/both_1000.txt'
@ -24,3 +21,6 @@ zhan4854.tar.gz: Makefile ASSIGNMENT.md lpa.cpp report.pdf
cp $^ zhan4854
tar -czvf $@ zhan4854
rm -r zhan4854
clean:
rm -f lpa

View file

@ -14,8 +14,8 @@
#include <unistd.h>
#include <utility>
#include <fmt/format.h>
#include <fmt/ranges.h>
// #include <fmt/format.h>
// #include <fmt/ranges.h>
#define TAG_SEND_NUM_EDGES 1001
#define TAG_SEND_EDGES 1002
@ -161,7 +161,9 @@ int main(int argc, char **argv) {
// STEP 2 TIMER STARTS HERE
MPI_Barrier(MPI_COMM_WORLD);
double step_2_start_time = MPI_Wtime();
double step_2_start_time;
if (rank == 0)
step_2_start_time = MPI_Wtime();
// Each process analyzes the non-local edges that are contained in its portion
// of the graph.
@ -221,7 +223,9 @@ int main(int argc, char **argv) {
// STEP 5 TIMER STARTS HERE
MPI_Barrier(MPI_COMM_WORLD);
double step_5_start_time = MPI_Wtime();
double step_5_start_time;
if (rank == 0)
step_5_start_time = MPI_Wtime();
// The processes perform the transfers of non-local labels and updates of
// local labels until convergence.
@ -311,7 +315,9 @@ int main(int argc, char **argv) {
// END TIMERS
MPI_Barrier(MPI_COMM_WORLD);
double end_time = MPI_Wtime();
double end_time;
if (rank == 0)
end_time = MPI_Wtime();
if (rank == 0) {
printf("2-5 Time: %0.04fs\n", end_time - step_2_start_time);