diff --git a/examples/android/android-simple/app/src/main/cpp/KomputeModelML.cpp b/examples/android/android-simple/app/src/main/cpp/KomputeModelML.cpp index 3202764a..a7a18c84 100755 --- a/examples/android/android-simple/app/src/main/cpp/KomputeModelML.cpp +++ b/examples/android/android-simple/app/src/main/cpp/KomputeModelML.cpp @@ -41,15 +41,17 @@ void KomputeModelML::train(std::vector yData, std::vector xIData, { kp::Manager mgr; - if (std::shared_ptr sq = - mgr.getOrCreateManagedSequence("createTensors").lock()) { + { - sq->begin(); + std::shared_ptr sqTensor = + mgr.createManagedSequence().lock(); - sq->record(params); + sqTensor->begin(); + sqTensor->record(params); + sqTensor->end(); + sqTensor->eval(); - sq->end(); - sq->eval(); + std::shared_ptr sq = mgr.createManagedSequence().lock(); // Record op algo base sq->begin(); diff --git a/examples/godot_logistic_regression/custom_module/kompute_model_ml/KomputeModelMLNode.cpp b/examples/godot_logistic_regression/custom_module/kompute_model_ml/KomputeModelMLNode.cpp index f49fb12f..fe0a911a 100644 --- a/examples/godot_logistic_regression/custom_module/kompute_model_ml/KomputeModelMLNode.cpp +++ b/examples/godot_logistic_regression/custom_module/kompute_model_ml/KomputeModelMLNode.cpp @@ -50,15 +50,15 @@ void KomputeModelMLNode::train(Array yArr, Array xIArr, Array xJArr) { { kp::Manager mgr; - if (std::shared_ptr sq = - mgr.getOrCreateManagedSequence("createTensors").lock()) { + std::shared_ptr sqTensor = + mgr.createManagedSequence().lock(); - sq->begin(); - - sq->record(params); + sqTensor->begin(); + sqTensor->record(params); + sqTensor->end(); + sqTensor->eval(); - sq->end(); - sq->eval(); + std::shared_ptr sq = mgr.createManagedSequence().lock(); // Record op algo base sq->begin(); diff --git a/examples/godot_logistic_regression/gdnative_shared/src/KomputeModelML.cpp b/examples/godot_logistic_regression/gdnative_shared/src/KomputeModelML.cpp index 139ef67e..17439850 100644 --- a/examples/godot_logistic_regression/gdnative_shared/src/KomputeModelML.cpp +++ b/examples/godot_logistic_regression/gdnative_shared/src/KomputeModelML.cpp @@ -54,15 +54,16 @@ void KomputeModelML::train(Array yArr, Array xIArr, Array xJArr) { { kp::Manager mgr; - if (std::shared_ptr sq = - mgr.getOrCreateManagedSequence("createTensors").lock()) { + { + std::shared_ptr sqTensor = + mgr.createManagedSequence().lock(); - sq->begin(); - - sq->record(params); + sqTensor->begin(); + sqTensor->record(params); + sqTensor->end(); + sqTensor->eval(); - sq->end(); - sq->eval(); + std::shared_ptr sq = mgr.createManagedSequence().lock(); // Record op algo base sq->begin(); diff --git a/examples/logistic_regression/src/Main.cpp b/examples/logistic_regression/src/Main.cpp index 6198b17b..853fa9d6 100755 --- a/examples/logistic_regression/src/Main.cpp +++ b/examples/logistic_regression/src/Main.cpp @@ -35,15 +35,15 @@ int main() kp::Manager mgr; - std::weak_ptr sqWeakPtr = mgr.getOrCreateManagedSequence("createTensors"); - std::shared_ptr sq = sqWeakPtr.lock(); + std::shared_ptr sqTensor = + mgr.createManagedSequence().lock(); - sq->begin(); - - sq->record(params); + sqTensor->begin(); + sqTensor->record(params); + sqTensor->end(); + sqTensor->eval(); - sq->end(); - sq->eval(); + std::shared_ptr sq = mgr.createManagedSequence().lock(); // Record op algo base sq->begin(); diff --git a/single_include/kompute/Kompute.hpp b/single_include/kompute/Kompute.hpp index 31a3b8cc..a086093d 100755 --- a/single_include/kompute/Kompute.hpp +++ b/single_include/kompute/Kompute.hpp @@ -1310,7 +1310,8 @@ class Manager * Create a new managed Kompute sequence so it's available within the * manager. * - * @param sequenceName The name for the named sequence to be created, if empty then default indexed value is used + * @param sequenceName The name for the named sequence to be created, if + * empty then default indexed value is used * @param queueIndex The queue to use from the available queues * @return Weak pointer to the manager owned sequence resource */ @@ -1363,8 +1364,10 @@ class Manager { SPDLOG_DEBUG("Kompute Manager evalOp Default triggered"); this->mCurrentSequenceIndex++; - this->evalOp( - tensors, KP_DEFAULT_SESSION + std::to_string(this->mCurrentSequenceIndex), std::forward(params)...); + this->evalOp(tensors, + KP_DEFAULT_SESSION + + std::to_string(this->mCurrentSequenceIndex), + std::forward(params)...); } /** @@ -1406,7 +1409,8 @@ class Manager } /** - * Operation that evaluates operation against default sequence asynchronously. + * Operation that evaluates operation against default sequence + * asynchronously. * * @param tensors The tensors to be used in the operation recorded * @param params Template parameters that will be used to initialise @@ -1414,12 +1418,14 @@ class Manager */ template void evalOpAsyncDefault(std::vector> tensors, - TArgs&&... params) + TArgs&&... params) { SPDLOG_DEBUG("Kompute Manager evalOpAsyncDefault triggered"); this->mCurrentSequenceIndex++; - this->evalOpAsync( - tensors, KP_DEFAULT_SESSION + std::to_string(this->mCurrentSequenceIndex), std::forward(params)...); + this->evalOpAsync(tensors, + KP_DEFAULT_SESSION + + std::to_string(this->mCurrentSequenceIndex), + std::forward(params)...); } /** @@ -1430,7 +1436,8 @@ class Manager */ void evalOpAwait(std::string sequenceName, uint64_t waitFor = UINT64_MAX) { - SPDLOG_DEBUG("Kompute Manager evalOpAwait triggered with sequence {}", sequenceName); + SPDLOG_DEBUG("Kompute Manager evalOpAwait triggered with sequence {}", + sequenceName); std::unordered_map>::iterator found = this->mManagedSequences.find(sequenceName); @@ -1459,7 +1466,9 @@ class Manager void evalOpAwaitDefault(uint64_t waitFor = UINT64_MAX) { SPDLOG_DEBUG("Kompute Manager evalOpAwaitDefault triggered"); - this->evalOpAwait(KP_DEFAULT_SESSION + std::to_string(this->mCurrentSequenceIndex), waitFor); + this->evalOpAwait(KP_DEFAULT_SESSION + + std::to_string(this->mCurrentSequenceIndex), + waitFor); } /**