Open main menu

CDOT Wiki β

Changes

BetaT

25 bytes removed, 17:57, 29 March 2017
Optimizing Problems
'''
__global__ void Initalize(double* u, double* un, int nx, int nt, double dx)
{ int i = blockIdx.x * blockDim.x + threadIdx.x;
int j = blockIdx.y * blockDim.y + threadIdx.y;
for (int k = 0; k <= nx - 1; k++) if (k*dx >= 0.5 && k*dx <= 1) { u[k * nt] = 2; __syncthreads(); } else { u[k * nt] = 1; __syncthreads();
}
else
{
u[k * nt] = 1;
__syncthreads();
}
}'''
212
edits