첫 번째 벡터의 값을 기준으로 두 개의 thrust::device_vector<int>
에서 요소를 제거하려고했습니다. 직관적 I는이 잘린 다음 생성 :CUDA 스러스트 remove_if와 스레딩 스텐 슬 시퀀스
thrust::device_vector<float> idxToValue(COUNT_MAX);
thrust::device_vector<int> idxSorted(COUNT_MAX);
thrust::device_vector<int> groupIdxSorted(COUNT_MAX);
int count = COUNT_MAX;
float const minThreshold = MIN_THRESHOLD;
auto idxToValueSortedIter = thrust::make_permutation_iterator(
idxToValue.begin()
, idxSorted.begin()
);
auto new_end = thrust::remove_if(
thrust::make_zip_iterator(thrust::make_tuple(idxSorted.begin(), groupIdxSorted.begin()))
, thrust::make_zip_iterator(thrust::make_tuple(idxSorted.begin() + count, groupIdxSorted.begin() + count))
, idxToValueSortedIter
, thrust::placeholders::_1 >= minThreshold
);
count = thrust::get<0>(new_end.get_iterator_tuple()) - idxSorted.begin();
스러스트 문서화 불행히도
그래서 공판 시퀀스로 사용되는 경우범위 [스텐실 스텐실 + 말한다 (최종 - 제)) 마지막 범위 [결과 결과 +를 (중첩되지 않는다 - 제))
idxToValueSortedIter
내에서는
idxSorted
에 따라 그 결과를 (동일한 벡터)를 중첩 사실이다.
데이터를 임시 벡터에 복사하지 않고이를 해결할 수있는 방법이 있습니까?
실제로는 사용자 지정 펑터를 피하는 방법 (예 : 자리 표시 자 사용)을 찾고 있었지만 요청한 것은 작동합니다. 감사! – wondering