-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
executable file
·51 lines (36 loc) · 1.07 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
SHELL := /bin/bash
##
# Parallel matrix multiplication
#
# @file
# @version 0.1
CC = gcc
CFLAGS = -lpapi -g -I$(SRC_DIR)
CUDA_FLAGS = -lpapi -g -G -I$(SRC_DIR)
BIN = cuda cuda_dim omp mpi seq mpi_br
SRC_DIR = ./src
SRC := $(wildcard $(SRC_DIR)/*.c)
OBJ := $(patsubst $(SRC_DIR)%.c,$(BUILD_DIR)%.o,$(SRC))
SEQ_SRC := $(SRC_DIR)/seq/seq.c
CUDA_SRC := $(SRC_DIR)/cuda/cuda-matmul.cu
CUDA_dim_SRC := $(SRC_DIR)/cuda_dim/cuda_dim-matmul.cu
OPENMP_SRC := $(SRC_DIR)/openmp/openmp-matmul.c
MPI_SRC := $(wildcard $(SRC_DIR)/mpi/*.c)
MPI_br_SRC := $(SRC_DIR)/mpi_br/mpi_br-matmul.c
.PHONY: clean
all: $(BIN)
seq: $(SRC) $(SEQ_SRC)
$(CC) $(CFLAGS) -DSESSION='"seq"' -o $@ $^
cuda: $(CUDA_SRC) $(SRC)
nvcc $(CUDA_FLAGS) -DSESSION='"CUDA"' -o $@ $^
cuda_dim: $(CUDA_dim_SRC) $(SRC)
nvcc $(CUDA_FLAGS) -lm -DSESSION='"CUDA_dim"' -o $@ $^
omp: $(OPENMP_SRC) $(SRC)
$(CC) $(CFLAGS) -DSESSION='"omp"' -fopenmp -o $@ $(OPENMP_SRC) $(SRC)
mpi: $(MPI_SRC) $(SRC)
mpicc $(CFLAGS) -Wall -DMPI -o $@ $^
mpi_br: $(MPI_br_SRC) $(SRC)
mpicc $(CFLAGS) -Wall -DMPI -o $@ $^
clean:
@rm -f $(BIN)
# end