Skip to content

Commit

Permalink
get the op building on CHAI servers
Browse files Browse the repository at this point in the history
flags for building ops changed in october 2017: tensorflow/tensorflow#13607

i got the new flags from https://www.tensorflow.org/guide/extend/op#compile_the_op_using_your_system_compiler_tensorflow_binary_installation

compiling gives lots of warnings about alignments being off, but all tests pass
  • Loading branch information
longouyang authored Nov 9, 2018
1 parent 3521bc4 commit d680b6e
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
TF_INC :=$(shell python -c 'import tensorflow as tf; print(tf.sysconfig.get_include())')
TF_CFLAGS := $(shell python -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_compile_flags()))')
TF_LFLAGS := $(shell python -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_link_flags()))')
INC=-I${TF_INC}
layer_norm_fused_op: register_ops.cc layer_norm_fused_op.h layer_norm_fused_op.cc layer_norm_fused_grad_op.cc layer_norm_fused_op_gpu.cu.cc
nvcc -std=c++11 -c -o layer_norm_fused_op_gpu.cu.o layer_norm_fused_op_gpu.cu.cc \
$(INC) -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC --expt-relaxed-constexpr -gencode=arch=compute_35,code=sm_35 \
-gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_52,code=sm_52 \
-gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_61,code=compute_61
g++ -std=c++11 -shared -o layer_norm_fused_op.so register_ops.cc layer_norm_fused_op.h \
layer_norm_fused_grad_op.cc layer_norm_fused_op.cc layer_norm_fused_op_gpu.cu.o \
$(INC) -L /usr/local/cuda/lib64/ -fPIC -lcudart -O2 -DNDEBUG
nvcc -ccbin gcc-6 -std=c++11 -c -o layer_norm_fused_op_gpu.cu.o layer_norm_fused_op_gpu.cu.cc \
$(TF_CFLAGS) $(TF_LFLAGS) -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC --expt-relaxed-constexpr -gencode=arch=compute_35,code=sm_35 \
-gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_52,code=sm_52 \
-gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_61,code=compute_61
g++-6 -std=c++11 -shared -D_GLIBCXX_USE_CXX11_ABI=0 -o layer_norm_fused_op.so register_ops.cc layer_norm_fused_op.h \
layer_norm_fused_grad_op.cc layer_norm_fused_op.cc layer_norm_fused_op_gpu.cu.o \
$(TF_CFLAGS) $(TF_LFLAGS) -L /usr/local/cuda/lib64/ -fPIC -lcudart -O2 -DNDEBUG

0 comments on commit d680b6e

Please sign in to comment.