-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
82 lines (67 loc) · 2.12 KB
/
makefile
File metadata and controls
82 lines (67 loc) · 2.12 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
79
80
81
82
# DIRECTORY
OUTPUT_FOLDER = bin
TEST_FOLDER = result
# JOIN
# Run all
all-local: cuda openmp mpi-local serial
all-compile: compile-cuda compile-openmp compile-mpi compile-serial
all: cuda openmp mpi serial
# COMPARE
compare:
@diff -s ${TEST_FOLDER}/cuda.txt ${TEST_FOLDER}/open-mp.txt
# TEST CASE
# Make test case
tc:
@./test_cases/generator
# SERVER
# Copy to server
copy-server:
@eval $$(ssh-agent) && \
ssh-add ~/.ssh/k02-05 && \
echo "Inserting executables to server..." && \
scp -r bin hostname makefile k02-05@4.145.183.206:/home/k02-05 && \
ssh k02-05@4.145.183.206
# Copy to branch server
copy-branch-server:
@scp -r bin hostname makefile k02-05@10.0.1.7:/home/k02-05
@scp -r bin hostname makefile k02-05@10.0.1.4:/home/k02-05
# SERIAL
# Compile the serial
compile-serial:
@g++ src/serial/serial.cpp -o $(OUTPUT_FOLDER)/serial -lm
# Run the serial in server
serial:
@time ./${OUTPUT_FOLDER}/serial < ./test_cases/2048.txt > ${TEST_FOLDER}/serial.txt
# OPEN MPI
# Compile the MPI
compile-mpi:
@mpicc src/open-mpi/open-mpi.cpp -g -o $(OUTPUT_FOLDER)/open-mpi -lm -lstdc++ -lmpi_cxx -lmpi
# Run the MPI in server
mpi:
@chmod +x ${OUTPUT_FOLDER}/open-mpi
@time mpirun --hostfile hostname ./${OUTPUT_FOLDER}/open-mpi < ./test_cases/2048.txt > ${TEST_FOLDER}/open-mpi.txt
# Run the MPI in local
mpi-local:
@chmod +x ${OUTPUT_FOLDER}/open-mpi
@time mpirun -n 4 ${OUTPUT_FOLDER}/open-mpi < test_cases/2048.txt > ${TEST_FOLDER}/open-mpi.txt
# Run the MPI debug in local
mpi-debug:
@echo Doing chmod
@chmod +x ${OUTPUT_FOLDER}/open-mpi
@echo Running
@mpirun -n 4 valgrind --track-origins=yes ${OUTPUT_FOLDER}/open-mpi < test_cases/2048.txt > ${TEST_FOLDER}/open-mpi.txt
# OPEN MP
# Compile the OPEN MP
compile-openmp:
@g++ src/open-mp/open-mp.cpp --openmp -o $(OUTPUT_FOLDER)/open-mp -lm
# Run the OPEN MP
openmp:
@chmod +x ${OUTPUT_FOLDER}/open-mp
@time ${OUTPUT_FOLDER}/open-mp < test_cases/2048.txt > ${TEST_FOLDER}/open-mp.txt
# CUDA
# Compile the CUDA
compile-cuda:
@nvcc src/cuda/cuda.cu -o $(OUTPUT_FOLDER)/cuda -lm
# Run the CUDA
cuda:
@time ${OUTPUT_FOLDER}/cuda < test_cases/2048.txt > ${TEST_FOLDER}/cuda.txt