根據CUDA的Thrust library documentation,thrust::inclusive_scan()
有參數:CUDA的thrust :: inclusive_scan()是否有'init'參數?
OutputIterator thrust::inclusive_scan(InputIterator first,
InputIterator last,
OutputIterator result,
AssociativeOperator binary_op
)
然而,在使用示範(同一文檔中),他們通過參數。一個額外的第四個參數被作爲掃描(酷似thrust::exclusive_scan()
)的初值通過:
int data[10] = {-5, 0, 2, -3, 2, 4, 0, -1, 2, 8};
thrust::maximum<int> binary_op;
thrust::inclusive_scan(data, data + 10, data, 1, binary_op); // in-place scan
現在,我的代碼將只編譯通過4個參數(經過5給出了錯誤no instance of overloaded function "thrust::inclusive_scan" matches the argument list
),但我碰巧需要就像在這個例子中初始化我的滾動最大值。
任何人都可以澄清如何初始化包容性掃描?
非常感謝。
你在哪裏找到這種用法的示範? – Bart
在Thrust庫文檔中:http://docs.thrust.googlecode.com/hg/group__prefixsums.html#ga7109170b96a48fab736e52b75f423464 – mchen
哈,除非我沒有得到什麼東西,這似乎是錯誤的。也許報告吧。 – Bart