cuda - Is it possible to deallocate memory for the N last elements of a thrust::device_vector without using resize? -


i'm using device_vector in order store information array of user input data. information necessary in order speed things when call second kernel, runs main algorithm.

after end of first kernel device_vector contain small amount of important elements. example if device_vector has size of 10000 in end 10-20 elements describing user input data.

what i'm doing right is, use function thrust::remove in order remove unnecessary values, if understand correctly, function doesn't remove unnecessary values, returns iterator last necessary value.

for example suppose have array:

0 0 0 0 0 5 0 0 8 0 0 0 0 13 0 0 

if call remove value 0, this:

5 8 13 0 0 0 0 0 0 0 0 0 0 0 0 0 

and return end iterator last necessary element, in case 13.

however, use information second kernel, , if understand correctly, unnecessary elements still allocated, using memory don't need.

my question is, can i, having end iterator last necessary element, remove unnecessary elements without using resize?

resize isn't efficient because removes elements, , allocates memory necessary elements well, memory allocated don't see point of doing this.

device_vector::resize doesn't cause reallocation occur upon shrink event. allowed so, of thrust 1.8, current implementation not.

for example, should able call resize(3) without worrying reallocation occurring.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

java - Using an Integer ArrayList in Android -