-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs #27: Add unit test stubs for CUDA
* I've found alignment issues in complex/nested structs in CUDA; we need some thorough tests for them!
- Loading branch information
Showing
4 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace nba { | ||
extern void* get_test_kernel_noop(); | ||
} | ||
|
||
// vim: ts=8 sts=4 sw=4 et |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include <nba/engines/cuda/test.hh> | ||
|
||
using namespace std; | ||
using namespace nba; | ||
|
||
__global__ void noop() | ||
{ | ||
__syncthreads(); | ||
} | ||
|
||
void *nba::get_test_kernel_noop() | ||
{ | ||
return reinterpret_cast<void *> (noop); | ||
} | ||
|
||
// vim: ts=8 sts=4 sw=4 et |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include <cstdint> | ||
#include <cuda_runtime.h> | ||
#include <nba/core/shiftedint.hh> | ||
#include <nba/framework/datablock_shared.hh> | ||
#include <gtest/gtest.h> | ||
#include <nba/engines/cuda/test.hh> | ||
#if 0 | ||
#require <engines/cuda/test.o> | ||
#endif | ||
|
||
using namespace std; | ||
using namespace nba; | ||
|
||
#ifdef USE_CUDA | ||
|
||
TEST(CUDADeviceTest, Initialization) { | ||
EXPECT_EQ(cudaSuccess, cudaSetDevice(0)); | ||
EXPECT_EQ(cudaSuccess, cudaDeviceReset()); | ||
} | ||
|
||
TEST(CUDADeviceTest, NoopKernel) { | ||
EXPECT_EQ(cudaSuccess, cudaSetDevice(0)); | ||
void *k = get_test_kernel_noop(); | ||
EXPECT_EQ(cudaSuccess, cudaLaunchKernel(k, dim3(1), dim3(1), nullptr, 0, 0)); | ||
EXPECT_EQ(cudaSuccess, cudaDeviceSynchronize()); | ||
EXPECT_EQ(cudaSuccess, cudaDeviceReset()); | ||
} | ||
|
||
#else | ||
|
||
TEST(CUDATest, Noop) { | ||
EXPECT_TRUE(1); | ||
} | ||
|
||
#endif | ||
|
||
// vim: ts=8 sts=4 sw=4 et |