diff --git a/test/TestAsyncOperations.cpp b/test/TestAsyncOperations.cpp index c43f56481..ddbcb6597 100644 --- a/test/TestAsyncOperations.cpp +++ b/test/TestAsyncOperations.cpp @@ -49,7 +49,7 @@ TEST(TestAsyncOperations, TestManagerParallelExecution) inputsSyncB.push_back(std::make_shared(kp::Tensor(data))); } - mgr.rebuildTensors(inputsSyncB); + mgr.rebuild(inputsSyncB); auto startSync = std::chrono::high_resolution_clock::now(); @@ -77,10 +77,10 @@ TEST(TestAsyncOperations, TestManagerParallelExecution) inputsAsyncB.push_back(std::make_shared(kp::Tensor(data))); } - mgrAsync.rebuildTensors(inputsAsyncB); + mgrAsync.rebuild(inputsAsyncB); for (uint32_t i = 0; i < numParallel; i++) { - mgrAsync.createManagedSequence("async" + std::to_string(i), i); + mgrAsync.sequence("async" + std::to_string(i), i); } auto startAsync = std::chrono::high_resolution_clock::now(); @@ -146,10 +146,10 @@ TEST(TestAsyncOperations, TestManagerAsyncExecution) std::shared_ptr tensorA{ new kp::Tensor(data) }; std::shared_ptr tensorB{ new kp::Tensor(data) }; - mgr.createManagedSequence("asyncOne"); - mgr.createManagedSequence("asyncTwo"); + mgr.sequence("asyncOne"); + mgr.sequence("asyncTwo"); - mgr.rebuildTensors({ tensorA, tensorB }); + mgr.rebuild({ tensorA, tensorB }); mgr.evalOpAsync( { tensorA }, "asyncOne", std::vector(shader.begin(), shader.end())); diff --git a/test/TestLogisticRegression.cpp b/test/TestLogisticRegression.cpp index a2b69505d..b974655a9 100644 --- a/test/TestLogisticRegression.cpp +++ b/test/TestLogisticRegression.cpp @@ -32,9 +32,9 @@ TEST(TestLogisticRegressionAlgorithm, TestMainLogisticRegression) { kp::Manager mgr; - mgr.rebuildTensors(params); + mgr.rebuild(params); - std::shared_ptr sq = mgr.createManagedSequence(); + std::shared_ptr sq = mgr.sequence(); // Record op algo base sq->begin(); @@ -117,9 +117,9 @@ TEST(TestLogisticRegressionAlgorithm, TestMainLogisticRegressionManualCopy) { kp::Manager mgr; - mgr.rebuildTensors(params); + mgr.rebuild(params); - std::shared_ptr sq = mgr.createManagedSequence(); + std::shared_ptr sq = mgr.sequence(); // Record op algo base sq->begin(); diff --git a/test/TestManager.cpp b/test/TestManager.cpp index 2bd7fc473..754941561 100644 --- a/test/TestManager.cpp +++ b/test/TestManager.cpp @@ -8,14 +8,14 @@ TEST(TestManager, EndToEndOpMultFlow) kp::Manager mgr; std::shared_ptr tensorLHS{ new kp::Tensor({ 0, 1, 2 }) }; - mgr.rebuildTensors({ tensorLHS }); + mgr.rebuild({ tensorLHS }); std::shared_ptr tensorRHS{ new kp::Tensor({ 2, 4, 6 }) }; - mgr.rebuildTensors({ tensorRHS }); + mgr.rebuild({ tensorRHS }); std::shared_ptr tensorOutput{ new kp::Tensor({ 0, 0, 0 }) }; - mgr.rebuildTensors({ tensorOutput }); + mgr.rebuild({ tensorOutput }); mgr.evalOpDefault({ tensorLHS, tensorRHS, tensorOutput }); @@ -36,10 +36,10 @@ TEST(TestManager, OpMultSequenceFlow) kp::Manager mgr; { - mgr.rebuildTensors({ tensorLHS, tensorRHS, tensorOutput }); + mgr.rebuild({ tensorLHS, tensorRHS, tensorOutput }); std::shared_ptr sq = - mgr.getOrCreateManagedSequence("newSequence"); + mgr.sequence("newSequence"); sq->begin(); @@ -59,16 +59,16 @@ TEST(TestManager, TestMultipleSequences) kp::Manager mgr; std::shared_ptr sqOne = - mgr.getOrCreateManagedSequence("sqOne"); + mgr.sequence("sqOne"); std::shared_ptr sqTwo = - mgr.getOrCreateManagedSequence("sqTwo"); + mgr.sequence("sqTwo"); std::shared_ptr sqOneRef = - mgr.getOrCreateManagedSequence("sqOne"); + mgr.sequence("sqOne"); std::shared_ptr sqTwoRef = - mgr.getOrCreateManagedSequence("sqTwo"); + mgr.sequence("sqTwo"); EXPECT_EQ(sqOne, sqOneRef); EXPECT_NE(sqTwo, sqOneRef); @@ -88,10 +88,10 @@ TEST(TestManager, TestMultipleTensorsAtOnce) kp::Manager mgr; std::shared_ptr sq = - mgr.getOrCreateManagedSequence("newSequence"); + mgr.sequence("newSequence"); { - mgr.rebuildTensors({ tensorLHS, tensorRHS, tensorOutput }); + mgr.rebuild({ tensorLHS, tensorRHS, tensorOutput }); EXPECT_TRUE(tensorLHS->isInit()); EXPECT_TRUE(tensorRHS->isInit()); @@ -114,8 +114,8 @@ TEST(TestManager, TestCreateInitTensor) { kp::Manager mgr; - std::shared_ptr tensorA = mgr.buildTensor({ 0, 1, 2 }); - std::shared_ptr tensorB = mgr.buildTensor({ 0, 0, 0 }); + std::shared_ptr tensorA = mgr.tensor({ 0, 1, 2 }); + std::shared_ptr tensorB = mgr.tensor({ 0, 0, 0 }); mgr.evalOpDefault({ tensorA, tensorB }); @@ -124,7 +124,7 @@ TEST(TestManager, TestCreateInitTensor) EXPECT_EQ(tensorB->data(), std::vector({ 0, 1, 2 })); std::shared_ptr tensorC = - mgr.buildTensor({ 0, 0, 0 }, kp::Tensor::TensorTypes::eHost); + mgr.tensor({ 0, 0, 0 }, kp::Tensor::TensorTypes::eHost); mgr.evalOpDefault({ tensorA, tensorC }); diff --git a/test/TestMultipleAlgoExecutions.cpp b/test/TestMultipleAlgoExecutions.cpp index b6eaea540..63f9778b0 100644 --- a/test/TestMultipleAlgoExecutions.cpp +++ b/test/TestMultipleAlgoExecutions.cpp @@ -19,10 +19,10 @@ TEST(TestMultipleAlgoExecutions, SingleSequenceRecord) pa[index] = pa[index] + 1; })"); - mgr.rebuildTensors({ tensorA }); + mgr.rebuild({ tensorA }); std::shared_ptr sq = - mgr.getOrCreateManagedSequence("newSequence"); + mgr.sequence("newSequence"); { sq->begin(); @@ -58,11 +58,11 @@ TEST(TestMultipleAlgoExecutions, MultipleCmdBufRecords) pa[index] = pa[index] + 1; })"); - mgr.rebuildTensors({ tensorA }, false); + mgr.rebuild({ tensorA }, false); - std::shared_ptr sqTensor = mgr.createManagedSequence(); + std::shared_ptr sqTensor = mgr.sequence(); - std::shared_ptr sq = mgr.createManagedSequence(); + std::shared_ptr sq = mgr.sequence(); // First create the tensor in a separate sequence sqTensor->begin(); @@ -113,11 +113,11 @@ TEST(TestMultipleAlgoExecutions, MultipleSequences) pa[index] = pa[index] + 1; })"); - mgr.rebuildTensors({ tensorA }); + mgr.rebuild({ tensorA }); { std::shared_ptr sq = - mgr.getOrCreateManagedSequence("newSequence"); + mgr.sequence("newSequence"); sq->begin(); @@ -130,7 +130,7 @@ TEST(TestMultipleAlgoExecutions, MultipleSequences) { std::shared_ptr sq = - mgr.getOrCreateManagedSequence("newSequence2"); + mgr.sequence("newSequence2"); sq->begin(); @@ -143,7 +143,7 @@ TEST(TestMultipleAlgoExecutions, MultipleSequences) { std::shared_ptr sq = - mgr.getOrCreateManagedSequence("newSequence3"); + mgr.sequence("newSequence3"); sq->begin(); @@ -156,7 +156,7 @@ TEST(TestMultipleAlgoExecutions, MultipleSequences) { std::shared_ptr sq = - mgr.getOrCreateManagedSequence("newSequence5"); + mgr.sequence("newSequence5"); sq->begin(); @@ -185,11 +185,11 @@ TEST(TestMultipleAlgoExecutions, SingleRecordMultipleEval) pa[index] = pa[index] + 1; })"); - mgr.rebuildTensors({ tensorA }, false); + mgr.rebuild({ tensorA }, false); { std::shared_ptr sq = - mgr.getOrCreateManagedSequence("newSequence"); + mgr.sequence("newSequence"); sq->begin(); @@ -201,7 +201,7 @@ TEST(TestMultipleAlgoExecutions, SingleRecordMultipleEval) { std::shared_ptr sq = - mgr.getOrCreateManagedSequence("newSequence2"); + mgr.sequence("newSequence2"); sq->begin(); @@ -217,7 +217,7 @@ TEST(TestMultipleAlgoExecutions, SingleRecordMultipleEval) { std::shared_ptr sq = - mgr.getOrCreateManagedSequence("newSequence3"); + mgr.sequence("newSequence3"); sq->begin(); @@ -242,7 +242,7 @@ TEST(TestMultipleAlgoExecutions, ManagerEvalMultSourceStrOpCreate) std::shared_ptr tensorInB{ new kp::Tensor({ 0.0, 1.0, 2.0 }) }; std::shared_ptr tensorOut{ new kp::Tensor({ 0.0, 0.0, 0.0 }) }; - mgr.rebuildTensors({ tensorInA, tensorInB, tensorOut }); + mgr.rebuild({ tensorInA, tensorInB, tensorOut }); std::string shader(R"( // The version to use @@ -277,11 +277,11 @@ TEST(TestMultipleAlgoExecutions, ManagerEvalMultSourceStrMgrCreate) kp::Manager mgr; - auto tensorInA = mgr.buildTensor( + auto tensorInA = mgr.tensor( { 2.0, 4.0, 6.0 }, kp::Tensor::TensorTypes::eDevice, false); - auto tensorInB = mgr.buildTensor( + auto tensorInB = mgr.tensor( { 0.0, 1.0, 2.0 }, kp::Tensor::TensorTypes::eDevice, false); - auto tensorOut = mgr.buildTensor( + auto tensorOut = mgr.tensor( { 0.0, 0.0, 0.0 }, kp::Tensor::TensorTypes::eDevice, false); std::string shader(R"( @@ -334,9 +334,9 @@ TEST(TestMultipleAlgoExecutions, SequenceAlgoDestroyOutsideManagerScope) { kp::Manager mgr; - mgr.rebuildTensors({ tensorA }); + mgr.rebuild({ tensorA }); - sq = mgr.createManagedSequence(); + sq = mgr.sequence(); sq->begin(); sq->record( diff --git a/test/TestOpAlgoLoopsPassingData.cpp b/test/TestOpAlgoLoopsPassingData.cpp index 63bab299d..c2431bc4d 100644 --- a/test/TestOpAlgoLoopsPassingData.cpp +++ b/test/TestOpAlgoLoopsPassingData.cpp @@ -30,11 +30,11 @@ TEST(TestProcessingIterations, IterateThroughMultipleSumAndCopies) } )"); - mgr.rebuildTensors({ tensorA, tensorB }, false); + mgr.rebuild({ tensorA, tensorB }, false); { std::shared_ptr sq = - mgr.getOrCreateManagedSequence("default"); + mgr.sequence("default"); sq->begin(); @@ -47,7 +47,7 @@ TEST(TestProcessingIterations, IterateThroughMultipleSumAndCopies) { std::shared_ptr sq = - mgr.getOrCreateManagedSequence("run"); + mgr.sequence("run"); sq->begin(); @@ -65,7 +65,7 @@ TEST(TestProcessingIterations, IterateThroughMultipleSumAndCopies) { std::shared_ptr sq = - mgr.getOrCreateManagedSequence("export"); + mgr.sequence("export"); sq->begin(); diff --git a/test/TestOpShadersFromStringAndFile.cpp b/test/TestOpShadersFromStringAndFile.cpp index 7d73bd7ff..ae2bfce15 100644 --- a/test/TestOpShadersFromStringAndFile.cpp +++ b/test/TestOpShadersFromStringAndFile.cpp @@ -11,7 +11,7 @@ TEST(TestOpAlgoBase, ShaderRawDataFromConstructor) std::shared_ptr tensorA{ new kp::Tensor({ 3, 4, 5 }) }; std::shared_ptr tensorB{ new kp::Tensor({ 0, 0, 0 }) }; - mgr.rebuildTensors({ tensorA, tensorB }); + mgr.rebuild({ tensorA, tensorB }); std::string shader(R"( #version 450 @@ -43,7 +43,7 @@ TEST(TestOpAlgoBase, ShaderCompiledDataFromConstructor) std::shared_ptr tensorA{ new kp::Tensor({ 3, 4, 5 }) }; std::shared_ptr tensorB{ new kp::Tensor({ 0, 0, 0 }) }; - mgr.rebuildTensors({ tensorA, tensorB }); + mgr.rebuild({ tensorA, tensorB }); mgr.evalOpDefault( { tensorA, tensorB }, @@ -65,7 +65,7 @@ TEST(TestOpAlgoBase, ShaderRawDataFromFile) std::shared_ptr tensorA{ new kp::Tensor({ 3, 4, 5 }) }; std::shared_ptr tensorB{ new kp::Tensor({ 0, 0, 0 }) }; - mgr.rebuildTensors({ tensorA, tensorB }); + mgr.rebuild({ tensorA, tensorB }); mgr.evalOpDefault( { tensorA, tensorB }, "test/shaders/glsl/test_op_custom_shader.comp"); @@ -82,7 +82,7 @@ TEST(TestOpAlgoBase, ShaderCompiledDataFromFile) std::shared_ptr tensorA{ new kp::Tensor({ 3, 4, 5 }) }; std::shared_ptr tensorB{ new kp::Tensor({ 0, 0, 0 }) }; - mgr.rebuildTensors({ tensorA, tensorB }); + mgr.rebuild({ tensorA, tensorB }); mgr.evalOpDefault( { tensorA, tensorB }, "test/shaders/glsl/test_op_custom_shader.comp.spv"); diff --git a/test/TestOpTensorCopy.cpp b/test/TestOpTensorCopy.cpp index ca4539d6b..7b0641070 100644 --- a/test/TestOpTensorCopy.cpp +++ b/test/TestOpTensorCopy.cpp @@ -14,7 +14,7 @@ TEST(TestOpTensorCopy, CopyDeviceToDeviceTensor) std::shared_ptr tensorA{ new kp::Tensor(testVecA) }; std::shared_ptr tensorB{ new kp::Tensor(testVecB) }; - mgr.rebuildTensors({ tensorA, tensorB }); + mgr.rebuild({ tensorA, tensorB }); EXPECT_TRUE(tensorA->isInit()); EXPECT_TRUE(tensorB->isInit()); @@ -41,7 +41,7 @@ TEST(TestOpTensorCopy, CopyDeviceToDeviceTensorMulti) std::shared_ptr tensorB{ new kp::Tensor(testVecB) }; std::shared_ptr tensorC{ new kp::Tensor(testVecC) }; - mgr.rebuildTensors({ tensorA, tensorB, tensorC }); + mgr.rebuild({ tensorA, tensorB, tensorC }); EXPECT_TRUE(tensorA->isInit()); EXPECT_TRUE(tensorB->isInit()); @@ -70,7 +70,7 @@ TEST(TestOpTensorCopy, CopyDeviceToHostTensor) std::shared_ptr tensorB{ new kp::Tensor( testVecB, kp::Tensor::TensorTypes::eHost) }; - mgr.rebuildTensors({ tensorA, tensorB }, false); + mgr.rebuild({ tensorA, tensorB }, false); // Only calling sync on device type tensor mgr.evalOpDefault({ tensorA }); @@ -99,7 +99,7 @@ TEST(TestOpTensorCopy, CopyHostToDeviceTensor) testVecA, kp::Tensor::TensorTypes::eHost) }; std::shared_ptr tensorB{ new kp::Tensor(testVecB) }; - mgr.rebuildTensors({ tensorA, tensorB }, false); + mgr.rebuild({ tensorA, tensorB }, false); // Only calling sync on device type tensor mgr.evalOpDefault({ tensorB }); @@ -129,7 +129,7 @@ TEST(TestOpTensorCopy, CopyHostToHostTensor) std::shared_ptr tensorB{ new kp::Tensor( testVecB, kp::Tensor::TensorTypes::eHost) }; - mgr.rebuildTensors({ tensorA, tensorB }); + mgr.rebuild({ tensorA, tensorB }); EXPECT_TRUE(tensorA->isInit()); EXPECT_TRUE(tensorB->isInit()); @@ -153,7 +153,7 @@ TEST(TestOpTensorCopy, SingleTensorShouldFail) std::shared_ptr tensorA{ new kp::Tensor( testVecA, kp::Tensor::TensorTypes::eHost) }; - mgr.rebuildTensors({ tensorA }, false); + mgr.rebuild({ tensorA }, false); EXPECT_TRUE(tensorA->isInit()); diff --git a/test/TestOpTensorCreate.cpp b/test/TestOpTensorCreate.cpp index c1dd200f6..ca3473576 100644 --- a/test/TestOpTensorCreate.cpp +++ b/test/TestOpTensorCreate.cpp @@ -11,7 +11,7 @@ TEST(TestOpTensorCreate, CreateSingleTensorSingleOp) { kp::Manager mgr; - mgr.rebuildTensors({ tensorA }); + mgr.rebuild({ tensorA }); EXPECT_TRUE(tensorA->isInit()); @@ -32,7 +32,7 @@ TEST(TestOpTensorCreate, CreateMultipleTensorSingleOp) std::shared_ptr tensorA{ new kp::Tensor(testVecA) }; std::shared_ptr tensorB{ new kp::Tensor(testVecB) }; - mgr.rebuildTensors({ tensorA, tensorB }); + mgr.rebuild({ tensorA, tensorB }); EXPECT_TRUE(tensorA->isInit()); EXPECT_TRUE(tensorB->isInit()); @@ -52,8 +52,8 @@ TEST(TestOpTensorCreate, CreateMultipleTensorMultipleOp) std::shared_ptr tensorA{ new kp::Tensor(testVecA) }; std::shared_ptr tensorB{ new kp::Tensor(testVecB) }; - mgr.rebuildTensors({ tensorA }); - mgr.rebuildTensors({ tensorB }); + mgr.rebuild({ tensorA }); + mgr.rebuild({ tensorB }); EXPECT_TRUE(tensorA->isInit()); EXPECT_TRUE(tensorB->isInit()); @@ -73,8 +73,8 @@ TEST(TestOpTensorCreate, TestTensorMemoryManagedByManagerDestroyed) { kp::Manager mgr; - mgr.rebuildTensors({ tensorA }); - mgr.rebuildTensors({ tensorB }); + mgr.rebuild({ tensorA }); + mgr.rebuild({ tensorB }); EXPECT_TRUE(tensorA->isInit()); EXPECT_TRUE(tensorB->isInit()); @@ -99,8 +99,8 @@ TEST(TestOpTensorCreate, TestTensorMemoryManagedByManagerNOTDestroyed) kp::Manager mgr; { - mgr.rebuildTensors({ tensorA }); - mgr.rebuildTensors({ tensorB }); + mgr.rebuild({ tensorA }); + mgr.rebuild({ tensorB }); EXPECT_TRUE(tensorA->isInit()); EXPECT_TRUE(tensorB->isInit()); @@ -124,8 +124,8 @@ TEST(TestOpTensorCreate, NoErrorIfTensorFreedBefore) kp::Manager mgr; - mgr.rebuildTensors({ tensorA }); - mgr.rebuildTensors({ tensorB }); + mgr.rebuild({ tensorA }); + mgr.rebuild({ tensorB }); EXPECT_TRUE(tensorA->isInit()); EXPECT_TRUE(tensorB->isInit()); @@ -148,7 +148,7 @@ TEST(TestOpTensorCreate, ExceptionOnZeroSizeTensor) kp::Manager mgr; try { - mgr.rebuildTensors({ tensorA }); + mgr.rebuild({ tensorA }); } catch (const std::runtime_error& err) { // check exception ASSERT_TRUE(std::string(err.what()).find("zero-sized") != diff --git a/test/TestOpTensorSync.cpp b/test/TestOpTensorSync.cpp index 9080194af..f992805f5 100644 --- a/test/TestOpTensorSync.cpp +++ b/test/TestOpTensorSync.cpp @@ -13,7 +13,7 @@ TEST(TestOpTensorSync, SyncToDeviceMemorySingleTensor) std::shared_ptr tensorA{ new kp::Tensor(testVecPreA) }; - mgr.rebuildTensors({ tensorA }, false); + mgr.rebuild({ tensorA }, false); EXPECT_TRUE(tensorA->isInit()); @@ -37,7 +37,7 @@ TEST(TestOpTensorSync, SyncToDeviceMemoryMultiTensor) std::shared_ptr tensorB{ new kp::Tensor({ 0, 0, 0 }) }; std::shared_ptr tensorC{ new kp::Tensor({ 0, 0, 0 }) }; - mgr.rebuildTensors({ tensorA, tensorB, tensorC }, false); + mgr.rebuild({ tensorA, tensorB, tensorC }, false); EXPECT_TRUE(tensorA->isInit()); EXPECT_TRUE(tensorB->isInit()); diff --git a/test/TestSequence.cpp b/test/TestSequence.cpp index 2d0a8a4b7..0dec484b5 100644 --- a/test/TestSequence.cpp +++ b/test/TestSequence.cpp @@ -9,7 +9,7 @@ TEST(TestSequence, CmdBufSequenceBeginEnd) { std::shared_ptr sq = - mgr.getOrCreateManagedSequence("newSequence"); + mgr.sequence("newSequence"); EXPECT_TRUE(sq->eval()); EXPECT_TRUE(!sq->isRecording()); @@ -32,7 +32,7 @@ TEST(TestSequence, SequenceDestructorViaManager) { kp::Manager mgr; - sq = mgr.getOrCreateManagedSequence("newSequence"); + sq = mgr.sequence("newSequence"); EXPECT_TRUE(sq->isInit()); } diff --git a/test/TestTensor.cpp b/test/TestTensor.cpp index 7ceea1ba7..705c825f7 100644 --- a/test/TestTensor.cpp +++ b/test/TestTensor.cpp @@ -23,10 +23,10 @@ TEST(TestTensor, CopyFromHostData) kp::Manager mgr; - mgr.rebuildTensors({ tensorA, tensorB }); + mgr.rebuild({ tensorA, tensorB }); if (std::shared_ptr sq = - mgr.getOrCreateManagedSequence("new")) { + mgr.sequence("new")) { sq->begin(); sq->record({ tensorA, tensorB });