BIGKnight / deformable_conv2d_v2_tensorflow

deformablt_conv2d layer implemented in tensorflow

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error while compiling

anshkumar opened this issue · comments

Hi, BIGKnight
I'm getting following error while compiling dcn.

deformable_conv2d.cu.cc:6:10: fatal error: tensorflow/core/util/cuda_kernel_helper.h: No such file or directory
    6 | #include "tensorflow/core/util/cuda_kernel_helper.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from deformable_conv2d.cc:8:
deformable_conv2d_utils.h:189:66: warning: character constant too long for its type
  189 |                   in_depth, " vs ", patch_depth, ' flag: ', flag));
      |                                                                  ^
In file included from /home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/core/framework/resource_base.h:21,
                 from /home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/core/framework/resource_handle.h:21,
                 from /home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/core/framework/register_types.h:21,
                 from deformable_conv2d.h:4,
                 from deformable_conv2d.cc:2:
deformable_conv2d_utils.h: In function ‘tensorflow::Status tensorflow::ComputeDeformableConv2DDimension(const tensorflow::DeformableConv2DParameters&, const tensorflow::Tensor&, const tensorflow::Tensor&, tensorflow::DeformableConv2DDimensions*, int)’:
deformable_conv2d_utils.h:227:22: error: ‘GetWindowedOutputSizeV2’ was not declared in this scope
  227 |   TF_RETURN_IF_ERROR(GetWindowedOutputSizeV2(
      |                      ^~~~~~~~~~~~~~~~~~~~~~~
/home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/core/platform/errors.h:128:37: note: in definition of macro ‘TF_RETURN_IF_ERROR’
  128 |     ::tensorflow::Status _status = (__VA_ARGS__);        \
      |                                     ^~~~~~~~~~~
deformable_conv2d_utils.h:230:22: error: ‘GetWindowedOutputSizeV2’ was not declared in this scope
  230 |   TF_RETURN_IF_ERROR(GetWindowedOutputSizeV2(
      |                      ^~~~~~~~~~~~~~~~~~~~~~~
/home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/core/platform/errors.h:128:37: note: in definition of macro ‘TF_RETURN_IF_ERROR’
  128 |     ::tensorflow::Status _status = (__VA_ARGS__);        \
      |                                     ^~~~~~~~~~~
In file included from deformable_conv2d.cc:8:
deformable_conv2d_utils.h: At global scope:
deformable_conv2d_utils.h:269:9: error: ‘tensorflow::int64 tensorflow::{anonymous}::CublasScratchAllocator::GetMemoryLimitInBytes(tensorflow::{anonymous}::CublasScratchAllocator::Stream*)’ marked ‘override’, but does not override
  269 |   int64 GetMemoryLimitInBytes(Stream* stream) override { return -1; }
      |         ^~~~~~~~~~~~~~~~~~~~~
deformable_conv2d_utils.h:271:41: error: ‘tensorflow::StatusOr<stream_executor::DeviceMemory<unsigned char> > tensorflow::{anonymous}::CublasScratchAllocator::AllocateBytes(tensorflow::{anonymous}::CublasScratchAllocator::Stream*, tensorflow::int64)’ marked ‘override’, but does not override
  271 |   se::port::StatusOr<DeviceMemoryBytes> AllocateBytes(
      |                                         ^~~~~~~~~~~~~
In file included from /home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/core/framework/resource_base.h:21,
                 from /home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/core/framework/resource_handle.h:21,
                 from /home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/core/framework/register_types.h:21,
                 from deformable_conv2d.h:4,
                 from deformable_conv2d.cc:2:
deformable_conv2d.cc: In lambda function:
deformable_conv2d.cc:139:32: error: ‘GetWindowedOutputSizeVerbose’ was not declared in this scope
  139 |             TF_RETURN_IF_ERROR(GetWindowedOutputSizeVerbose(
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/core/platform/errors.h:128:37: note: in definition of macro ‘TF_RETURN_IF_ERROR’
  128 |     ::tensorflow::Status _status = (__VA_ARGS__);        \
      |                                     ^~~~~~~~~~~
deformable_conv2d.cc:142:32: error: ‘GetWindowedOutputSizeVerbose’ was not declared in this scope
  142 |             TF_RETURN_IF_ERROR(GetWindowedOutputSizeVerbose(
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/core/platform/errors.h:128:37: note: in definition of macro ‘TF_RETURN_IF_ERROR’
  128 |     ::tensorflow::Status _status = (__VA_ARGS__);        \
      |                                     ^~~~~~~~~~~
In file included from deformable_conv2d.cc:8:
deformable_conv2d_utils.h: In instantiation of ‘static void tensorflow::LaunchBatchMatMul<Eigen::GpuDevice, Scalar>::launch(tensorflow::OpKernelContext*, const tensorflow::TensorShape&, const tensorflow::TensorShape&, const Scalar*, const Scalar*, bool, bool, Scalar*) [with Scalar = double]’:
deformable_conv2d.cc:511:49:   required from ‘void tensorflow::DeformableConv2DBackPropOp<Device, T>::Compute(tensorflow::OpKernelContext*) [with Device = Eigen::GpuDevice; T = double]’
deformable_conv2d.cc:413:10:   required from here
deformable_conv2d_utils.h:393:30: error: cannot declare variable ‘scratch_allocator’ to be of abstract type ‘tensorflow::{anonymous}::CublasScratchAllocator’
  393 |       CublasScratchAllocator scratch_allocator(context);
      |                              ^~~~~~~~~~~~~~~~~
deformable_conv2d_utils.h:262:7: note:   because the following virtual functions are pure within ‘tensorflow::{anonymous}::CublasScratchAllocator’:
  262 | class CublasScratchAllocator : public se::ScratchAllocator {
      |       ^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/core/platform/stream_executor.h:31,
                 from deformable_conv2d_utils.h:7,
                 from deformable_conv2d.cc:8:
/home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/stream_executor/scratch_allocator.h:44:19: note:       ‘virtual int64_t stream_executor::ScratchAllocator::GetMemoryLimitInBytes()’
   44 |   virtual int64_t GetMemoryLimitInBytes() = 0;
      |                   ^~~~~~~~~~~~~~~~~~~~~
/home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include/tensorflow/stream_executor/scratch_allocator.h:50:47: note:       ‘virtual tensorflow::StatusOr<stream_executor::DeviceMemory<unsigned char> > stream_executor::ScratchAllocator::AllocateBytes(int64_t)’
   50 |   virtual port::StatusOr<DeviceMemory<uint8>> AllocateBytes(
      |                                               ^~~~~~~~~~~~~
In file included from deformable_conv2d.cc:8:
deformable_conv2d_utils.h: In instantiation of ‘static void tensorflow::LaunchBatchMatMul<Eigen::GpuDevice, Scalar>::launch(tensorflow::OpKernelContext*, const tensorflow::TensorShape&, const tensorflow::TensorShape&, const Scalar*, const Scalar*, bool, bool, Scalar*) [with Scalar = float]’:
deformable_conv2d.cc:511:49:   required from ‘void tensorflow::DeformableConv2DBackPropOp<Device, T>::Compute(tensorflow::OpKernelContext*) [with Device = Eigen::GpuDevice; T = float]’
deformable_conv2d.cc:413:10:   required from here
deformable_conv2d_utils.h:393:30: error: cannot declare variable ‘scratch_allocator’ to be of abstract type ‘tensorflow::{anonymous}::CublasScratchAllocator’
  393 |       CublasScratchAllocator scratch_allocator(context);
      |                              ^~~~~~~~~~~~~~~~~

Any idea why ?
I'm using g++ 9.4.0 and here is my make.sh

#!/usr/bin/env bash
TF_CFLAGS=(-I/home/vedanshu/.local/lib/python3.10/site-packages/tensorflow/include -D_GLIBCXX_USE_CXX11_ABI=0)
TF_LFLAGS=(-L/home/vedanshu/.local/lib/python3.10/site-packages/tensorflow -llibtensorflow_framework)
CUDA_HOME=/usr/local/cuda
nvcc -std=c++14 -c -o deformable_conv2d.cu.o deformable_conv2d.cu.cc -I $CUDA_HOME -I /usr/local ${TF_CFLAGS[@]} -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC -L $CUDA_HOME/lib64 --expt-relaxed-constexpr
g++ -std=c++14 -shared -o deformable_conv2d.so deformable_conv2d.cc deformable_conv2d.cu.o -L $CUDA_HOME/lib64 -I $CUDA_HOME/include -D GOOGLE_CUDA=1  ${TF_CFLAGS[@]} -fPIC -lcudart ${TF_LFLAGS[@]}