-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (45 loc) · 2.04 KB
/
Makefile
File metadata and controls
65 lines (45 loc) · 2.04 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
CC = gcc
CFLAGS = -Iinclude -O3 -std=gnu99 -lm -g
NVCC = nvcc
NVCCFLAGS = -Iinclude -O3 -lm
GENCODE = -gencode=arch=compute_37,code=\"sm_37,compute_37\"
BASE_SRCS := src/test/timing.c
TEST_SIMPLE_SRCS := $(BASE_SRCS) src/test/test-simple.c
TEST_RANDOM_SRCS := $(BASE_SRCS) src/test/test-random.c
TEST_CELESTIAL_SRCS := $(BASE_SRCS) src/test/test-celestial.c src/simulator/solarsystemdata.c
TEST_GALAXY_SRCS := $(BASE_SRCS) src/test/test-galaxy.c
TEST_TSNE_SRCS := $(BASE_SRCS) src/test/test-sne.c src/test/mnist.c
CPU_EXECUTABLES := test-simple-cpu test-random-cpu test-celestial-cpu test-galaxy-cpu test-tsne-cpu
GPU_EXECUTABLES := test-simple-gpu test-random-gpu test-celestial-gpu test-galaxy-gpu test-tsne-gpu
CPU_SRCS := src/simulator/cpu/nbodysim.c
GPU_SRCS := src/simulator/gpu/nbodysim.o
all: $(CPU_EXECUTABLES) $(GPU_EXECUTABLES)
cpu: $(CPU_EXECUTABLES)
gpu: $(GPU_EXECUTABLES)
test-simple-cpu: $(TEST_SIMPLE_SRCS) $(CPU_SRCS)
$(CC) -o bin/$@ $(CFLAGS) $^
test-random-cpu: $(TEST_RANDOM_SRCS) $(CPU_SRCS)
$(CC) -o bin/$@ $(CFLAGS) $^
test-celestial-cpu: $(TEST_CELESTIAL_SRCS) $(CPU_SRCS)
$(CC) -o bin/$@ $(CFLAGS) $^
test-galaxy-cpu: $(TEST_GALAXY_SRCS) $(CPU_SRCS)
$(CC) -o bin/$@ $(CFLAGS) $^
test-tsne-cpu: $(TEST_TSNE_SRCS) $(CPU_SRCS)
$(CC) -o bin/$@ $(CFLAGS) $^
test-simple-gpu: $(patsubst %.c,%.o,$(TEST_SIMPLE_SRCS)) $(GPU_SRCS)
$(NVCC) $(GENCODE) -o bin/$@ $(NVCCFLAGS) $^
test-random-gpu: $(patsubst %.c,%.o,$(TEST_RANDOM_SRCS)) $(GPU_SRCS)
$(NVCC) $(GENCODE) -o bin/$@ $(NVCCFLAGS) $^
test-celestial-gpu: $(patsubst %.c,%.o,$(TEST_CELESTIAL_SRCS)) $(GPU_SRCS)
$(NVCC) $(GENCODE) -o bin/$@ $(NVCCFLAGS) $^
test-galaxy-gpu: $(patsubst %.c,%.o,$(TEST_GALAXY_SRCS)) $(GPU_SRCS)
$(NVCC) $(GENCODE) -o bin/$@ $(NVCCFLAGS) $^
test-tsne-gpu: $(patsubst %.c,%.o,$(TEST_TSNE_SRCS)) $(GPU_SRCS)
$(NVCC) $(GENCODE) -o bin/$@ $(NVCCFLAGS) $^
%.o: %.c
$(NVCC) $(GENCODE) -x cu $(NVCCFLAGS) -dc $< -o $@
%.o: %.cu
$(NVCC) $(GENCODE) -x cu $(NVCCFLAGS) -dc $< -o $@
clean:
find . -name "*.o" -type f -delete
find bin/ -not -name '\.*' -type f -delete