Changes

Jump to: navigation, search

BetaT

496 bytes added, 18:03, 3 April 2017
Optimizing with 2 Kernels
== Optimizing with 2 Kernels ==
The kernels have been initialized as a 2D Grid '''dim3 dGrid(nbx, nbx); AND dim3 dBlock(ntpb, ntpb);'''
In the first kernel I have Replaced the for loop statement.
The goal of this first statement was always to set the values of first value in each column to either 1 or 2 based off the condition in the if statement.The for loop is not needed.
__global__ void Initalize(float* u, float* un, int nx, int nt, float dx)
}
 
This was the tricky part in converting the original code into the kernel.
I have removed the 2 inner for loops but kept the outer loop.
The program takes 2 arrays. Let us say the X's represent the arrays below
 
xxxxx xxxxx
xxxxx xxxxx
xxxxx xxxxx
xxxxx xxxxx
xxxxx xxxxx
__global__ void Calculate (float* u, float* un,int nx, int c, float dx, float dt)
212
edits

Navigation menu