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

[FIX] Fix compile error in distance benchmark #596

Conversation

trxcllnt
Copy link
Contributor

This PR fixes the following compile error:

pairwise_linestring_distance.cu (80): error: too many initializer values
          detected during:
            instantiation of "std::tuple<rmm::device_vector<cuspatial::cartesian_2d<T>>, rmm::device_vector<int32_t>> generate_linestring(int32_t, int32_t, T, cuspatial::cartesian_2d<T>) [with T=float]" 

@trxcllnt trxcllnt requested a review from a team as a code owner July 19, 2022 14:22
@trxcllnt trxcllnt added 3 - Ready for Review Ready for review by team improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Jul 19, 2022
@github-actions github-actions bot added the libcuspatial Relates to the cuSpatial C++ library label Jul 19, 2022
@harrism harrism requested review from isVoid and removed request for zhangjianting July 19, 2022 22:39
@harrism
Copy link
Member

harrism commented Jul 19, 2022

Did this not get caught by CI because we are not building benchmarks by default in CI? I was going to look at that today, coincidentally.

The old version of the code looks correct to me -- where did this fail? It doesn't fail locally for me or @isVoid .

@vyasr
Copy link
Contributor

vyasr commented Jul 21, 2022

Given that all benchmarks compiled successfully in #597 this change is suspicious. Is this perhaps a compiler bug on a new system (Hopper)?

@trxcllnt
Copy link
Contributor Author

Nope, I encountered this just attempting to build benchmarks with GCC 9.4 and CUDA 11.6.2 in rapids-compose.

@trxcllnt
Copy link
Contributor Author

trxcllnt commented Jul 25, 2022

Here's the full error:

$ gcc --version && g++ --version && nvcc --version
gcc (conda-forge gcc 9.4.0-16) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

g++ (conda-forge gcc 9.4.0-16) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Tue_Mar__8_18:18:20_PST_2022
Cuda compilation tools, release 11.6, V11.6.124
Build cuda_11.6.r11.6/compiler.31057947_0

FAILED: benchmarks/CMakeFiles/DISTANCES_BENCH.dir/pairwise_linestring_distance.cu.o 
/usr/local/bin/nvcc -forward-unknown-to-host-compiler -DCUDF_VERSION=22.08.00 -DGTEST_LINKED_AS_SHARED_LIBRARY=1 -DJITIFY_USE_CACHE -DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_INFO -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_CUDA -DTHRUST_HOST_SYSTEM=THRUST_HOST_SYSTEM_CPP -I/home/ptaylor/dev/rapids/cuspatial/cpp/benchmarks -I/home/ptaylor/dev/rapids/cuspatial/cpp -I/home/ptaylor/dev/rapids/cuspatial/cpp/src -I/home/ptaylor/dev/rapids/cuspatial/cpp/build/cuda-11.6.2/fea-drop-glue-code/release/_deps/benchmark-src/src/../include -I/home/ptaylor/dev/rapids/cudf/cpp/build/cuda-11.6.2/branch-22.08/release/_deps/libcudacxx-src/include -I/home/ptaylor/dev/rapids/cudf/cpp/build/cuda-11.6.2/branch-22.08/release/_deps/thrust-src -I/home/ptaylor/dev/rapids/cudf/cpp/build/cuda-11.6.2/branch-22.08/release/_deps/thrust-src/dependencies/cub -I/home/ptaylor/dev/rapids/cuspatial/cpp/include -I/home/ptaylor/dev/rapids/cuspatial/cpp/build/cuda-11.6.2/fea-drop-glue-code/release/_deps/nvbench-src -I/home/ptaylor/dev/rapids/cuspatial/cpp/build/cuda-11.6.2/fea-drop-glue-code/release/_deps/nvbench-build -isystem=/home/ptaylor/dev/rapids/cudf/cpp -isystem=/home/ptaylor/dev/rapids/cudf/cpp/src -isystem=/home/ptaylor/dev/rapids/compose/etc/conda/cuda_11.6/envs/rapids/include -isystem=/home/ptaylor/dev/rapids/cudf/cpp/build/cuda-11.6.2/branch-22.08/release/_deps/dlpack-src/include -isystem=/home/ptaylor/dev/rapids/cudf/cpp/build/cuda-11.6.2/branch-22.08/release/_deps/jitify-src -isystem=/home/ptaylor/dev/rapids/cudf/cpp/include -isystem=/home/ptaylor/dev/rapids/cudf/cpp/build/cuda-11.6.2/branch-22.08/release/include -isystem=/home/ptaylor/dev/rapids/rmm/include -isystem=/usr/local/cuda/include -Xcompiler=-fdiagnostics-color=always -Xcompiler=-Wno-deprecated-declarations -O3 -DNDEBUG --generate-code=arch=compute_75,code=[sm_75] -Xcompiler=-fPIE -Xcompiler=-Wno-parentheses --expt-extended-lambda --expt-relaxed-constexpr -Werror=all-warnings -Xcompiler=-Wall,-Werror,-Wno-error=deprecated-declarations -Xfatbin=-compress-all -Xcompiler=-Wno-deprecated-declarations -Werror=cross-execution-space-call -Xcompiler -pthread -std=c++17 -MD -MT benchmarks/CMakeFiles/DISTANCES_BENCH.dir/pairwise_linestring_distance.cu.o -MF benchmarks/CMakeFiles/DISTANCES_BENCH.dir/pairwise_linestring_distance.cu.o.d -x cu -c /home/ptaylor/dev/rapids/cuspatial/cpp/benchmarks/pairwise_linestring_distance.cu -o benchmarks/CMakeFiles/DISTANCES_BENCH.dir/pairwise_linestring_distance.cu.o
/home/ptaylor/dev/rapids/cuspatial/cpp/benchmarks/pairwise_linestring_distance.cu(80): error: too many initializer values
          detected during:
            instantiation of "std::tuple<rmm::device_vector<cuspatial::cartesian_2d<T>>, rmm::device_vector<int32_t>> generate_linestring(int32_t, int32_t, T, cuspatial::cartesian_2d<T>) [with T=float]" 
