White space and copyright fixes in examples.
This commit is contained in:
@@ -42,7 +42,7 @@ int main (int argc, char *argv[])
|
||||
Key *keys = new Key [n];
|
||||
Key *keys_orig = new Key [n];
|
||||
unsigned int *keys_gold = new unsigned int [n];
|
||||
|
||||
|
||||
srand48(rtc()*65536);
|
||||
|
||||
int sortBits = 32;
|
||||
@@ -63,7 +63,7 @@ int main (int argc, char *argv[])
|
||||
keys_gold[i] = keys[i].key;
|
||||
keys_orig[i] = keys[i];
|
||||
}
|
||||
|
||||
|
||||
ispcSetMallocHeapLimit(1024*1024*1024);
|
||||
|
||||
ispc::radixSort_alloc(n);
|
||||
|
||||
@@ -9,7 +9,7 @@ typedef long long Key;
|
||||
__forceinline__ __device__ int atomic_add_global(int* ptr, int value)
|
||||
{
|
||||
return atomicAdd(ptr, value);
|
||||
}
|
||||
}
|
||||
|
||||
static __device__ __forceinline__ int shfl_scan_add_step(int partial, int up_offset)
|
||||
{
|
||||
@@ -92,7 +92,7 @@ void sortPass(
|
||||
|
||||
const int mask = (1 << NUMBITS) - 1;
|
||||
|
||||
/* copy digit offset from Gmem to Lmem */
|
||||
/* copy digit offset from Gmem to Lmem */
|
||||
#if 1
|
||||
__shared__ int digitOffsets_sh[NUMDIGITS*4];
|
||||
volatile int *digitOffsets = digitOffsets_sh + warpIdx*NUMDIGITS;
|
||||
@@ -191,7 +191,7 @@ void completeScanGlobal(
|
||||
}
|
||||
}
|
||||
|
||||
__device__ static
|
||||
__device__ static
|
||||
inline void radixExclusiveScan(
|
||||
const int numBlocks,
|
||||
int excScanPtr[],
|
||||
@@ -242,11 +242,11 @@ void radixSort_alloc___export(const int n)
|
||||
nPrefixSum = NUMDIGITS*numBlocks;
|
||||
|
||||
|
||||
const int nalloc =
|
||||
const int nalloc =
|
||||
nSharedCounts +
|
||||
nCountsGlobal +
|
||||
nExcScan +
|
||||
nCountsBlock +
|
||||
nCountsBlock +
|
||||
nPartialSum +
|
||||
nPrefixSum;
|
||||
|
||||
@@ -261,7 +261,7 @@ void radixSort_alloc___export(const int n)
|
||||
prefixSum = partialSum + nPartialSum;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
extern "C"
|
||||
void radixSort_alloc(const int n)
|
||||
{
|
||||
radixSort_alloc___export<<<1,32>>>(n);
|
||||
@@ -269,7 +269,7 @@ void radixSort_alloc(const int n)
|
||||
}
|
||||
|
||||
|
||||
__device__ static
|
||||
__device__ static
|
||||
void radixSort_freeBufKeys()
|
||||
{
|
||||
if (numElementsBuf > 0)
|
||||
@@ -344,9 +344,9 @@ __global__ void radixSort___export(
|
||||
/* sorting */
|
||||
launch (numBlocks,1,1,
|
||||
sortPass)(
|
||||
bufKeys,
|
||||
keys,
|
||||
bit,
|
||||
bufKeys,
|
||||
keys,
|
||||
bit,
|
||||
numElements,
|
||||
excScan);
|
||||
sync;
|
||||
|
||||
@@ -63,7 +63,7 @@ void sortPass(
|
||||
|
||||
const uniform int mask = (1 << NUMBITS) - 1;
|
||||
|
||||
/* copy digit offset from Gmem to Lmem */
|
||||
/* copy digit offset from Gmem to Lmem */
|
||||
#if 1
|
||||
uniform int digitOffsets[NUMDIGITS];
|
||||
foreach (digit = 0 ... NUMDIGITS)
|
||||
@@ -95,7 +95,7 @@ void partialScanLocal(
|
||||
const uniform int blockDim = (numBlocks+taskCount-1)/taskCount;
|
||||
const uniform int bbeg = blockIdx * blockDim;
|
||||
const uniform int bend = min(bbeg + blockDim, numBlocks);
|
||||
|
||||
|
||||
uniform int (* uniform countsBlock)[NUMDIGITS] = (uniform int (*)[NUMDIGITS])countsAll;
|
||||
uniform int (* uniform excScanBlock)[NUMDIGITS] = (uniform int (*)[NUMDIGITS])excScanAll;
|
||||
uniform int (* uniform partialSum)[NUMDIGITS] = (uniform int (*)[NUMDIGITS])partialSumAll;
|
||||
@@ -142,7 +142,7 @@ void completeScanGlobal(
|
||||
const uniform int blockDim = (numBlocks+taskCount-1)/taskCount;
|
||||
const uniform int bbeg = blockIdx * blockDim;
|
||||
const uniform int bend = min(bbeg + blockDim, numBlocks);
|
||||
|
||||
|
||||
uniform int (* uniform excScanBlock)[NUMDIGITS] = (uniform int (*)[NUMDIGITS])excScanAll;
|
||||
uniform int (* uniform carryValue)[NUMDIGITS] = (uniform int (*)[NUMDIGITS])carryValueAll;
|
||||
|
||||
@@ -154,7 +154,7 @@ void completeScanGlobal(
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
static
|
||||
inline void radixExclusiveScan(
|
||||
const uniform int numBlocks,
|
||||
uniform int excScanPtr[],
|
||||
@@ -207,11 +207,11 @@ export void radixSort_alloc(const uniform int n)
|
||||
nPrefixSum = NUMDIGITS*numBlocks;
|
||||
|
||||
|
||||
const uniform int nalloc =
|
||||
const uniform int nalloc =
|
||||
nSharedCounts +
|
||||
nCountsGlobal +
|
||||
nExcScan +
|
||||
nCountsBlock +
|
||||
nCountsBlock +
|
||||
nPartialSum +
|
||||
nPrefixSum;
|
||||
|
||||
@@ -225,7 +225,7 @@ export void radixSort_alloc(const uniform int n)
|
||||
prefixSum = partialSum + nPartialSum;
|
||||
}
|
||||
|
||||
static
|
||||
static
|
||||
void radixSort_freeBufKeys()
|
||||
{
|
||||
if (numElementsBuf > 0)
|
||||
@@ -283,16 +283,16 @@ export void radixSort(
|
||||
excScan[digit] = scan + carry;
|
||||
carry += broadcast(scan+value, programCount-1);
|
||||
}
|
||||
|
||||
|
||||
/* computing offsets for each digit */
|
||||
radixExclusiveScan(numBlocks, excScan, counts, partialSum, prefixSum);
|
||||
|
||||
/* sorting */
|
||||
launch [numBlocks]
|
||||
launch [numBlocks]
|
||||
sortPass(
|
||||
bufKeys,
|
||||
keys,
|
||||
bit,
|
||||
bufKeys,
|
||||
keys,
|
||||
bit,
|
||||
numElements,
|
||||
excScan);
|
||||
sync;
|
||||
|
||||
Reference in New Issue
Block a user