From 303aa7f117edf6e05d65ddcd5f96376620094c8a Mon Sep 17 00:00:00 2001 From: pc Date: Thu, 24 Jun 2021 21:16:53 +0800 Subject: [PATCH] fix parrots cpu compile bug (#1129) --- mmcv/ops/csrc/parrots/bbox_overlaps_parrots.cpp | 2 ++ mmcv/ops/csrc/parrots/carafe_naive_parrots.cpp | 2 ++ mmcv/ops/csrc/parrots/carafe_parrots.cpp | 2 ++ mmcv/ops/csrc/parrots/cc_attention_parrots.cpp | 2 ++ mmcv/ops/csrc/parrots/deform_conv_parrots.cpp | 2 ++ mmcv/ops/csrc/parrots/deform_roi_pool_parrots.cpp | 2 ++ mmcv/ops/csrc/parrots/focal_loss_parrots.cpp | 2 ++ mmcv/ops/csrc/parrots/masked_conv2d_parrots.cpp | 2 ++ mmcv/ops/csrc/parrots/modulated_deform_conv_parrots.cpp | 2 ++ mmcv/ops/csrc/parrots/sync_bn_parrots.cpp | 2 ++ mmcv/ops/csrc/parrots/tin_shift_parrots.cpp | 2 ++ 11 files changed, 22 insertions(+) diff --git a/mmcv/ops/csrc/parrots/bbox_overlaps_parrots.cpp b/mmcv/ops/csrc/parrots/bbox_overlaps_parrots.cpp index 3c678a818d..35bb5f5c87 100644 --- a/mmcv/ops/csrc/parrots/bbox_overlaps_parrots.cpp +++ b/mmcv/ops/csrc/parrots/bbox_overlaps_parrots.cpp @@ -6,6 +6,7 @@ using namespace parrots; +#ifdef MMCV_WITH_CUDA /* * void bbox_overlaps_cuda(const Tensor bboxes1, const Tensor bboxes2, Tensor * ious, const int mode, const bool aligned, const int offset); @@ -35,3 +36,4 @@ PARROTS_EXTENSION_REGISTER(bbox_overlaps) .output(1) .apply(bbox_overlaps_parrots) .done(); +#endif diff --git a/mmcv/ops/csrc/parrots/carafe_naive_parrots.cpp b/mmcv/ops/csrc/parrots/carafe_naive_parrots.cpp index 34aadf26de..78dfe09d42 100644 --- a/mmcv/ops/csrc/parrots/carafe_naive_parrots.cpp +++ b/mmcv/ops/csrc/parrots/carafe_naive_parrots.cpp @@ -6,6 +6,7 @@ using namespace parrots; +#ifdef MMCV_WITH_CUDA /*void carafe_naive_forward_cuda(Tensor features, Tensor masks, Tensor output, * int kernel_size, int group_size, * int scale_factor) @@ -69,3 +70,4 @@ PARROTS_EXTENSION_REGISTER(carafe_naive_backward) .output(2) .apply(carafe_naive_backward_cuda_parrots) .done(); +#endif diff --git a/mmcv/ops/csrc/parrots/carafe_parrots.cpp b/mmcv/ops/csrc/parrots/carafe_parrots.cpp index 8fb32573fa..413778b55a 100644 --- a/mmcv/ops/csrc/parrots/carafe_parrots.cpp +++ b/mmcv/ops/csrc/parrots/carafe_parrots.cpp @@ -6,6 +6,7 @@ using namespace parrots; +#ifdef MMCV_WITH_CUDA /* * void carafe_forward_cuda(Tensor features, Tensor masks, Tensor rfeatures, * Tensor routput, Tensor rmasks, Tensor output, @@ -83,3 +84,4 @@ PARROTS_EXTENSION_REGISTER(carafe_backward) .output(6) .apply(carafe_backward_cuda_parrots) .done(); +#endif diff --git a/mmcv/ops/csrc/parrots/cc_attention_parrots.cpp b/mmcv/ops/csrc/parrots/cc_attention_parrots.cpp index 150d3ec370..a51e46c389 100644 --- a/mmcv/ops/csrc/parrots/cc_attention_parrots.cpp +++ b/mmcv/ops/csrc/parrots/cc_attention_parrots.cpp @@ -6,6 +6,7 @@ using namespace parrots; +#ifdef MMCV_WITH_CUDA /*void ca_forward_cuda(const Tensor t, const Tensor f, Tensor weight);*/ void ca_forward_cuda_parrots(CudaContext &ctx, const SSElement &attr, const OperatorBase::in_list_t &ins, @@ -77,3 +78,4 @@ PARROTS_EXTENSION_REGISTER(ca_map_backward) .output(2) .apply(ca_map_backward_cuda_parrots) .done(); +#endif diff --git a/mmcv/ops/csrc/parrots/deform_conv_parrots.cpp b/mmcv/ops/csrc/parrots/deform_conv_parrots.cpp index 3347882f83..949f6b4279 100644 --- a/mmcv/ops/csrc/parrots/deform_conv_parrots.cpp +++ b/mmcv/ops/csrc/parrots/deform_conv_parrots.cpp @@ -6,6 +6,7 @@ using namespace parrots; +#ifdef MMCV_WITH_CUDA /*void deform_conv_forward_cuda(Tensor input, Tensor weight, Tensor offset, * Tensor output, Tensor columns, Tensor ones, * int kW, int kH, int dW, int dH, int padW, @@ -177,3 +178,4 @@ PARROTS_EXTENSION_REGISTER(deform_conv_backward_parameters) .output(3) .apply(deform_conv_backward_parameters_cuda_parrots) .done(); +#endif diff --git a/mmcv/ops/csrc/parrots/deform_roi_pool_parrots.cpp b/mmcv/ops/csrc/parrots/deform_roi_pool_parrots.cpp index 275a7661b2..2fb8b371bb 100644 --- a/mmcv/ops/csrc/parrots/deform_roi_pool_parrots.cpp +++ b/mmcv/ops/csrc/parrots/deform_roi_pool_parrots.cpp @@ -6,6 +6,7 @@ using namespace parrots; +#ifdef MMCV_WITH_CUDA /*void deform_roi_pool_forward_cuda(Tensor input, Tensor rois, Tensor offset, * Tensor output, int pooled_height, * int pooled_width, float spatial_scale, @@ -97,3 +98,4 @@ PARROTS_EXTENSION_REGISTER(deform_roi_pool_backward) .output(2) .apply(deform_roi_pool_backward_cuda_parrots) .done(); +#endif diff --git a/mmcv/ops/csrc/parrots/focal_loss_parrots.cpp b/mmcv/ops/csrc/parrots/focal_loss_parrots.cpp index 46eea40561..3511d89a99 100644 --- a/mmcv/ops/csrc/parrots/focal_loss_parrots.cpp +++ b/mmcv/ops/csrc/parrots/focal_loss_parrots.cpp @@ -6,6 +6,7 @@ using namespace parrots; +#ifdef MMCV_WITH_CUDA void sigmoid_focal_loss_forward_cuda_parrots(CudaContext& ctx, const SSElement& attr, const OperatorBase::in_list_t& ins, @@ -108,3 +109,4 @@ PARROTS_EXTENSION_REGISTER(softmax_focal_loss_backward) .output(2) .apply(softmax_focal_loss_backward_cuda_parrots) .done(); +#endif diff --git a/mmcv/ops/csrc/parrots/masked_conv2d_parrots.cpp b/mmcv/ops/csrc/parrots/masked_conv2d_parrots.cpp index e01452e80d..5a9ff64f75 100644 --- a/mmcv/ops/csrc/parrots/masked_conv2d_parrots.cpp +++ b/mmcv/ops/csrc/parrots/masked_conv2d_parrots.cpp @@ -6,6 +6,7 @@ using namespace parrots; +#ifdef MMCV_WITH_CUDA void masked_im2col_forward_cuda_parrots(CudaContext& ctx, const SSElement& attr, const OperatorBase::in_list_t& ins, OperatorBase::out_list_t& outs) { @@ -67,3 +68,4 @@ PARROTS_EXTENSION_REGISTER(masked_col2im_forward) .output(1) .apply(masked_col2im_forward_cuda_parrots) .done(); +#endif diff --git a/mmcv/ops/csrc/parrots/modulated_deform_conv_parrots.cpp b/mmcv/ops/csrc/parrots/modulated_deform_conv_parrots.cpp index 837a9db306..de5ff63e0a 100644 --- a/mmcv/ops/csrc/parrots/modulated_deform_conv_parrots.cpp +++ b/mmcv/ops/csrc/parrots/modulated_deform_conv_parrots.cpp @@ -6,6 +6,7 @@ using namespace parrots; +#ifdef MMCV_WITH_CUDA void modulated_deform_conv_forward_cuda_parrots( CudaContext& ctx, const SSElement& attr, const OperatorBase::in_list_t& ins, OperatorBase::out_list_t& outs) { @@ -114,3 +115,4 @@ PARROTS_EXTENSION_REGISTER(modulated_deform_conv_backward) .output(7) .apply(modulated_deform_conv_backward_cuda_parrots) .done(); +#endif diff --git a/mmcv/ops/csrc/parrots/sync_bn_parrots.cpp b/mmcv/ops/csrc/parrots/sync_bn_parrots.cpp index 8a6a577cb1..8cdbdbbbd7 100644 --- a/mmcv/ops/csrc/parrots/sync_bn_parrots.cpp +++ b/mmcv/ops/csrc/parrots/sync_bn_parrots.cpp @@ -5,6 +5,7 @@ #include "sync_bn_pytorch.h" using namespace parrots; +#ifdef MMCV_WITH_CUDA void sync_bn_forward_mean_cuda_parrots(CudaContext& ctx, const SSElement& attr, const OperatorBase::in_list_t& ins, OperatorBase::out_list_t& outs) { @@ -106,3 +107,4 @@ PARROTS_EXTENSION_REGISTER(sync_bn_backward_data) .output(1) .apply(sync_bn_backward_data_cuda_parrots) .done(); +#endif diff --git a/mmcv/ops/csrc/parrots/tin_shift_parrots.cpp b/mmcv/ops/csrc/parrots/tin_shift_parrots.cpp index 48c7df4f2b..e2f7cc0472 100644 --- a/mmcv/ops/csrc/parrots/tin_shift_parrots.cpp +++ b/mmcv/ops/csrc/parrots/tin_shift_parrots.cpp @@ -5,6 +5,7 @@ #include "tin_shift_pytorch.h" using namespace parrots; +#ifdef MMCV_WITH_CUDA void tin_shift_forward_cuda_parrots(CudaContext &ctx, const SSElement &attr, const OperatorBase::in_list_t &ins, OperatorBase::out_list_t &outs) { @@ -34,3 +35,4 @@ PARROTS_EXTENSION_REGISTER(tin_shift_backward) .output(1) .apply(tin_shift_backward_cuda_parrots) .done(); +#endif