Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Another -dc device/host conflict with nvcc 10.1 + Thrust 1.9.4 #973

Closed
hwinkler opened this issue Apr 13, 2019 · 3 comments
Closed

Another -dc device/host conflict with nvcc 10.1 + Thrust 1.9.4 #973

hwinkler opened this issue Apr 13, 2019 · 3 comments

Comments

@hwinkler
Copy link
Contributor

hwinkler commented Apr 13, 2019

Compiling this code with the -dc option to nvcc causes a device/host conflict:

#include <thrust/iterator/discard_iterator.h>
#include <thrust/device_vector.h>
#include <thrust/reduce.h>

void foo()
{
    auto probs = thrust::device_vector<float>(10, 0);
    auto fineProbs = thrust::device_vector<float>(10, 0);
    auto fineCells = thrust::device_vector<int32_t>(10, 0);
    thrust::reduce_by_key(fineCells.begin(),
                          fineCells.end(),
                          fineProbs.begin(),
                          thrust::make_discard_iterator(),
                          probs.begin());
}

Command line is

/usr/lib/cuda-10.1/bin/nvcc  -dc -std=c++11 --generate-code=arch=compute_60,code=sm_60  bug.cu

The error message is:

/usr/lib/cuda-10.1/bin/../targets/x86_64-linux/include/thrust/system/cuda/detail/reduce_by_key.h(1029): error:
 calling a __host__ function("thrust::detail::aligned_reinterpret_cast<int *, void *> ") 
 from a __host__ __device__ function(
  "thrust::cuda_cub::__reduce_by_key::reduce_by_key< ::thrust::cuda_cub::tag,  
::thrust::detail::normal_iterator< ::thrust::device_ptr<int> > ,  ::thrust::detail::normal_iterator< 
::thrust::device_ptr<float> > ,  ::thrust::discard_iterator< ::thrust::use_default> ,  
::thrust::detail::normal_iterator< ::thrust::device_ptr<float> > ,  ::thrust::equal_to<int> ,  ::thrust::plus<float> > ") is not allowed


I've attached this code and a makefile. #924 and #935 seem related but were against earlier versions.

@hwinkler
Copy link
Contributor Author

cubug.tar.gz

@griwes
Copy link
Collaborator

griwes commented Apr 13, 2019

This is a duplicate of #949; the fix is in flight, should land on github next week.

griwes added a commit that referenced this issue Apr 15, 2019
Bug 2422333
Bug 2522259
Bug 2528822
Github #949
Github #973
@griwes
Copy link
Collaborator

griwes commented Apr 15, 2019

This should be fixed on master now; I don't yet know what CUDA Toolkit version the fix will land in.

@griwes griwes closed this as completed Apr 15, 2019
brycelelbach pushed a commit that referenced this issue May 16, 2020
Bug 2422333
Bug 2522259
Bug 2528822
Github #949
Github #973
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants