Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue building MMDeploy with latest ppl.cv master #39

Closed
tehkillerbee opened this issue Jan 3, 2022 · 2 comments
Closed

Issue building MMDeploy with latest ppl.cv master #39

tehkillerbee opened this issue Jan 3, 2022 · 2 comments
Assignees

Comments

@tehkillerbee
Copy link
Contributor

tehkillerbee commented Jan 3, 2022

Hello
Thank you for this project. I have been attempting to build MMDeploy according to the documentation.

Specifically, I am trying to build the SDK with TensorRT support, according to the documentation listed here:
https://mmdeploy.readthedocs.io/en/latest/build.html

I have built ppl.cv using ./build.sh cuda, as instructed (latest version from master). All required dependencies are also installed.

I run the build as outlined here (adapted from the documentation). I rely on cmake to detect Tensorrt and this is working correctly.

cd MMDeploy
mkdir build && cd build
cmake .. \
  -DMMDEPLOY_BUILD_SDK=ON \
  -Dpplcv_DIR=/home/user/project/ppl.cv/cuda-build/install/lib/cmake/ppl \
  -DMMDEPLOY_TARGET_DEVICES="cuda;cpu" \
  -DMMDEPLOY_TARGET_BACKENDS=trt \
  -DMMDEPLOY_CODEBASES=all
cmake --build . -- -j$(nproc) && cmake --install .

When building MMDeploy, however, I get the following error:

