This commit is contained in:
yly 2025-11-17 20:35:06 +08:00
parent a628d873c5
commit 745e29475c

View File

@ -2,16 +2,19 @@
MPICC ?= mpicc
MPIRUN ?= mpirun
CFLAGS ?= -O2 -Wall
TARGET := $(basename $(SRC))
SRC := mpi_hello_world.c serial_pi.c mpi_pi.c
TARGET := $(basename $(SRC))
.PHONY: all clean run
all: $(TARGET)
$(TARGET): $(SRC)
mpi_%: mpi_%.c
$(MPICC) $(CFLAGS) -o $@ $<
serial_%: serial_%.c
$(CC) $(CFLAGS) -o $@ $<
run: $(TARGET)
$(MPIRUN) -np 4 ./$@