Skip to content

Commit

Permalink
update tests to use gpu if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
StRigaud committed Nov 19, 2024
1 parent d83e6d8 commit 55fa5f7
Show file tree
Hide file tree
Showing 175 changed files with 339 additions and 304 deletions.
16 changes: 8 additions & 8 deletions tests/core/test_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ TEST_P(TestArray, allocate)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

// Create a new Array
Expand Down Expand Up @@ -40,7 +40,7 @@ TEST_P(TestArray, typeDataMemory)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

// Create a new Array
Expand All @@ -57,7 +57,7 @@ TEST_P(TestArray, allocateWrite)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

// Write some data to the array
Expand Down Expand Up @@ -85,7 +85,7 @@ TEST_P(TestArray, readWrite)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

// Create a new Array
Expand Down Expand Up @@ -117,7 +117,7 @@ TEST_P(TestArray, copyFill)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

// Create a new Array
Expand Down Expand Up @@ -162,7 +162,7 @@ TEST_P(TestArray, stringCout)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

// Create a new Array
Expand All @@ -183,7 +183,7 @@ TEST_P(TestArray, regionOperation)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

// Create a new Array
Expand Down Expand Up @@ -258,7 +258,7 @@ TEST_P(TestArray, throwErrors)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

// Create a new Array
Expand Down
22 changes: 11 additions & 11 deletions tests/core/test_create_dst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ TEST_P(TestCreate, notNullPtr)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

input = cle::Array::create(10, 5, 3, 3, cle::dType::FLOAT, cle::mType::BUFFER, device);
Expand Down Expand Up @@ -125,7 +125,7 @@ TEST_P(TestCreate, create_dst)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

input = cle::Array::create(10, 5, 3, 3, cle::dType::FLOAT, cle::mType::BUFFER, device);
Expand Down Expand Up @@ -158,7 +158,7 @@ TEST_P(TestCreate, create_like)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

input = cle::Array::create(10, 5, 3, 3, cle::dType::FLOAT, cle::mType::BUFFER, device);
Expand Down Expand Up @@ -190,7 +190,7 @@ TEST_P(TestCreate, create_one)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

input = cle::Array::create(10, 5, 3, 3, cle::dType::FLOAT, cle::mType::BUFFER, device);
Expand Down Expand Up @@ -222,7 +222,7 @@ TEST_P(TestCreate, create_vector)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

input = cle::Array::create(10, 5, 3, 3, cle::dType::FLOAT, cle::mType::BUFFER, device);
Expand Down Expand Up @@ -254,7 +254,7 @@ TEST_P(TestCreate, create_xy)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

input = cle::Array::create(10, 5, 3, 3, cle::dType::FLOAT, cle::mType::BUFFER, device);
Expand Down Expand Up @@ -286,7 +286,7 @@ TEST_P(TestCreate, create_yx)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

input = cle::Array::create(10, 5, 3, 3, cle::dType::FLOAT, cle::mType::BUFFER, device);
Expand Down Expand Up @@ -318,7 +318,7 @@ TEST_P(TestCreate, create_zy)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

input = cle::Array::create(10, 5, 3, 3, cle::dType::FLOAT, cle::mType::BUFFER, device);
Expand Down Expand Up @@ -350,7 +350,7 @@ TEST_P(TestCreate, create_yz)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

input = cle::Array::create(10, 5, 3, 3, cle::dType::FLOAT, cle::mType::BUFFER, device);
Expand Down Expand Up @@ -382,7 +382,7 @@ TEST_P(TestCreate, create_xz)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

input = cle::Array::create(10, 5, 3, 3, cle::dType::FLOAT, cle::mType::BUFFER, device);
Expand Down Expand Up @@ -413,7 +413,7 @@ TEST_P(TestCreate, create_zx)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

input = cle::Array::create(10, 5, 3, 3, cle::dType::FLOAT, cle::mType::BUFFER, device);
Expand Down
18 changes: 18 additions & 0 deletions tests/core/test_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@ TEST_P(TestDevice, availableDevices)
}


TEST_P(TestDevice, defaultDevice)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);

auto list = cle::BackendManager::getInstance().getBackend().getDevicesList("all");
for (auto &&i : list)
{
std::cout << i << " ";
}
std::cout << std::endl;

auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
device->setWaitToFinish(true);
std::cout << device->getName() << std::endl;
}


