diff --git a/README.md b/README.md index 8b5d9fab4..5d897c6bd 100644 --- a/README.md +++ b/README.md @@ -152,25 +152,27 @@ int main() { std::shared_ptr tensorRHS{ new kp::Tensor( { 2.0, 4.0, 6.0 }) }; std::shared_ptr tensorOutput{ new kp::Tensor({ 0.0, 0.0, 0.0 }) }; - kp::Sequence sq = mgr.constructSequence(); - // Begin recoding commands - sq.begin(); + // Create a new sequence + std::weak_ptr sqWeakPtr = mgr.getOrCreateManagedSequence(); - // Record sequence of operations to be sent to GPU in batch + if (std::shared_ptr sq = sqWeakPtr.lock()) { + // Begin recording commands + sq.begin(); + + // Record batch commands to send to GPU sq.record({ tensorLHS }); sq.record({ tensorRHS }); sq.record({ tensorOutput }); - sq.record>({ tensorLHS, tensorRHS, tensorOutput }); + + // Stop recording + sq.end(); + + // Submit operations to GPU + sq.eval(); } - // Stop recording - sq.end(); - - // Submit operations to GPU - sq.eval(); - std::cout << fmt::format("Output: {}", tensorOutput.data()) << std::endl; } ```