(100): here
            instantiation of "void pairwise_linestring_distance_benchmark(nvbench::state &, nvbench::type_list<T>) [with T=float]" 
(140): here
            instantiation of "void pairwise_linestring_distance_benchmark_line_140::operator()(nvbench::state &, nvbench::type_list<Ts...>) [with Ts=<float>]" 
_deps/nvbench-src/nvbench/detail/type_list_impl.cuh(100): here
            instantiation of "void nvbench::tl::detail::foreach<TypeList,Functor,Is...>(std::index_sequence<Is...>, Functor &&) [with TypeList=nvbench::type_list<nvbench::type_list<float>, nvbench::type_list<double>>, Functor=lambda [](auto)->auto, Is=<0UL, 1UL>]" 
_deps/nvbench-src/nvbench/detail/type_list_impl.cuh(109): here
            instantiation of "void nvbench::tl::detail::foreach<TypeList,Functor>(Functor &&) [with TypeList=nvbench::type_list<nvbench::type_list<float>, nvbench::type_list<double>>, Functor=lambda [](auto)->auto]" 
_deps/nvbench-src/nvbench/type_list.cuh(140): here
            [ 3 instantiation contexts not shown ]
            instantiation of "void nvbench::benchmark<KernelGenerator, TypeAxes>::do_run() [with KernelGenerator=pairwise_linestring_distance_benchmark_line_140, TypeAxes=nvbench::type_list<floating_point_types>]" 
_deps/nvbench-src/nvbench/benchmark.cuh(65): here
            implicit generation of "nvbench::benchmark<KernelGenerator, TypeAxes>::~benchmark() noexcept [with KernelGenerator=pairwise_linestring_distance_benchmark_line_140, TypeAxes=nvbench::type_list<floating_point_types>]" 
_deps/nvbench-src/nvbench/benchmark.cuh(65): here
            instantiation of class "nvbench::benchmark<KernelGenerator, TypeAxes> [with KernelGenerator=pairwise_linestring_distance_benchmark_line_140, TypeAxes=nvbench::type_list<floating_point_types>]" 
_deps/nvbench-src/nvbench/benchmark.cuh(65): here
            instantiation of "nvbench::benchmark<KernelGenerator, TypeAxes>::benchmark() [with KernelGenerator=pairwise_linestring_distance_benchmark_line_140, TypeAxes=nvbench::type_list<floating_point_types>]" 
/home/ptaylor/dev/rapids/compose/etc/conda/cuda_11.6/envs/rapids/x86_64-conda-linux-gnu/include/c++/9.4.0/bits/unique_ptr.h(857): here
            instantiation of "std::_MakeUniq<_Tp>::__single_object std::make_unique<_Tp,_Args...>(_Args &&...) [with _Tp=nvbench::benchmark<pairwise_linestring_distance_benchmark_line_140, nvbench::type_list<floating_point_types>>, _Args=<>]" 
(140): here

1 error detected in the compilation of "/home/ptaylor/dev/rapids/cuspatial/cpp/benchmarks/pairwise_linestring_distance.cu".

@harrism
Copy link
Member

harrism commented Jul 25, 2022

Hmmm, I think the original code should work -- it's initializing the two elements using an implicitly generated constructor. Your change forces it to use a different implicitly generated constructor (initializer list constructor?)

@thomcom
Copy link
Contributor

thomcom commented Aug 3, 2022

I had the same error, @trxcllnt just now building cuspatial from branch-22.10. Your fix however doesn't work for me, but ({}) does.

@jrhemstad
Copy link
Contributor

The alternative is to add a constructor to vec_2d and import it in cartesian_2d

https://godbolt.org/z/Gh6v1zWKa

@trxcllnt trxcllnt force-pushed the fix/distance-benchmark-compile-error branch from bdc5c8d to 567cd00 Compare August 4, 2022 20:08
@trxcllnt
Copy link
Contributor Author

trxcllnt commented Aug 4, 2022

@jrhemstad that didn't work for me, but I pushed a new fix that does seem to be working.

Copy link
Member

@harrism harrism left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What we really want is just return prev + segment_length * rad; what if you change the auto const& parameters to explicit cartesian_2d<T>.

@trxcllnt trxcllnt force-pushed the fix/distance-benchmark-compile-error branch from 567cd00 to 64465c9 Compare August 8, 2022 22:31
@trxcllnt trxcllnt changed the base branch from branch-22.08 to branch-22.10 August 8, 2022 22:36
@trxcllnt
Copy link
Contributor Author

@gpucibot merge

@trxcllnt
Copy link
Contributor Author

@gpucibot merge

Copy link
Member

@harrism harrism left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original seems to work on the latest ToT NVCC so the bug may be already fixed. In any case, this workaround is not as offensive so approving.

@rapids-bot rapids-bot bot merged commit 19a8d3f into rapidsai:branch-22.10 Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Ready for Review Ready for review by team improvement Improvement / enhancement to an existing function libcuspatial Relates to the cuSpatial C++ library non-breaking Non-breaking change
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants