I'm trying to compile custom ops for Tensorflow, the shell script and implementation comes from a Git repository. I'm running it in a docker container. I get strange errors, e.g. for option -02, it returns "argument to ‘-O’ should be a non-negative integer, ‘g’, ‘s’ or ‘fast’". So I think, the script may be read in faulty? How can I overcome this problem?
This is the .sh file:
#/bin/bash
TF_CFLAGS=$(python -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_compile_flags()))')
TF_LFLAGS=$(python -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_link_flags()))')
CUDA_ROOT=/usr/local/cuda-10.1
g++ -std=c++11 -shared ./interpolation/tf_interpolate.cpp -o ./interpolation/tf_interpolate_so.so -I $CUDA_ROOT/include -lcudart -L $CUDA_ROOT/lib64/ -fPIC ${TF_CFLAGS} ${TF_LFLAGS} -O2
$CUDA_ROOT/bin/nvcc ./grouping/tf_grouping_g.cu -o ./grouping/tf_grouping_g.cu.o -c -O2 -DGOOGLE_CUDA=1 -x cu -Xcompiler -fPIC
g++ -std=c++11 -shared ./grouping/tf_grouping.cpp ./grouping/tf_grouping_g.cu.o -o ./grouping/tf_grouping_so.so -I $CUDA_ROOT/include -L $CUDA_ROOT/lib64/ -fPIC ${TF_CFLAGS} ${TF_LFLAGS} -O2
$CUDA_ROOT/bin/nvcc ./sampling/tf_sampling_g.cu -o ./sampling/tf_sampling_g.cu.o -c -O2 -DGOOGLE_CUDA=1 -x cu -Xcompiler -fPIC
g++ -std=c++11 -shared ./sampling/tf_sampling.cpp ./sampling/tf_sampling_g.cu.o -o ./sampling/tf_sampling_so.so -I $CUDA_ROOT/include -L $CUDA_ROOT/lib64/ -fPIC ${TF_CFLAGS} ${TF_LFLAGS} -O2
And here the terminal output:
root@11840eb27d51:/radarseg/radarseg/model/tf_ops# bash compile_ops.sh
compile_ops.sh: line 2: $'\r': command not found
compile_ops.sh: line 6: $'\r': command not found
cc1plus: error: argument to ‘-O’ should be a non-negative integer, ‘g’, ‘s’ or ‘fast’
compile_ops.sh: line 8: $'\r': command not found
/bin/nvcc: No such file or directoryuda-10.1
cc1plus: error: argument to ‘-O’ should be a non-negative integer, ‘g’, ‘s’ or ‘fast’
compile_ops.sh: line 11: $'\r': command not found
/bin/nvcc: No such file or directorycuda-10.1
cc1plus: error: argument to ‘-O’ should be a non-negative integer, ‘g’, ‘s’ or ‘fast’