Skip to content

Commit

Permalink
Add ccache instructions to azure pipeline
Browse files Browse the repository at this point in the history
Setting a high limit on cache size

Per-run stats only

Removed ccache from Mac, negative performance impact
  • Loading branch information
kunaltyagi committed Sep 30, 2019
1 parent 922387d commit 3181dfe
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
12 changes: 12 additions & 0 deletions .ci/azure-pipelines/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,21 @@ jobs:
variables:
BUILD_DIR: '$(Agent.BuildDirectory)/build'
CMAKE_CXX_FLAGS: '-Wall -Wextra -Wabi -O2'
CCACHE_DIR: $(Pipeline.Workspace)/ccache
CCACHE_MAXSIZE: 15G
steps:
- task: CacheBeta@0
inputs:
key: ccache | gcc | $(Agent.OS)
path: $(CCACHE_DIR)
displayName: ccache
- script: ccache -z
displayName: 'Zero ccache statistics'
- script: |
mkdir $BUILD_DIR && cd $BUILD_DIR
cmake $(Build.SourcesDirectory) \
-DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" \
-DPCL_DISABLE_CCACHE=OFF \
-DPCL_ONLY_CORE_POINT_TYPES=ON \
-DBUILD_simulation=ON \
-DBUILD_surface_on_nurbs=ON \
Expand All @@ -41,6 +51,8 @@ jobs:
cmake --build . -- test_filters test_registration test_registration_api
cmake --build . -- -j2
displayName: 'Build Library'
- script: ccache -s
displayName: 'Display ccache statistics'
- script: |
cd $BUILD_DIR/test
ctest -V -T Test
Expand Down
33 changes: 13 additions & 20 deletions features/include/pcl/features/impl/rops_estimation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ pcl::ROPSEstimation <PointInT, PointOutT>::computeFeature (PointCloudOut &output

//feature size = number_of_rotations * number_of_axis_to_rotate_around * number_of_projections * number_of_central_moments
unsigned int feature_size = number_of_rotations_ * 3 * 3 * 5;
unsigned int number_of_points = static_cast <unsigned int> (indices_->size ());
const auto number_of_points = indices_->size ();
output.points.resize (number_of_points, PointOutT ());

for (unsigned int i_point = 0; i_point < number_of_points; i_point++)
Expand Down Expand Up @@ -382,10 +382,10 @@ pcl::ROPSEstimation <PointInT, PointOutT>::computeEigenVectors (const Eigen::Mat
template <typename PointInT, typename PointOutT> void
pcl::ROPSEstimation <PointInT, PointOutT>::transformCloud (const PointInT& point, const Eigen::Matrix3f& matrix, const std::vector <int>& local_points, PointCloudIn& transformed_cloud) const
{
const unsigned int number_of_points = static_cast <unsigned int> (local_points.size ());
const auto number_of_points = local_points.size ();
transformed_cloud.points.resize (number_of_points, PointInT ());

for (unsigned int i = 0; i < number_of_points; i++)
for (std::size_t i = 0; i < number_of_points; i++)
{
Eigen::Vector3f transformed_point (
surface_->points[local_points[i]].x - point.x,
Expand Down Expand Up @@ -417,7 +417,7 @@ pcl::ROPSEstimation <PointInT, PointOutT>::rotateCloud (const PointInT& axis, co
(1 - cosine) * y * x + sine * z, cosine + (1 - cosine) * y * y, (1 - cosine) * y * z - sine * x,
(1 - cosine) * z * x - sine * y, (1 - cosine) * z * y + sine * x, cosine + (1 - cosine) * z * z;

const unsigned int number_of_points = static_cast <unsigned int> (cloud.points.size ());
const auto number_of_points = cloud.points.size ();

rotated_cloud.header = cloud.header;
rotated_cloud.width = number_of_points;
Expand All @@ -431,7 +431,7 @@ pcl::ROPSEstimation <PointInT, PointOutT>::rotateCloud (const PointInT& axis, co
max (1) = -std::numeric_limits <float>::max ();
max (2) = -std::numeric_limits <float>::max ();

for (unsigned int i_point = 0; i_point < number_of_points; i_point++)
for (std::size_t i_point = 0; i_point < number_of_points; i_point++)
{
Eigen::Vector3f point (
cloud.points[i_point].x,
Expand All @@ -445,13 +445,11 @@ pcl::ROPSEstimation <PointInT, PointOutT>::rotateCloud (const PointInT& axis, co
rotated_point.z = point (2);
rotated_cloud.points[i_point] = rotated_point;

if (min (0) > rotated_point.x) min (0) = rotated_point.x;
if (min (1) > rotated_point.y) min (1) = rotated_point.y;
if (min (2) > rotated_point.z) min (2) = rotated_point.z;

if (max (0) < rotated_point.x) max (0) = rotated_point.x;
if (max (1) < rotated_point.y) max (1) = rotated_point.y;
if (max (2) < rotated_point.z) max (2) = rotated_point.z;
for (int i = 0; i < 3; ++i)
{
min(i) = std::min(min(i), point(i));
max(i) = std::max(max(i), point(i));
}
}
}

Expand All @@ -461,8 +459,6 @@ pcl::ROPSEstimation <PointInT, PointOutT>::getDistributionMatrix (const unsigned
{
matrix.setZero ();

const unsigned int number_of_points = static_cast <unsigned int> (cloud.points.size ());

const unsigned int coord[3][2] = {
{0, 1},
{0, 2},
Expand All @@ -471,12 +467,9 @@ pcl::ROPSEstimation <PointInT, PointOutT>::getDistributionMatrix (const unsigned
const float u_bin_length = (max (coord[projection][0]) - min (coord[projection][0])) / number_of_bins_;
const float v_bin_length = (max (coord[projection][1]) - min (coord[projection][1])) / number_of_bins_;

for (unsigned int i_point = 0; i_point < number_of_points; i_point++)
for (const auto& pt: cloud.points)
{
Eigen::Vector3f point (
cloud.points[i_point].x,
cloud.points[i_point].y,
cloud.points[i_point].z);
Eigen::Vector3f point (pt.x, pt.y, pt.z);

const float u_length = point (coord[projection][0]) - min[coord[projection][0]];
const float v_length = point (coord[projection][1]) - min[coord[projection][1]];
Expand All @@ -492,7 +485,7 @@ pcl::ROPSEstimation <PointInT, PointOutT>::getDistributionMatrix (const unsigned
matrix (row, col) += 1.0f;
}

matrix /= static_cast <float> (number_of_points);
matrix /= static_cast <float> (std::min(1, cloud.points.size ()));
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 3181dfe

Please sign in to comment.