-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
27 lines (22 loc) · 984 Bytes
/
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
# compile flags
CPPFLAGS=-Wno-macro-redefined
CFLAGS=-Isrc -I/usr/local/cuda/include -O3 -g
NVCCFLAGS=-Isrc -I/usr/local/cuda/include -O3 -g -allow-unsupported-compiler -Xcompiler=-Wall -Xcompiler=-Wno-macro-redefined
# link flags
LDFLAGS=-L/usr/local/cuda/lib64
# build the main program
main: src/main.o src/model.o src/data.o src/optimizer.o src/init.o src/function.o
nvcc $(NVCCFLAGS) $(LDFLAGS) -o $@ $^ -lcublas
# remove all build artifacts
clean:
rm -f src/*.o main
# compile each source file, with dependencies
src/main.o: src/main.c src/config.h src/init.h src/data.h src/model.h src/optimizer.h
src/model.o: src/model.c src/config.h src/model.h
src/data.o: src/data.c src/config.h src/data.h
src/optimizer.o: src/optimizer.c src/config.h src/optimizer.h
src/init.o: src/init.c src/config.h src/init.h
src/function.o: src/function.cu src/config.h src/function.h
# pattern rule to compile an object file from a CUDA source file
%.o : %.cu
nvcc $(NVCCFLAGS) -c -o $@ $<