3
我想知道使用declare target
指令的原因是什麼。我可以簡單地使用target {, data} map (to/from/tofrom ...)
來指定設備應該使用哪些變量。至於功能,是否必須將從target
區域調用的函數強制聲明爲目標?假設,我有以下代碼:在OpenMP中使用聲明目標編譯指示的原因
int data[N];
#pragma omp target
{
#pragma omp parallel for
for (int i=0; i<N; i++)
data[i] = my_function(i);
}
就是圍繞my_function()
聲明/定義與declare target
需要它?