Updated tests to reflect manager tensor memory ownership
This commit is contained in:
parent
fc3d23d3f9
commit
4dedfadfef
10 changed files with 117 additions and 54 deletions
|
|
@ -14,7 +14,9 @@ TEST(TestOpTensorCopy, CopyDeviceToDeviceTensor)
|
|||
std::shared_ptr<kp::Tensor> tensorA{ new kp::Tensor(testVecA) };
|
||||
std::shared_ptr<kp::Tensor> tensorB{ new kp::Tensor(testVecB) };
|
||||
|
||||
mgr.evalOpDefault<kp::OpTensorCreate>({ tensorA, tensorB });
|
||||
mgr.rebuildTensors({ tensorA, tensorB });
|
||||
|
||||
mgr.evalOpDefault<kp::OpTensorSyncDevice>({ tensorA, tensorB });
|
||||
|
||||
EXPECT_TRUE(tensorA->isInit());
|
||||
EXPECT_TRUE(tensorB->isInit());
|
||||
|
|
@ -41,7 +43,9 @@ TEST(TestOpTensorCopy, CopyDeviceToDeviceTensorMulti)
|
|||
std::shared_ptr<kp::Tensor> tensorB{ new kp::Tensor(testVecB) };
|
||||
std::shared_ptr<kp::Tensor> tensorC{ new kp::Tensor(testVecC) };
|
||||
|
||||
mgr.evalOpDefault<kp::OpTensorCreate>({ tensorA, tensorB, tensorC });
|
||||
mgr.rebuildTensors({ tensorA, tensorB, tensorC });
|
||||
|
||||
mgr.evalOpDefault<kp::OpTensorSyncDevice>({ tensorA, tensorB });
|
||||
|
||||
EXPECT_TRUE(tensorA->isInit());
|
||||
EXPECT_TRUE(tensorB->isInit());
|
||||
|
|
@ -70,7 +74,10 @@ TEST(TestOpTensorCopy, CopyDeviceToHostTensor)
|
|||
std::shared_ptr<kp::Tensor> tensorB{ new kp::Tensor(
|
||||
testVecB, kp::Tensor::TensorTypes::eHost) };
|
||||
|
||||
mgr.evalOpDefault<kp::OpTensorCreate>({ tensorA, tensorB });
|
||||
mgr.rebuildTensors({ tensorA, tensorB });
|
||||
|
||||
// Only calling sync on device type tensor
|
||||
mgr.evalOpDefault<kp::OpTensorSyncDevice>({ tensorA });
|
||||
|
||||
EXPECT_TRUE(tensorA->isInit());
|
||||
EXPECT_TRUE(tensorB->isInit());
|
||||
|
|
@ -96,7 +103,10 @@ TEST(TestOpTensorCopy, CopyHostToDeviceTensor)
|
|||
testVecA, kp::Tensor::TensorTypes::eHost) };
|
||||
std::shared_ptr<kp::Tensor> tensorB{ new kp::Tensor(testVecB) };
|
||||
|
||||
mgr.evalOpDefault<kp::OpTensorCreate>({ tensorA, tensorB });
|
||||
mgr.rebuildTensors({ tensorA, tensorB });
|
||||
|
||||
// Only calling sync on device type tensor
|
||||
mgr.evalOpDefault<kp::OpTensorSyncDevice>({ tensorB });
|
||||
|
||||
EXPECT_TRUE(tensorA->isInit());
|
||||
EXPECT_TRUE(tensorB->isInit());
|
||||
|
|
@ -123,7 +133,9 @@ TEST(TestOpTensorCopy, CopyHostToHostTensor)
|
|||
std::shared_ptr<kp::Tensor> tensorB{ new kp::Tensor(
|
||||
testVecB, kp::Tensor::TensorTypes::eHost) };
|
||||
|
||||
mgr.evalOpDefault<kp::OpTensorCreate>({ tensorA, tensorB });
|
||||
mgr.rebuildTensors({ tensorA, tensorB });
|
||||
|
||||
// Not calling OpTensorSyncDevice
|
||||
|
||||
EXPECT_TRUE(tensorA->isInit());
|
||||
EXPECT_TRUE(tensorB->isInit());
|
||||
|
|
@ -147,7 +159,7 @@ TEST(TestOpTensorCopy, SingleTensorShouldFail)
|
|||
std::shared_ptr<kp::Tensor> tensorA{ new kp::Tensor(
|
||||
testVecA, kp::Tensor::TensorTypes::eHost) };
|
||||
|
||||
mgr.evalOpDefault<kp::OpTensorCreate>({ tensorA });
|
||||
mgr.rebuildTensors({ tensorA });
|
||||
|
||||
EXPECT_TRUE(tensorA->isInit());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue