212
edits
Changes
BetaT
,→Original Problems when converting a program to use the GPU
The next problem encountered is like a vector we cannot transfer a 2D array to a *cudaMalloc* or *cudaMemCPy* function call. So the 2D array needs to be converted into a single array. And that brings another problem regarding the original algorithm which is shown below.
''' for (int i=0; i <= nx-1; i++)
{
u[i][it] = un[i][it-1] - c*dt/dx*(un[i][it-1]-un[i-1][it-1]);
}
''' for (int k = 0; k <= nx - 1; k++)
if (k*dx >= 0.5 && k*dx <= 1)
}
for (int it = 1; it <= nx - 1; it++)