-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (39 loc) · 1.15 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
NOWARN=-wd3180
EXEC=lu-omp
OBJ = $(EXEC) $(EXEC)-debug $(EXEC)-serial
MATRIX_SIZE=8000
MATRIX_CHECK_SIZE=100
W :=`grep processor /proc/cpuinfo | wc -l`
CHECKER=inspxe-cl -collect=ti3 -r check
VIEWER=inspxe-gui
# flags
OPT=-O2 -g
DEBUG=-O0 -g
OMP=-fopenmp
all: $(OBJ)
# build the debug parallel version of the program
$(EXEC)-debug: $(EXEC).cpp
icpc $(DEBUG) $(OMP) -o $(EXEC)-debug $(EXEC).cpp -lrt -lnuma
# build the serial version of the program
$(EXEC)-serial: $(EXEC).cpp
icpc $(OPT) $(NOWARN) -o $(EXEC)-serial $(EXEC).cpp -lrt -liomp5 -lnuma
# build the optimized parallel version of the program
$(EXEC): $(EXEC).cpp
icpc $(OPT) $(OMP) -o $(EXEC) $(EXEC).cpp -lrt -lnuma
#run the optimized program in parallel
runp: $(EXEC)
@echo use make runp W=nworkers
./$(EXEC) $(MATRIX_SIZE) $(W)
#run the serial version of your program
runs: $(EXEC)-serial
@echo use make runs
./$(EXEC)-serial $(MATRIX_SIZE) 1
#run the optimized program with thread checker
check: $(EXEC)
@echo use make check W=nworkers
$(CHECKER) ./$(EXEC) $(MATRIX_CHECK_SIZE) $(W)
#view the thread checker result
view:
$(VIEWER) check*/check*.inspxe
clean:
/bin/rm -rf $(OBJ) check*