scatter.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /******************************************************************************
  2. * Copyright 2020 The Apollo Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *****************************************************************************/
  16. /*
  17. * Copyright 2018-2019 Autoware Foundation. All rights reserved.
  18. *
  19. * Licensed under the Apache License, Version 2.0 (the "License");
  20. * you may not use this file except in compliance with the License.
  21. * You may obtain a copy of the License at
  22. *
  23. * http://www.apache.org/licenses/LICENSE-2.0
  24. *
  25. * Unless required by applicable law or agreed to in writing, software
  26. * distributed under the License is distributed on an "AS IS" BASIS,
  27. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  28. * See the License for the specific language governing permissions and
  29. * limitations under the License.
  30. */
  31. /**
  32. * @author Kosuke Murakami
  33. * @date 2019/02/26
  34. */
  35. /**
  36. * @author Yan haixu
  37. * Contact: just github.com/hova88
  38. * @date 2021/04/30
  39. */
  40. #pragma once
  41. class ScatterCuda {
  42. private:
  43. const int num_threads_;
  44. const int grid_x_size_;
  45. const int grid_y_size_;
  46. public:
  47. /**
  48. * @brief Constructor
  49. * @param[in] num_threads The number of threads to launch cuda kernel
  50. * @param[in] grid_x_size Number of pillars in x-coordinate
  51. * @param[in] grid_y_size Number of pillars in y-coordinate
  52. * @details Captital variables never change after the compile
  53. */
  54. ScatterCuda(const int num_threads, const int grid_x_size,
  55. const int grid_y_size);
  56. /**
  57. * @brief Call scatter cuda kernel
  58. * @param[in] pillar_count The valid number of pillars
  59. * @param[in] x_coors X-coordinate indexes for corresponding pillars
  60. * @param[in] y_coors Y-coordinate indexes for corresponding pillars
  61. * @param[in] pfe_output Output from Pillar Feature Extractor
  62. * @param[out] scattered_feature Gridmap representation for pillars' feature
  63. * @details Allocate pillars in gridmap based on index(coordinates)
  64. * information
  65. */
  66. void DoScatterCuda(const int pillar_count, int* x_coors, int* y_coors,
  67. float* pfe_output, float* scattered_feature);
  68. };