[ 62%] Building CUDA object csrc/preprocess/cuda/CMakeFiles/mmdeploy_cuda_transform_impl.dir/crop.cu.o
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp: In member function ‘mmdeploy::Result<void> mmdeploy::cuda::ResizeImpl::ResizeLinear(const mmdeploy::Tensor&, mmdeploy::Tensor&, cudaStream_t)’:
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:51:30: error: ‘ResizeLinear’ is not a member of ‘ppl::cv::cuda’
   51 |         ret = ppl::cv::cuda::ResizeLinear<uint8_t, 1>(stream, h, w, w * c, input, dst_h, dst_w,
      |                              ^~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:51:50: error: expected primary-expression before ‘,’ token
   51 |         ret = ppl::cv::cuda::ResizeLinear<uint8_t, 1>(stream, h, w, w * c, input, dst_h, dst_w,
      |                                                  ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:52:72: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   52 |                                                       dst_w * c, output);
      |                                                                        ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:54:30: error: ‘ResizeLinear’ is not a member of ‘ppl::cv::cuda’
   54 |         ret = ppl::cv::cuda::ResizeLinear<uint8_t, 3>(stream, h, w, w * c, input, dst_h, dst_w,
      |                              ^~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:54:50: error: expected primary-expression before ‘,’ token
   54 |         ret = ppl::cv::cuda::ResizeLinear<uint8_t, 3>(stream, h, w, w * c, input, dst_h, dst_w,
      |                                                  ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:55:72: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   55 |                                                       dst_w * c, output);
      |                                                                        ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:57:30: error: ‘ResizeLinear’ is not a member of ‘ppl::cv::cuda’
   57 |         ret = ppl::cv::cuda::ResizeLinear<uint8_t, 4>(stream, h, w, w * c, input, dst_h, dst_w,
      |                              ^~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:57:50: error: expected primary-expression before ‘,’ token
   57 |         ret = ppl::cv::cuda::ResizeLinear<uint8_t, 4>(stream, h, w, w * c, input, dst_h, dst_w,
      |                                                  ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:58:72: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   58 |                                                       dst_w * c, output);
      |                                                                        ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:67:30: error: ‘ResizeLinear’ is not a member of ‘ppl::cv::cuda’
   67 |         ret = ppl::cv::cuda::ResizeLinear<float, 1>(stream, h, w, w * c, input, dst_h, dst_w,
      |                              ^~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:67:43: error: expected primary-expression before ‘float’
   67 |         ret = ppl::cv::cuda::ResizeLinear<float, 1>(stream, h, w, w * c, input, dst_h, dst_w,
      |                                           ^~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:70:30: error: ‘ResizeLinear’ is not a member of ‘ppl::cv::cuda’
   70 |         ret = ppl::cv::cuda::ResizeLinear<float, 3>(stream, h, w, w * c, input, dst_h, dst_w,
      |                              ^~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:70:43: error: expected primary-expression before ‘float’
   70 |         ret = ppl::cv::cuda::ResizeLinear<float, 3>(stream, h, w, w * c, input, dst_h, dst_w,
      |                                           ^~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:73:30: error: ‘ResizeLinear’ is not a member of ‘ppl::cv::cuda’
   73 |         ret = ppl::cv::cuda::ResizeLinear<float, 4>(stream, h, w, w * c, input, dst_h, dst_w,
      |                              ^~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:73:43: error: expected primary-expression before ‘float’
   73 |         ret = ppl::cv::cuda::ResizeLinear<float, 4>(stream, h, w, w * c, input, dst_h, dst_w,
      |                                           ^~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp: In member function ‘mmdeploy::Result<void> mmdeploy::cuda::ResizeImpl::ResizeNearest(const mmdeploy::Tensor&, mmdeploy::Tensor&, cudaStream_t)’:
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:99:30: error: ‘ResizeNearestPoint’ is not a member of ‘ppl::cv::cuda’
   99 |         ret = ppl::cv::cuda::ResizeNearestPoint<uint8_t, 1>(stream, h, w, w * c, input, dst_h,
      |                              ^~~~~~~~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:99:56: error: expected primary-expression before ‘,’ token
   99 |         ret = ppl::cv::cuda::ResizeNearestPoint<uint8_t, 1>(stream, h, w, w * c, input, dst_h,
      |                                                        ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:100:85: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  100 |                                                             dst_w, dst_w * c, output);
      |                                                                                     ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:102:30: error: ‘ResizeNearestPoint’ is not a member of ‘ppl::cv::cuda’
  102 |         ret = ppl::cv::cuda::ResizeNearestPoint<uint8_t, 3>(stream, h, w, w * c, input, dst_h,
      |                              ^~~~~~~~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:102:56: error: expected primary-expression before ‘,’ token
  102 |         ret = ppl::cv::cuda::ResizeNearestPoint<uint8_t, 3>(stream, h, w, w * c, input, dst_h,
      |                                                        ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:103:85: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  103 |                                                             dst_w, dst_w * c, output);
      |                                                                                     ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:105:30: error: ‘ResizeNearestPoint’ is not a member of ‘ppl::cv::cuda’
  105 |         ret = ppl::cv::cuda::ResizeNearestPoint<uint8_t, 4>(stream, h, w, w * c, input, dst_h,
      |                              ^~~~~~~~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:105:56: error: expected primary-expression before ‘,’ token
  105 |         ret = ppl::cv::cuda::ResizeNearestPoint<uint8_t, 4>(stream, h, w, w * c, input, dst_h,
      |                                                        ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:106:85: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  106 |                                                             dst_w, dst_w * c, output);
      |                                                                                     ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:115:30: error: ‘ResizeNearestPoint’ is not a member of ‘ppl::cv::cuda’
  115 |         ret = ppl::cv::cuda::ResizeNearestPoint<float, 1>(stream, h, w, w * c, input, dst_h, dst_w,
      |                              ^~~~~~~~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:115:49: error: expected primary-expression before ‘float’
  115 |         ret = ppl::cv::cuda::ResizeNearestPoint<float, 1>(stream, h, w, w * c, input, dst_h, dst_w,
      |                                                 ^~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:118:30: error: ‘ResizeNearestPoint’ is not a member of ‘ppl::cv::cuda’
  118 |         ret = ppl::cv::cuda::ResizeNearestPoint<float, 3>(stream, h, w, w * c, input, dst_h, dst_w,
      |                              ^~~~~~~~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:118:49: error: expected primary-expression before ‘float’
  118 |         ret = ppl::cv::cuda::ResizeNearestPoint<float, 3>(stream, h, w, w * c, input, dst_h, dst_w,
      |                                                 ^~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:121:30: error: ‘ResizeNearestPoint’ is not a member of ‘ppl::cv::cuda’
  121 |         ret = ppl::cv::cuda::ResizeNearestPoint<float, 4>(stream, h, w, w * c, input, dst_h, dst_w,
      |                              ^~~~~~~~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:121:49: error: expected primary-expression before ‘float’
  121 |         ret = ppl::cv::cuda::ResizeNearestPoint<float, 4>(stream, h, w, w * c, input, dst_h, dst_w,
      |                                                 ^~~~~

It looks like ResizeLinear() and ResizeNearestPoint() has been replaced with Resize(.., ppl::cv::INTERPOLATION_TYPE_xx) where an optional input argument has been added.

The solution should be to replace the above functions with Resize(..) with the last argument set according to the resize type.
I will try to make a PR, if the above solution works as expected.

@najingligong1111
Copy link

najingligong1111 commented Jan 4, 2022

Hello Thank you for this project. I have been attempting to build MMDeploy according to the documentation.

Specifically, I am trying to build the SDK with TensorRT support, according to the documentation listed here: https://mmdeploy.readthedocs.io/en/latest/build.html

I have built ppl.cv using ./build.sh cuda, as instructed (latest version from master). All required dependencies are also installed.

I run the build as outlined here (adapted from the documentation). I rely on cmake to detect Tensorrt and this is working correctly.

cd MMDeploy
mkdir build && cd build
cmake .. \
  -DMMDEPLOY_BUILD_SDK=ON \
  -Dpplcv_DIR=/home/user/project/ppl.cv/cuda-build/install/lib/cmake/ppl \
  -DMMDEPLOY_TARGET_DEVICES="cuda;cpu" \
  -DMMDEPLOY_TARGET_BACKENDS=trt \
  -DMMDEPLOY_CODEBASES=all
cmake --build . -- -j$(nproc) && cmake --install .

When building MMDeploy, however, I get the following error:

[ 62%] Building CUDA object csrc/preprocess/cuda/CMakeFiles/mmdeploy_cuda_transform_impl.dir/crop.cu.o
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp: In member function ‘mmdeploy::Result<void> mmdeploy::cuda::ResizeImpl::ResizeLinear(const mmdeploy::Tensor&, mmdeploy::Tensor&, cudaStream_t)’:
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:51:30: error: ‘ResizeLinear’ is not a member of ‘ppl::cv::cuda’
   51 |         ret = ppl::cv::cuda::ResizeLinear<uint8_t, 1>(stream, h, w, w * c, input, dst_h, dst_w,
      |                              ^~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:51:50: error: expected primary-expression before ‘,’ token
   51 |         ret = ppl::cv::cuda::ResizeLinear<uint8_t, 1>(stream, h, w, w * c, input, dst_h, dst_w,
      |                                                  ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:52:72: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   52 |                                                       dst_w * c, output);
      |                                                                        ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:54:30: error: ‘ResizeLinear’ is not a member of ‘ppl::cv::cuda’
   54 |         ret = ppl::cv::cuda::ResizeLinear<uint8_t, 3>(stream, h, w, w * c, input, dst_h, dst_w,
      |                              ^~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:54:50: error: expected primary-expression before ‘,’ token
   54 |         ret = ppl::cv::cuda::ResizeLinear<uint8_t, 3>(stream, h, w, w * c, input, dst_h, dst_w,
      |                                                  ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:55:72: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   55 |                                                       dst_w * c, output);
      |                                                                        ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:57:30: error: ‘ResizeLinear’ is not a member of ‘ppl::cv::cuda’
   57 |         ret = ppl::cv::cuda::ResizeLinear<uint8_t, 4>(stream, h, w, w * c, input, dst_h, dst_w,
      |                              ^~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:57:50: error: expected primary-expression before ‘,’ token
   57 |         ret = ppl::cv::cuda::ResizeLinear<uint8_t, 4>(stream, h, w, w * c, input, dst_h, dst_w,
      |                                                  ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:58:72: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   58 |                                                       dst_w * c, output);
      |                                                                        ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:67:30: error: ‘ResizeLinear’ is not a member of ‘ppl::cv::cuda’
   67 |         ret = ppl::cv::cuda::ResizeLinear<float, 1>(stream, h, w, w * c, input, dst_h, dst_w,
      |                              ^~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:67:43: error: expected primary-expression before ‘float’
   67 |         ret = ppl::cv::cuda::ResizeLinear<float, 1>(stream, h, w, w * c, input, dst_h, dst_w,
      |                                           ^~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:70:30: error: ‘ResizeLinear’ is not a member of ‘ppl::cv::cuda’
   70 |         ret = ppl::cv::cuda::ResizeLinear<float, 3>(stream, h, w, w * c, input, dst_h, dst_w,
      |                              ^~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:70:43: error: expected primary-expression before ‘float’
   70 |         ret = ppl::cv::cuda::ResizeLinear<float, 3>(stream, h, w, w * c, input, dst_h, dst_w,
      |                                           ^~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:73:30: error: ‘ResizeLinear’ is not a member of ‘ppl::cv::cuda’
   73 |         ret = ppl::cv::cuda::ResizeLinear<float, 4>(stream, h, w, w * c, input, dst_h, dst_w,
      |                              ^~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:73:43: error: expected primary-expression before ‘float’
   73 |         ret = ppl::cv::cuda::ResizeLinear<float, 4>(stream, h, w, w * c, input, dst_h, dst_w,
      |                                           ^~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp: In member function ‘mmdeploy::Result<void> mmdeploy::cuda::ResizeImpl::ResizeNearest(const mmdeploy::Tensor&, mmdeploy::Tensor&, cudaStream_t)’:
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:99:30: error: ‘ResizeNearestPoint’ is not a member of ‘ppl::cv::cuda’
   99 |         ret = ppl::cv::cuda::ResizeNearestPoint<uint8_t, 1>(stream, h, w, w * c, input, dst_h,
      |                              ^~~~~~~~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:99:56: error: expected primary-expression before ‘,’ token
   99 |         ret = ppl::cv::cuda::ResizeNearestPoint<uint8_t, 1>(stream, h, w, w * c, input, dst_h,
      |                                                        ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:100:85: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  100 |                                                             dst_w, dst_w * c, output);
      |                                                                                     ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:102:30: error: ‘ResizeNearestPoint’ is not a member of ‘ppl::cv::cuda’
  102 |         ret = ppl::cv::cuda::ResizeNearestPoint<uint8_t, 3>(stream, h, w, w * c, input, dst_h,
      |                              ^~~~~~~~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:102:56: error: expected primary-expression before ‘,’ token
  102 |         ret = ppl::cv::cuda::ResizeNearestPoint<uint8_t, 3>(stream, h, w, w * c, input, dst_h,
      |                                                        ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:103:85: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  103 |                                                             dst_w, dst_w * c, output);
      |                                                                                     ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:105:30: error: ‘ResizeNearestPoint’ is not a member of ‘ppl::cv::cuda’
  105 |         ret = ppl::cv::cuda::ResizeNearestPoint<uint8_t, 4>(stream, h, w, w * c, input, dst_h,
      |                              ^~~~~~~~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:105:56: error: expected primary-expression before ‘,’ token
  105 |         ret = ppl::cv::cuda::ResizeNearestPoint<uint8_t, 4>(stream, h, w, w * c, input, dst_h,
      |                                                        ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:106:85: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  106 |                                                             dst_w, dst_w * c, output);
      |                                                                                     ^
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:115:30: error: ‘ResizeNearestPoint’ is not a member of ‘ppl::cv::cuda’
  115 |         ret = ppl::cv::cuda::ResizeNearestPoint<float, 1>(stream, h, w, w * c, input, dst_h, dst_w,
      |                              ^~~~~~~~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:115:49: error: expected primary-expression before ‘float’
  115 |         ret = ppl::cv::cuda::ResizeNearestPoint<float, 1>(stream, h, w, w * c, input, dst_h, dst_w,
      |                                                 ^~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:118:30: error: ‘ResizeNearestPoint’ is not a member of ‘ppl::cv::cuda’
  118 |         ret = ppl::cv::cuda::ResizeNearestPoint<float, 3>(stream, h, w, w * c, input, dst_h, dst_w,
      |                              ^~~~~~~~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:118:49: error: expected primary-expression before ‘float’
  118 |         ret = ppl::cv::cuda::ResizeNearestPoint<float, 3>(stream, h, w, w * c, input, dst_h, dst_w,
      |                                                 ^~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:121:30: error: ‘ResizeNearestPoint’ is not a member of ‘ppl::cv::cuda’
  121 |         ret = ppl::cv::cuda::ResizeNearestPoint<float, 4>(stream, h, w, w * c, input, dst_h, dst_w,
      |                              ^~~~~~~~~~~~~~~~~~
/home/user/project/MMDeploy/csrc/preprocess/cuda/resize_impl.cpp:121:49: error: expected primary-expression before ‘float’
  121 |         ret = ppl::cv::cuda::ResizeNearestPoint<float, 4>(stream, h, w, w * c, input, dst_h, dst_w,
      |                                                 ^~~~~

It looks like ResizeLinear() and ResizeNearestPoint() has been replaced with Resize(.., ppl::cv::INTERPOLATION_TYPE_xx) where an optional input argument has been added.

The solution should be to replace the above functions with Resize(..) with the last argument set according to the resize type. I will try to make a PR, if the above solution works as expected.

I have solved it by using ppl.cv-0.1.1.tar.gz.

@tehkillerbee
Copy link
Contributor Author

@najingligong1111 I have added a PR that works with latest ppl.cv from master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants