Skip to content

Commit 60a9816

Browse files
authored
Fixed the maybe-uninitialized compilation error (#424)
Main branch fails to compile due to the `maybe-uninitialized` error in the `bytes` variable in the `linear_programming/utils.cuh` file (see the log below), which is fixed by this PR. ``` [1/3] Building CUDA object CMakeFiles/cuopt.dir/src/linear_programming/pdlp.cu.o FAILED: [code=1] CMakeFiles/cuopt.dir/src/linear_programming/pdlp.cu.o ccache /home/nguidotti/miniconda/envs/cuopt_dev/bin/nvcc -forward-unknown-to-host-compiler -DCCCL_DISABLE_PDL -DCUB_DISABLE_NAMESPACE_MAGIC -DCUB_IGNORE_NAMESPACE_MAGIC_ERROR -DCUOPT_CPU_ARCHITECTURE=\"x86_64\" -DCUOPT_CUDA_ARCHITECTURES=\"90a-real\" -DCUOPT_GIT_COMMIT_HASH=\"326eec6\" -DCUOPT_LOG_ACTIVE_LEVEL=RAPIDS_LOGGER_LOG_LEVEL_INFO -DCUTLASS_NAMESPACE=raft_cutlass -DLIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE -DNVTX_ENABLED -DRAFT_LOG_ACTIVE_LEVEL=RAPIDS_LOGGER_LOG_LEVEL_INFO -DRAFT_SYSTEM_LITTLE_ENDIAN=1 -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_CUDA -DTHRUST_DISABLE_ABI_NAMESPACE -DTHRUST_HOST_SYSTEM=THRUST_HOST_SYSTEM_CPP -DTHRUST_IGNORE_ABI_NAMESPACE_ERROR -Dcuopt_EXPORTS -I/cuopt-dev/cuopt/cpp/../thirdparty -I/cuopt-dev/cuopt/cpp/src -I/cuopt-dev/cuopt/cpp/include -I/cuopt-dev/cuopt/cpp/build/include -I/cuopt-dev/cuopt/cpp/libmps_parser/include -I/cuopt-dev/cuopt/cpp/build/_deps/cccl-src/lib/cmake/thrust/../../../thrust -I/cuopt-dev/cuopt/cpp/build/_deps/cccl-src/lib/cmake/libcudacxx/../../../libcudacxx/include -I/cuopt-dev/cuopt/cpp/build/_deps/cccl-src/lib/cmake/cub/../../../cub -isystem /cuopt-dev/cuopt/cpp/build/_deps/papilo-src/src -isystem /cuopt-dev/cuopt/cpp/build/_deps/papilo-build -isystem /home/nguidotti/miniconda/envs/cuopt_dev/targets/x86_64-linux/include -isystem /home/nguidotti/miniconda/envs/cuopt_dev/targets/x86_64-linux/include/cccl --expt-relaxed-constexpr --expt-extended-lambda -static-global-template-stub=false -O3 -DNDEBUG -lineinfo -std=c++17 "--generate-code=arch=compute_90a,code=[sm_90a]" -Xcompiler=-fPIC -Werror=cross-execution-space-call -Wno-deprecated-declarations -Xcompiler=-Werror -Xcompiler=-Wall -Wno-error=non-template-friend -Xfatbin=-compress-all -fopenmp -lineinfo --expt-extended-lambda --expt-relaxed-constexpr -MD -MT CMakeFiles/cuopt.dir/src/linear_programming/pdlp.cu.o -MF CMakeFiles/cuopt.dir/src/linear_programming/pdlp.cu.o.d -x cu -c /cuopt-dev/cuopt/cpp/src/linear_programming/pdlp.cu -o CMakeFiles/cuopt.dir/src/linear_programming/pdlp.cu.o /cuopt-dev/cuopt/cpp/src/linear_programming/utils.cuh: In function 'void cuopt::linear_programming::detail::compute_sum_bounds(const rmm::device_uvector<i_t>&, const rmm::device_uvector<i_t>&, rmm::device_scalar<i_t>&, rmm::cuda_stream_view) [with f_t = double]': /cuopt-dev/cuopt/cpp/src/linear_programming/utils.cuh:225:22: error: 'bytes' may be used uninitialized [-Werror=maybe-uninitialized] 225 | d_temp_storage.resize(bytes, stream_view); | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~ /cuopt-dev/cuopt/cpp/src/linear_programming/utils.cuh:205:8: note: 'bytes' was declared here 205 | size_t bytes; | ^~~~~ cc1plus: all warnings being treated as errors ninja: build stopped: subcommand failed. ``` Authors: - Nicolas L. Guidotti (https://github.com/nguidotti) Approvers: - Akif ÇÖRDÜK (https://github.com/akifcorduk) URL: #424
1 parent ea52678 commit 60a9816

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cpp/src/linear_programming/utils.cuh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ void inline compute_sum_bounds(const rmm::device_uvector<f_t>& constraint_lower_
202202
rmm::cuda_stream_view stream_view)
203203
{
204204
rmm::device_buffer d_temp_storage;
205-
size_t bytes;
205+
size_t bytes = 0;
206206
auto main_op = [] HD(const thrust::tuple<f_t, f_t> t) {
207207
const f_t lower = thrust::get<0>(t);
208208
const f_t upper = thrust::get<1>(t);

0 commit comments

Comments
 (0)