-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
75 lines (59 loc) · 1.92 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
##################################################################################
# Makefile for all versions (serial, vectorized, OMP, MPI, CUDA) of Game of Life #
##################################################################################
#############
# Compilers #
#############
# Intel C compiler
CC = icc
# Intel C compiler, with MPI support
MPICC = mpiicc
# NVIDIA CUDA C compiler
NVCC = nvcc
#####################
# Compilation flags #
#####################
# ICC vectorization flags
VEC_FLAGS = -O2 -ipo -xHost
# OpenMP flags
OMP_FLAGS = -qopenmp
# MPI flags
MPI_FLAGS = -DGoL_MPI
# CUDA flags
CUDA_FLAGS = -DGoL_CUDA
####################
# Source endpoints #
####################
SRC_DIR = src
CPU_DIR = $(SRC_DIR)/cpu
GPU_DIR = $(SRC_DIR)/gpu
####################
# Output endpoints #
####################
# Binary files' common prefix
BIN_PRE = GoL
# Binary files' directory
BIN_DIR = bin
all: dirs no_opt vec omp vec_omp mpi vec_mpi hybrid vec_hybrid cuda
dirs:
mkdir -p $(BIN_DIR)
no_opt: $(CPU_DIR)/gol.c
$(CC) -O0 -o $(BIN_DIR)/$(BIN_PRE)_no_opt $(CPU_DIR)/gol.c
vec: $(CPU_DIR)/gol.c
$(CC) $(VEC_FLAGS) -o $(BIN_DIR)/$(BIN_PRE)_vec $(CPU_DIR)/gol.c
omp: $(CPU_DIR)/gol.c
$(CC) $(OMP_FLAGS) -o $(BIN_DIR)/$(BIN_PRE)_omp $(CPU_DIR)/gol.c
vec_omp: $(CPU_DIR)/gol.c
$(CC) $(VEC_FLAGS) $(OMP_FLAGS) -o $(BIN_DIR)/$(BIN_PRE)_omp_vec $(CPU_DIR)/gol.c
mpi: $(CPU_DIR)/gol.c
$(MPICC) $(MPI_FLAGS) -o $(BIN_DIR)/$(BIN_PRE)_mpi $(CPU_DIR)/gol.c
vec_mpi: $(CPU_DIR)/gol.c
$(MPICC) $(VEC_FLAGS) $(MPI_FLAGS) -o $(BIN_DIR)/$(BIN_PRE)_mpi_vec $(CPU_DIR)/gol.c
hybrid: $(CPU_DIR)/gol.c
$(MPICC) $(OMP_FLAGS) $(MPI_FLAGS) -o $(BIN_DIR)/$(BIN_PRE)_hybrid $(CPU_DIR)/gol.c
vec_hybrid: $(CPU_DIR)/gol.c
$(MPICC) $(VEC_FLAGS) $(OMP_FLAGS) $(MPI_FLAGS) -o $(BIN_DIR)/$(BIN_PRE)_hybrid_vec $(CPU_DIR)/gol.c
cuda: $(GPU_DIR)/gol.cu
$(NVCC) $(CUDA_FLAGS) $(GPU_DIR)/gol.cu -o $(BIN_DIR)/$(BIN_PRE)_cuda
clean:
rm -rf $(BIN_DIR)