-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·78 lines (58 loc) · 2.83 KB
/
Copy pathMakefile
File metadata and controls
executable file
·78 lines (58 loc) · 2.83 KB
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
76
77
78
# Default values for Path and Name of generated executable
EXEC_NAME = master
EXEC_NAME_SLAVE = slave
host = localhost
CC_PATH=
ARFF_SRC=
# Location of Cereal library files
CEREAL_SRC = include
# C++ Compiler
CC = $(CC_PATH)mpic++
# C++ Compiler Flags
CC_FLAGS = -std=c++11 -w -Ofast -fstack-protector -I $(CEREAL_SRC) -fopenmp
SOURCES = $(wildcard arff_*.cpp) Point.cpp output.cpp
OBJECTS = $(SOURCES:.cpp=.o)
master: $(OBJECTS)
$(CC) $(CC_FLAGS) $(OBJECTS) -o $(EXEC_PATH)$(EXEC_NAME)
SOURCES_SLAVE = Point.cpp outputslave.cpp
OBJECTS_SLAVE = $(SOURCES_SLAVE:.cpp=.o)
# Slave target
slave: $(OBJECTS_SLAVE)
$(CC) $(CC_FLAGS) $(OBJECTS_SLAVE) -o $(EXEC_PATH)$(EXEC_NAME_SLAVE)
all: master slave
%.o: %.cpp
@$(CC) -c $(CC_FLAGS) $< -o $@
clean:
rm -f $(EXEC_NAME) $(OBJECTS) $(EXEC_NAME_SLAVE) $(OBJECTS_SLAVE)
# Targets for Executing code on a cluster
# Assumes that a hostlist32 file is available in the home directory with node names of all machines in the cluster
mpircluster:
$(CC_PATH)mpirun -np 1 -host $(host) $(EXEC_PATH)$(EXEC_NAME) $(f) $(K) $(m) $(out) $(timefile) : -np $(p) --map-by node -hostfile ~/hostlist32 $(EXEC_PATH)$(EXEC_NAME_SLAVE)
serial:
$(CC_PATH)mpirun -np 1 -host $(host) $(EXEC_PATH)$(EXEC_NAME) $(f) $(K) $(m) $(out) $(timefile)
hybridrcluster:
$(CC_PATH)mpirun -np 1 --pernode -host $(host) $(EXEC_PATH)$(EXEC_NAME) $(f) $(K) $(m) $(out) $(timefile) : -np $(p) -x OMP_NUM_THREADS=$(t) -x GOMP_CPU_AFFINITY=0-7 -hostfile ~/hostlist32 $(EXEC_PATH)$(EXEC_NAME_SLAVE)
# Targets for local testing
localpar:
$(CC_PATH)mpirun -oversubscribe -np 1 $(EXEC_PATH)$(EXEC_NAME) $(K) : -np $(p) $(EXEC_PATH)$(EXEC_NAME_SLAVE)
localserial:
$(CC_PATH)mpirun -np 1 -host localhost $(EXEC_PATH)$(EXEC_NAME) $(K) $(m) $(out) $(timefile)
localhybrid:
$(CC_PATH)mpirun -oversubscribe -np 1 $(EXEC_PATH)$(EXEC_NAME) $(K) : -np $(p) -x OMP_NUM_THREADS=$(t) -x GOMP_CPU_AFFINITY=0-7 $(EXEC_PATH)$(EXEC_NAME_SLAVE)
# targets to debug using xterm in parallel
debug:
mpirun -np 1 xterm -e gdb $(EXEC_PATH)$(EXEC_NAME)
# To debug using xterm in parallel
debugparallel:
mpirun -np 1 xterm -e gdb $(EXEC_PATH)$(EXEC_NAME) : -np 2 xterm -e gdb $(EXEC_PATH)$(EXEC_NAME_SLAVE)
#for memory leak detection
memcheck:
mpirun -np 1 $(EXEC_PATH)$(EXEC_NAME) : -np 4 valgrind --leak-check=full --log-file=MemoryProf $(EXEC_PATH)$(EXEC_NAME_SLAVE)
massif:
mpirun -np 1 valgrind --tool=massif --stacks=yes $(EXEC_PATH)$(EXEC_NAME) : -np 4 valgrind --tool=massif --stacks=yes $(EXEC_PATH)$(EXEC_NAME_SLAVE)
callgrind:
mpirun -np 1 valgrind --tool=callgrind $(EXEC_PATH)$(EXEC_NAME) : -np 4 valgrind --tool=callgrind $(EXEC_PATH)$(EXEC_NAME_SLAVE)
memcheckser:
mpirun -np 1 valgrind --leak-check=full --log-file=mem_log.txt $(EXEC_PATH)$(EXEC_NAME)
callgrindserial:
$(CC_PATH)mpirun -np 1 valgrind --tool=callgrind $(EXEC_PATH)$(EXEC_NAME) $(f) $(K) $(m) $(out) $(timefile)