gpu codes
#include "windows.h"
#include "cuda_sort.h"
#include <iostream>
__global__ void mergesortK(int *a, int *temp, int sortedsize,int N)
{
// int id = blockIdx.x * blockDim.x + threadIdx.x;
int blockid = blockIdx.z * gridDim.x * gridDim.y
+ blockIdx.y * gridDim.x
+ blockIdx.x;
int id = blockid * blockDim.x + threadIdx.x;
unsigned long index1, index2, endIndex1, endIndex2, targetIndex;
index1 = id * 2 * sortedsize;
endIndex1 = index1 + sortedsize;
index2 = endIndex1;
endIndex2 = index2 + sortedsize;
targetIndex = id * 2 * sortedsize;
if(index1 >= N) return;
if(endIndex1 > N)
{
endIndex1 = N;
index2 = endIndex2 = N;
}
if(index2 > N)
{
index2 = endIndex2 = N;
}
if(endIndex2 > N)
endIndex2 = N;
int done = 0;
while (!done)
{
if ((index1 =