-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
30 lines (23 loc) · 717 Bytes
/
Makefile
File metadata and controls
30 lines (23 loc) · 717 Bytes
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
# Makefile
TF_INC = `python -c "import tensorflow; print(tensorflow.sysconfig.get_include())"`
CC = gcc -O2 -pthread
CXX = g++
GPUCC = nvcc
CFLAGS = -std=c++11 -I$(TF_INC)
GPUCFLAGS = -c
LFLAGS = -pthread -shared -fPIC
GPULFLAGS = -x cu -Xcompiler -fPIC
GPUDEF = -DGOOGLE_CUDA=1
CGPUFLAGS = -lcuda # shouldn't it be -lcudart ?? (not found)
SRC = zero_out.cc
GPUSRC = zero_out.cu.cc
PROD = zero_out.so
GPUPROD = zero_out_cu.o
default: gpu
cpu:
$(CXX) $(CFLAGS) $(SRC) $(LFLAGS) -o $(PROD)
gpu:
$(GPUCC) $(CFLAGS) $(GPUCFLAGS) $(GPUSRC) $(GPULFLAGS) -o $(GPUPROD)
$(CXX) $(CFLAGS) $(SRC) $(GPUPROD) $(LFLAGS) $(CGPUFLAGS) -o $(PROD)
clean:
rm -f $(PROD) $(GPUPROD)