Skip to content

Commit bc33bab

Browse files
committed
Use one block for Single Block tests
1 parent c9dc62d commit bc33bab

1 file changed

Lines changed: 14 additions & 20 deletions

File tree

GPU/GPUbenchmark/cuda/Kernels.cu

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,11 @@ __global__ void readChunkSBKernel(
7575
chunk_type* results,
7676
size_t chunkSize)
7777
{
78-
if (chunkId == blockIdx.x) { // runs only if blockIdx.x is allowed in given split
79-
chunk_type sink{0};
80-
for (size_t i = threadIdx.x; i < chunkSize; i += blockDim.x) {
81-
sink += chunkPtr[i];
82-
}
83-
results[chunkId] = sink;
78+
chunk_type sink{0};
79+
for (size_t i = threadIdx.x; i < chunkSize; i += blockDim.x) {
80+
sink += chunkPtr[i];
8481
}
82+
results[chunkId] = sink;
8583
}
8684

8785
template <class chunk_type>
@@ -106,10 +104,8 @@ __global__ void writeChunkSBKernel(
106104
chunk_type* results,
107105
size_t chunkSize)
108106
{
109-
if (chunkId == blockIdx.x) { // runs only if blockIdx.x is allowed in given split
110-
for (size_t i = threadIdx.x; i < chunkSize; i += blockDim.x) {
111-
chunkPtr[i] = 0;
112-
}
107+
for (size_t i = threadIdx.x; i < chunkSize; i += blockDim.x) {
108+
chunkPtr[i] = 0;
113109
}
114110
}
115111

@@ -133,10 +129,8 @@ __global__ void copyChunkSBKernel(
133129
chunk_type* inputs,
134130
size_t chunkSize)
135131
{
136-
if (chunkId == blockIdx.x) { // runs only if blockIdx.x is allowed in given split
137-
for (size_t i = threadIdx.x; i < chunkSize; i += blockDim.x) {
138-
chunkPtr[i] = inputs[chunkId];
139-
}
132+
for (size_t i = threadIdx.x; i < chunkSize; i += blockDim.x) {
133+
chunkPtr[i] = inputs[chunkId];
140134
}
141135
}
142136

@@ -409,7 +403,7 @@ void GPUbenchmark<chunk_type>::readSequential(SplitLevel sl)
409403
switch (sl) {
410404
case SplitLevel::Blocks: {
411405
mResultWriter.get()->addBenchmarkEntry("seq_read_SB", getType<chunk_type>(), mState.getMaxChunks());
412-
auto nBlocks{mState.nMultiprocessors};
406+
// auto nBlocks{mState.nMultiprocessors};
413407
auto nThreads{std::min(mState.nMaxThreadsPerDimension, mState.nMaxThreadsPerBlock)};
414408
auto capacity{mState.getChunkCapacity()};
415409

@@ -419,7 +413,7 @@ void GPUbenchmark<chunk_type>::readSequential(SplitLevel sl)
419413
auto result = benchmarkSync(&gpu::readChunkSBKernel<chunk_type>,
420414
mState.getNKernelLaunches(),
421415
iChunk,
422-
nBlocks,
416+
1,
423417
nThreads, // args...
424418
mState.deviceReadResultsPtr,
425419
capacity);
@@ -536,7 +530,7 @@ void GPUbenchmark<chunk_type>::writeSequential(SplitLevel sl)
536530
switch (sl) {
537531
case SplitLevel::Blocks: {
538532
mResultWriter.get()->addBenchmarkEntry("seq_write_SB", getType<chunk_type>(), mState.getMaxChunks());
539-
auto nBlocks{mState.nMultiprocessors};
533+
// auto nBlocks{mState.nMultiprocessors};
540534
auto nThreads{std::min(mState.nMaxThreadsPerDimension, mState.nMaxThreadsPerBlock)};
541535
auto capacity{mState.getChunkCapacity()};
542536

@@ -546,7 +540,7 @@ void GPUbenchmark<chunk_type>::writeSequential(SplitLevel sl)
546540
auto result = benchmarkSync(&gpu::writeChunkSBKernel<chunk_type>,
547541
mState.getNKernelLaunches(),
548542
iChunk,
549-
nBlocks,
543+
1,
550544
nThreads,
551545
mState.deviceWriteResultsPtr,
552546
capacity);
@@ -665,7 +659,7 @@ void GPUbenchmark<chunk_type>::copySequential(SplitLevel sl)
665659
switch (sl) {
666660
case SplitLevel::Blocks: {
667661
mResultWriter.get()->addBenchmarkEntry("seq_copy_SB", getType<chunk_type>(), mState.getMaxChunks());
668-
auto nBlocks{mState.nMultiprocessors};
662+
// auto nBlocks{mState.nMultiprocessors};
669663
auto nThreads{std::min(mState.nMaxThreadsPerDimension, mState.nMaxThreadsPerBlock)};
670664
auto capacity{mState.getChunkCapacity()};
671665

@@ -675,7 +669,7 @@ void GPUbenchmark<chunk_type>::copySequential(SplitLevel sl)
675669
auto result = benchmarkSync(&gpu::copyChunkSBKernel<chunk_type>,
676670
mState.getNKernelLaunches(),
677671
iChunk,
678-
nBlocks,
672+
1,
679673
nThreads,
680674
mState.deviceCopyInputsPtr,
681675
capacity);

0 commit comments

Comments
 (0)