Удалены ошибки компилятора функций с использованием тяги::remove в C++.C++

Программы на C++. Форум разработчиков
Ответить
Anonymous
 Удалены ошибки компилятора функций с использованием тяги::remove в C++.

Сообщение Anonymous »

В настоящее время я пытаюсь использовать функцию Thust::remove для структуры Thust::device_vector в моей основной функции, как показано ниже:

Код: Выделить всё

#include 
#include 
#include 
#include 
#include 

struct config {
unsigned int ld, ve, rd, solution;
config() = default;
};

int main() {
int n = 0;

//initialize starting configuration
int curr_size = 1, next_size;
thrust::device_vector curr(1);
curr[1] = {0, 0, 0, 0};
thrust::device_vector next;
thrust::device_vector sums;

for (int level = 0; level < ceil(n/2.0); ++level) {
sums = thrust::device_vector(curr_size);
next = thrust::device_vector(curr_size * n);
thrust::fill(next.begin(), next.end(), config{0,0,0,0});

next_size = thrust::reduce(thrust::device, sums.begin(), sums.end());
//erroring code
thrust::remove(thrust::device, curr.begin(), curr.end(), 0);
next.resize(next_size);
curr = thrust::device_vector(next);
}
}
однако компиляция программы приводит к 9 ошибкам компилятора, указывающим на недопустимые преобразования типов. Я пытался исправить распространенные ошибки для устранения ошибок::remove, например, при запуске 64-битного проекта, и даже пытался это сделать на device_vector из int, но продолжал получать те же ошибки. Ошибки, показанные ниже (уменьшено из-за ограничений на количество символов)

Код: Выделить всё

FAILED: CMakeFiles/Solver.dir/main.cu.o
/usr/local/cuda-13.0/bin/nvcc -forward-unknown-to-host-compiler   -g "--generate-code=arch=compute_89,code=[compute_89,sm_89]" -MD -MT CMakeFiles/Solver.dir/main.cu.o -MF CMakeFiles/Solver.dir/main.cu.o.d -x cu -rdc=true -c /home/aowyn/CLionProjects/Solver/main.cu -o CMakeFiles/Solver.dir/main.cu.o
/usr/local/cuda-13.0/targets/x86_64-linux/include/cccl/cub/agent/agent_select_if.cuh(407): error: function "cuda::std::__4::__not_fn_t::operator()(_Args &&...) & [with _Fn=thrust::THRUST_300001_SM_890_NS::detail::functional::actor, _Args=, __cccl_true_=true, =0]" (declared at line 62 of /usr/local/cuda-13.0/targets/x86_64-linux/include/cccl/cuda/std/__functional/not_fn.h) cannot be referenced -- it is a deleted function
selection_flags[ITEM] = static_cast(select_op(items[ITEM]));

/usr/local/cuda-13.0/targets/x86_64-linux/include/cccl/cub/agent/agent_select_if.cuh(407): error: invalid type conversion
selection_flags[ITEM] = static_cast(select_op(items[ITEM]));

/usr/local/cuda-13.0/targets/x86_64-linux/include/cccl/cub/agent/agent_select_if.cuh(407): error: function "cuda::std::__4::__not_fn_t::operator()(_Args &&...) & [with _Fn=thrust::THRUST_300001_SM_890_NS::detail::functional::actor, _Args=, __cccl_true_=true, =0]" (declared at line 62 of /usr/local/cuda-13.0/targets/x86_64-linux/include/cccl/cuda/std/__functional/not_fn.h) cannot be referenced -- it is a deleted function
selection_flags[ITEM] = static_cast(select_op(items[ITEM]));

/usr/local/cuda-13.0/targets/x86_64-linux/include/cccl/cub/agent/agent_select_if.cuh(407): error: invalid type conversion
selection_flags[ITEM] = static_cast(select_op(items[ITEM]));

/usr/local/cuda-13.0/targets/x86_64-linux/include/cccl/cub/agent/agent_select_if.cuh(407): error: function "cuda::std::__4::__not_fn_t::operator()(_Args &&...) & [with _Fn=thrust::THRUST_300001_SM_890_NS::detail::functional::actor, _Args=, __cccl_true_=true, =0]" (declared at line 62 of /usr/local/cuda-13.0/targets/x86_64-linux/include/cccl/cuda/std/__functional/not_fn.h) cannot be referenced -- it is a deleted function
selection_flags[ITEM] = static_cast(select_op(items[ITEM]));

/usr/local/cuda-13.0/targets/x86_64-linux/include/cccl/cub/agent/agent_select_if.cuh(407): error: invalid type conversion
selection_flags[ITEM] = static_cast(select_op(items[ITEM]));

/usr/local/cuda-13.0/targets/x86_64-linux/include/cccl/cub/agent/agent_select_if.cuh(407): error: function "cuda::std::__4::__not_fn_t::operator()(_Args &&...) &  [with _Fn=thrust::THRUST_300001_SM_890_NS::detail::functional::actor, _Args=, __cccl_true_=true, =0]" (declared at line 62 of /usr/local/cuda-13.0/targets/x86_64-linux/include/cccl/cuda/std/__functional/not_fn.h) cannot be referenced -- it is a deleted function
selection_flags[ITEM] = static_cast(select_op(items[ITEM]));

/usr/local/cuda-13.0/targets/x86_64-linux/include/cccl/cub/agent/agent_select_if.cuh(407): error: invalid type conversion
selection_flags[ITEM] = static_cast(select_op(items[ITEM]));

/usr/local/cuda-13.0/targets/x86_64-linux/include/cccl/thrust/detail/function.h(44): error: no instance of function template "thrust::THRUST_300001_SM_890_NS::detail::functional::actor::operator() [with Eval=thrust::THRUST_300001_SM_890_NS::detail::functional::composite]" matches the argument list
argument types are: (config)
object type is: thrust::THRUST_300001_SM_890_NS::detail::functional::actor
return static_cast(m_f(thrust::raw_reference_cast(::cuda::std::forward(args))...));
^
/usr/local/cuda-13.0/targets/x86_64-linux/include/cccl/thrust/detail/functional/actor.h(59): note #3327-D: candidate function template "thrust::THRUST_300001_SM_890_NS::detail::functional::actor::operator() [with Eval=thrust::THRUST_300001_SM_890_NS::detail::functional::composite]" failed deduction
auto operator()(Ts&&... ts) const -> decltype(Eval::eval(::cuda::std::forward(ts)...))

9 errors detected in the compilation of "/home/aowyn/CLionProjects/Solver/main.cu".
ninja: build stopped: subcommand failed.
Любые предложения о том, как это исправить, будем очень признательны, спасибо.

Подробнее здесь: https://stackoverflow.com/questions/798 ... emove-in-c
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C++»