This commit is contained in:
yly 2025-11-17 20:39:49 +08:00
parent 745e29475c
commit a8a0837e11
2 changed files with 3 additions and 4 deletions

View File

@ -10,10 +10,10 @@ TARGET := $(basename $(SRC))
all: $(TARGET) all: $(TARGET)
mpi_%: mpi_%.c mpi_%: mpi_%.c
$(MPICC) $(CFLAGS) -o $@ $< $(MPICC) $(CFLAGS) -o $@ $<
serial_%: serial_%.c serial_%: serial_%.c
$(CC) $(CFLAGS) -o $@ $< $(CC) $(CFLAGS) -o $@ $<
run: $(TARGET) run: $(TARGET)
$(MPIRUN) -np 4 ./$@ $(MPIRUN) -np 4 ./$@

View File

@ -30,6 +30,5 @@ int main(int argc, char **argv) {
total = total * 4; total = total * 4;
printf("Result: %.10lf\n", total); printf("Result: %.10lf\n", total);
printf("Accuracy: %.10lf\n", PI - total); printf("Accuracy: %.10lf\n", PI - total);
printf("Time: printf("Time: %.10lf\n", (double)(time2 - time1)/CLOCKS_PER_SEC);
%.10lf\n", (double)(time2 - time1)/CLOCKS_PER_SEC);
} }