Changes

Jump to: navigation, search

BetaT

1,134 bytes added, 20:14, 1 April 2017
no edit summary
Unfortunately a new problem has risen, when the argument is raised above 2000 & 2000 the NVidia driver once again crashes and I am stuck with no solution currently.
 
 
=== Re - Parallelize ===
 
The original parallelized solution I had was greatly flawed... So I have parallelized the code once again, this time using Thread Identifiers from the Grid.
 
== New Kernel ==
 
'''__global__ void Initalize(float* u, float* un, int nx, int nt, float dx)
{
int i = blockIdx.x * blockDim.x + threadIdx.x;
int j = blockIdx.y * blockDim.y + threadIdx.y;
if (i < nx && j < nx)
{
// replace k with i. because i represents the x dimension in coalesced memory escalting i from 0 to nx
if (i*dx >= 0.5 && i*dx <= 1)
// replace k here with i for the X dimension because we want to change the first instance in each dimension
u[i * nx] = 2;
else
u[i * nx] = 1;
}
}
The old code was:
for (int k = 0; k <= nx - 1; k++)
if (k*dx >= 0.5 && k*dx <= 1)
{
u[k * nx] = 2;
}
else
{
u[k * nx] = 1;
}'''
So I removed the for loop and simply changed the "k" in the "if" statement to represnt the threadIdx.x identifier because X is the fastest moving dimension it will range from 0 to NX like a for look. This matches the orignal Naiver output.
Next I have updated
212
edits

Navigation menu