Asif
Asif

Reputation: 145

CUDA Unified Memory and use of std::vector in device code

Back in the days, std::vector was not allowed in CUDA device code. Is that still true with current cuda 10.2 toolkit with Unified Memory?

I have a few public data members of type std::vector in a class that is passed reference to be used by a device kernel.

nvcc complains about calling a host function("std::vector...) ... from a global function("...) not allowed.

What is the correct way to use unified memory, if at all possible, to use on an std::vector? If it is not possible, is there an efficient work-around?

Upvotes: 2

Views: 553

Answers (1)

talonmies
talonmies

Reputation: 72349

Back in the days, std::vector was not allowed in CUDA device code. Is that still true with current cuda 10.2 toolkit with Unified Memory?

Yes.

What is the correct way to use unified memory, if at all possible, to use on an std::vector?

There is not one. It isn't possible. There is no C++ standard library support on the device.

If it is not possible, is there an efficient work-around?

No there is not.

Upvotes: 1

Related Questions