我正在搜索如何創建指針數組並將其複製到CUDA內存。我發現這個職位CUDA Double pointer memory copy但下面的行接受的答案將雙指針的地址強制轉換爲void **
int ** devicePointersStoredInDeviceMemory;
cudaMalloc((void**)&devicePointersStoredInDeviceMemory, sizeof(int*)*N);
是竊聽我有點。 傳遞雙指針的地址是什麼意思,並將其轉換爲void**
? 不會&devicePointerStoredInDeviceMemory
與int***
相同,所以爲什麼要將它投到void**
而不是void***
?
它的工作原理,但我不明白爲什麼。
注:這是標準C++未定義行爲,但Windows API依賴於它。 –