google-research / deeplab2

DeepLab2 is a TensorFlow library for deep labeling, aiming to provide a unified and state-of-the-art TensorFlow codebase for dense pixel labeling tasks.
Apache License 2.0
1.01k stars 159 forks source link

Error when compiling custom ops(CPU or GPU) #149

Open xtXu opened 2 years ago

xtXu commented 2 years ago

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 2 years ago

Hi @xtXu I also encounter this issue, do you have any solution ?

Neil-Chou commented 2 years ago

I change it based on the hint

return tensorflow::Status();

And everything works.

xtXu commented 2 years ago

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.