Error when compiling custom ops(CPU or GPU)
xtXu opened this issue · 3 comments
xtXu commented
Hello,
When compiling the custom ops CPU as below:
g++ -std=c++14 -shared -o ${OP_NAME}.so ${OP_NAME}.cc ${OP_NAME}_kernel.cc \
${OP_NAME}_kernel.cu.o ${TF_CFLAGS[@]} -fPIC -lcudart ${TF_LFLAGS[@]}
I got the error with tensorflow::OkStatus()
:
deeplab2/tensorflow_ops/kernels/merge_semantic_and_instance_maps_op.cc:45:26: error: ‘OkStatus’ is not a member of ‘tensorflow’
return tensorflow::OkStatus();
^~~~~~~~
deeplab2/tensorflow_ops/kernels/merge_semantic_and_instance_maps_op.cc:45:26: note: suggested alternative: ‘Status’
return tensorflow::OkStatus();
^~~~~~~~
Status
And the ops GPU seems ok with just warnings.
My environment:
python3.7
tensorflow2.6.0
Then I found that tensorflow2.10.0 has the function tensorflow::OkStatus(), so I tried it on tensorflow2.10.0. The compiling for CPU seems ok, but compiling for GPU got lots of errors.
Btw, I install the tensorflow in a conda env.
Do you have any good suggestions?
Neil-Chou commented
I change it based on the hint
return tensorflow::Status();
And everything works.
xtXu commented
I change it based on the hint
return tensorflow::Status();
And everything works.
Thanks for answering!
I have tried this. The compiling problem is solved, but the test demo fails. Maybe there is sth else wrong with me.
Thanks again.