TEST_P(TestDevice, type)
{
std::string param = GetParam();
Expand Down
10 changes: 5 additions & 5 deletions tests/core/test_execute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ TEST_P(TestExecution, parameterType)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

// Test assignment of cle::Array::Pointer
Expand All @@ -34,7 +34,7 @@ TEST_P(TestExecution, parameterList)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

auto src = cle::Array::create(10, 5, 3, 3, cle::dType::FLOAT, cle::mType::BUFFER, device);
Expand All @@ -57,7 +57,7 @@ TEST_P(TestExecution, rangeArray)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

size_t width = 5, height = 10, depth = 15;
Expand Down Expand Up @@ -87,7 +87,7 @@ TEST_P(TestExecution, execute)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

auto arr_a = cle::Array::create(10, 1, 1, 1, cle::dType::FLOAT, cle::mType::BUFFER, device);
Expand Down Expand Up @@ -130,7 +130,7 @@ TEST_P(TestExecution, executeNative)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

auto arr_a = cle::Array::create(10, 1, 1, 1, cle::dType::FLOAT, cle::mType::BUFFER, device);
Expand Down
16 changes: 8 additions & 8 deletions tests/core/test_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ TEST_P(TestArray, allocate)

std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);


Expand Down Expand Up @@ -45,7 +45,7 @@ TEST_P(TestArray, typeDataMemory)

std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);


Expand All @@ -65,7 +65,7 @@ TEST_P(TestArray, allocateWrite)

std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);


Expand Down Expand Up @@ -96,7 +96,7 @@ TEST_P(TestArray, readWrite)

std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);


Expand Down Expand Up @@ -131,7 +131,7 @@ TEST_P(TestArray, copyFill)

std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);


Expand Down Expand Up @@ -179,7 +179,7 @@ TEST_P(TestArray, stringCout)

std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);


Expand All @@ -203,7 +203,7 @@ TEST_P(TestArray, regionOperation)

std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);


Expand Down Expand Up @@ -281,7 +281,7 @@ TEST_P(TestArray, throwErrors)

std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);


Expand Down
2 changes: 1 addition & 1 deletion tests/tier1/test_absolute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ TEST_P(TestAbsolute, execute)
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);

auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

auto gpu_input = cle::Array::create(10, 5, 3, 3, cle::dType::FLOAT, cle::mType::BUFFER, device);
Expand Down
2 changes: 1 addition & 1 deletion tests/tier1/test_add_image_and_scalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ TEST_P(TestAddImageAndScalar, execute)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

auto gpu_input = cle::Array::create(10, 5, 3, 3, cle::dType::FLOAT, cle::mType::BUFFER, device);
Expand Down
2 changes: 1 addition & 1 deletion tests/tier1/test_add_image_weighted.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ TEST_P(TestAddImagesWeighted, execute)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

auto gpu_input1 = cle::Array::create(10, 5, 3, 3, cle::dType::FLOAT, cle::mType::BUFFER, device);
Expand Down
2 changes: 1 addition & 1 deletion tests/tier1/test_binary_and.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ TEST_P(TestBinaryAND, execute)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

auto gpu_input1 = cle::Array::create(10, 5, 3, 3, cle::dType::UINT8, cle::mType::BUFFER, device);
Expand Down
2 changes: 1 addition & 1 deletion tests/tier1/test_binary_edge_detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ TEST_P(TestBinaryEdgeDetection, execute)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

auto gpu_input = cle::Array::create(6, 5, 3, 3, cle::dType::UINT8, cle::mType::BUFFER, device);
Expand Down
4 changes: 2 additions & 2 deletions tests/tier1/test_binary_inf_sup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ TEST_P(TestBinaryInfSup, infsup_2d)
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);

auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

auto gpu_input = cle::Array::create(14, 14, 1, 2, cle::dType::BINARY, cle::mType::BUFFER, device);
Expand All @@ -84,7 +84,7 @@ TEST_P(TestBinaryInfSup, infsup_3d)
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);

auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

auto gpu_input = cle::Array::create(10, 10, 5, 3, cle::dType::BINARY, cle::mType::BUFFER, device);
Expand Down
2 changes: 1 addition & 1 deletion tests/tier1/test_binary_not.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ TEST_P(TestBinaryNOT, execute)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

auto gpu_input = cle::Array::create(10, 5, 3, 3, cle::dType::UINT8, cle::mType::BUFFER, device);
Expand Down
2 changes: 1 addition & 1 deletion tests/tier1/test_binary_or.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ TEST_P(TestBinaryOR, execute)
{
std::string param = GetParam();
cle::BackendManager::getInstance().setBackend(param);
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");
auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "gpu");
device->setWaitToFinish(true);

auto gpu_input1 = cle::Array::create(10, 5, 3, 3, cle::dType::UINT8, cle::mType::BUFFER, device);
Expand Down
Loading

0 comments on commit 55fa5f7

Please sign in to comment.