Changes

Jump to: navigation, search

BetaT

732 bytes added, 18:01, 12 April 2017
CALCULATE KERNEL
=== CALCULATE KERNEL ===
 
Here is the final CALCULATE Kernel for the application.
 
// kernerl
__global__ void Calculate(float* u, int nx, int c, float dx, float dt)
{
__shared__ float s[ntpb];
int i = blockIdx.x * blockDim.x + threadIdx.x;
int t = threadIdx.x;
float total = c*dt / dx;
if (i < nx && i != 0 && t != 0)
{
for (int it = 1; it <= nx - 1; it++)
{
s[t - 1] = u[(i - 1) * nx + it - 1];
u[it] = s[1];
__syncthreads();
u[i * nx + it] = s[t] - total * (s[t] - s[t - 1]);
__syncthreads();
}
}
}
=== OPTIMIZATION TIME COMPARISONS ===
212
edits

Navigation menu