Wrapper into WrapperT with Wrapper class

This commit is contained in:
gineshidalgo99
2018-09-26 20:28:09 -04:00
parent fd566ce918
commit 25a05f5e9d
24 changed files with 195 additions and 178 deletions
@@ -1,4 +1,4 @@
// ------------------------- OpenPose API Tutorial - Example 1 - Body from image -------------------------
// ----------------------------- OpenPose C++ API Tutorial - Example 1 - Body from image -----------------------------
// It reads an image, process it, and displays it with the pose keypoints.
// Command-line user intraface
@@ -69,7 +69,7 @@ int bodyFromImage()
// Configuring OpenPose
op::log("Configuring OpenPose...", op::Priority::High);
op::Wrapper<std::vector<op::Datum>> opWrapper{op::ThreadManagerMode::Asynchronous};
op::Wrapper opWrapper{op::ThreadManagerMode::Asynchronous};
// Set to single-thread (for sequential processing and/or debugging and/or reducing latency)
if (FLAGS_disable_multi_thread)
opWrapper.disableMultiThreading();
@@ -1,4 +1,4 @@
// ------------------------- OpenPose API Tutorial - Example 2 - Whole body from image -------------------------
// -------------------------- OpenPose C++ API Tutorial - Example 2 - Whole body from image --------------------------
// It reads an image, process it, and displays it with the pose, hand, and face keypoints.
// Command-line user intraface
@@ -48,7 +48,7 @@ int wholeBodyFromImage()
// Configuring OpenPose
op::log("Configuring OpenPose...", op::Priority::High);
op::Wrapper<std::vector<op::Datum>> opWrapper{op::ThreadManagerMode::Asynchronous};
op::Wrapper opWrapper{op::ThreadManagerMode::Asynchronous};
// Add hand and face
opWrapper.configure(op::WrapperStructFace{true});
opWrapper.configure(op::WrapperStructHand{true});
@@ -1,4 +1,4 @@
// ------------------------- OpenPose API Tutorial - Example 3 - Body from image configurable -------------------------
// ----------------------- OpenPose C++ API Tutorial - Example 3 - Body from image configurable -----------------------
// It reads an image, process it, and displays it with the pose (and optionally hand and face) keypoints. In addition,
// it includes all the OpenPose configuration flags (enable/disable hand, face, output saving, etc.).
@@ -84,7 +84,7 @@ int wholeBodyFromImage()
// Configuring OpenPose
op::log("Configuring OpenPose...", op::Priority::High);
op::Wrapper<std::vector<op::Datum>> opWrapper{op::ThreadManagerMode::Asynchronous};
op::Wrapper opWrapper{op::ThreadManagerMode::Asynchronous};
// Pose configuration (use WrapperStructPose{} for default and recommended configuration)
const op::WrapperStructPose wrapperStructPose{
!FLAGS_body_disable, netInputSize, outputSize, keypointScale, FLAGS_num_gpu, FLAGS_num_gpu_start,
@@ -1,4 +1,4 @@
// ------------------------- OpenPose Library Tutorial - Wrapper - Example 1 - Asynchronous -------------------------
// ------------------------- OpenPose C++ API Tutorial - Example 4 - Custom Input and Output -------------------------
// Asynchronous mode: ideal for fast prototyping when performance is not an issue. The user emplaces/pushes and pops frames from the OpenPose wrapper
// when he desires to.
@@ -27,9 +27,9 @@
DEFINE_string(image_dir, "examples/media/",
"Process a directory of images. Read all standard formats (jpg, png, bmp, etc.).");
// If the user needs his own variables, he can inherit the op::Datum struct and add them
// UserDatum can be directly used by the OpenPose wrapper because it inherits from op::Datum, just define Wrapper<UserDatum> instead of
// Wrapper<op::Datum>
// If the user needs his own variables, he can inherit the op::Datum struct and add them in there.
// UserDatum can be directly used by the OpenPose wrapper because it inherits from op::Datum, just define
// WrapperT<std::vector<UserDatum>> instead of Wrapper (or equivalently WrapperT<std::vector<UserDatum>>)
struct UserDatum : public op::Datum
{
bool boolThatUserNeedsForSomeReason;
@@ -176,7 +176,7 @@ public:
}
};
int openPoseTutorialWrapper3()
int example4()
{
try
{
@@ -219,7 +219,7 @@ int openPoseTutorialWrapper3()
// Configure OpenPose
op::log("Configuring OpenPose wrapper...", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__);
op::Wrapper<std::vector<UserDatum>> opWrapper{op::ThreadManagerMode::Asynchronous};
op::WrapperT<std::vector<UserDatum>> opWrapperT{op::ThreadManagerMode::Asynchronous};
// Pose configuration (use WrapperStructPose{} for default and recommended configuration)
const op::WrapperStructPose wrapperStructPose{
!FLAGS_body_disable, netInputSize, outputSize, keypointScale, FLAGS_num_gpu, FLAGS_num_gpu_start,
@@ -250,14 +250,14 @@ int openPoseTutorialWrapper3()
FLAGS_camera_fps, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_adam,
FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port};
// Configure wrapper
opWrapper.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructExtra,
opWrapperT.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructExtra,
op::WrapperStructInput{}, wrapperStructOutput);
// Set to single-thread (for sequential processing and/or debugging and/or reducing latency)
if (FLAGS_disable_multi_thread)
opWrapper.disableMultiThreading();
opWrapperT.disableMultiThreading();
op::log("Starting thread(s)...", op::Priority::High);
opWrapper.start();
opWrapperT.start();
// User processing
UserInputClass userInputClass(FLAGS_image_dir);
@@ -269,10 +269,10 @@ int openPoseTutorialWrapper3()
auto datumToProcess = userInputClass.createDatum();
if (datumToProcess != nullptr)
{
auto successfullyEmplaced = opWrapper.waitAndEmplace(datumToProcess);
auto successfullyEmplaced = opWrapperT.waitAndEmplace(datumToProcess);
// Pop frame
std::shared_ptr<std::vector<UserDatum>> datumProcessed;
if (successfullyEmplaced && opWrapper.waitAndPop(datumProcessed))
if (successfullyEmplaced && opWrapperT.waitAndPop(datumProcessed))
{
userWantsToExit = userOutputClass.display(datumProcessed);
userOutputClass.printKeypoints(datumProcessed);
@@ -284,7 +284,7 @@ int openPoseTutorialWrapper3()
}
op::log("Stopping thread(s)", op::Priority::High);
opWrapper.stop();
opWrapperT.stop();
// Measuring total time
const auto now = std::chrono::high_resolution_clock::now();
@@ -309,6 +309,6 @@ int main(int argc, char *argv[])
// Parsing command line flags
gflags::ParseCommandLineFlags(&argc, &argv, true);
// Running openPoseTutorialWrapper3
return openPoseTutorialWrapper3();
// Running example4
return example4();
}
@@ -1,6 +1,6 @@
// ------------------------- OpenPose Library Tutorial - Wrapper - Example 3 - Asynchronous Output -------------------------
// Asynchronous output mode: ideal for fast prototyping when performance is not an issue and user wants to use the output OpenPose format. The user
// simply gets the processed frames from the OpenPose wrapper when he desires to.
// ------------------------- OpenPose C++ API Tutorial - Example 5 - XXXXXXXXXXXXX -------------------------
// Asynchronous output mode: ideal for fast prototyping when performance is not an issue and user wants to use the
// output OpenPose format. The user simply gets the processed frames from the OpenPose wrapper when he desires to.
// This example shows the user how to use the OpenPose wrapper class:
// 1. Read folder of images / video / webcam
@@ -21,9 +21,9 @@
// OpenPose dependencies
#include <openpose/headers.hpp>
// If the user needs his own variables, he can inherit the op::Datum struct and add them
// If the user needs his own variables, he can inherit the op::Datum struct and add them in there.
// UserDatum can be directly used by the OpenPose wrapper because it inherits from op::Datum, just define
// Wrapper<UserDatum> instead of Wrapper<op::Datum>
// WrapperT<std::vector<UserDatum>> instead of Wrapper (or equivalently WrapperT<std::vector<UserDatum>>)
struct UserDatum : public op::Datum
{
bool boolThatUserNeedsForSomeReason;
@@ -160,7 +160,7 @@ int openPoseTutorialWrapper1()
// Configure OpenPose
op::log("Configuring OpenPose wrapper...", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__);
op::Wrapper<std::vector<UserDatum>> opWrapper{op::ThreadManagerMode::AsynchronousOut};
op::WrapperT<std::vector<UserDatum>> opWrapperT{op::ThreadManagerMode::AsynchronousOut};
// Pose configuration (use WrapperStructPose{} for default and recommended configuration)
const op::WrapperStructPose wrapperStructPose{
!FLAGS_body_disable, netInputSize, outputSize, keypointScale, FLAGS_num_gpu, FLAGS_num_gpu_start,
@@ -195,14 +195,14 @@ int openPoseTutorialWrapper1()
FLAGS_camera_fps, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_adam,
FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port};
// Configure wrapper
opWrapper.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructExtra,
opWrapperT.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructExtra,
wrapperStructInput, wrapperStructOutput);
// Set to single-thread (for sequential processing and/or debugging and/or reducing latency)
if (FLAGS_disable_multi_thread)
opWrapper.disableMultiThreading();
opWrapperT.disableMultiThreading();
op::log("Starting thread(s)...", op::Priority::High);
opWrapper.start();
opWrapperT.start();
// User processing
UserOutputClass userOutputClass;
@@ -211,7 +211,7 @@ int openPoseTutorialWrapper1()
{
// Pop frame
std::shared_ptr<std::vector<UserDatum>> datumProcessed;
if (opWrapper.waitAndPop(datumProcessed))
if (opWrapperT.waitAndPop(datumProcessed))
{
userWantsToExit = userOutputClass.display(datumProcessed);;
userOutputClass.printKeypoints(datumProcessed);
@@ -221,7 +221,7 @@ int openPoseTutorialWrapper1()
}
op::log("Stopping thread(s)", op::Priority::High);
opWrapper.stop();
opWrapperT.stop();
// Measuring total time
const auto now = std::chrono::high_resolution_clock::now();
@@ -1,4 +1,4 @@
// ------------------------- OpenPose Library Tutorial - Real Time Pose Estimation -------------------------
// ------------------------- OpenPose C++ API Tutorial - Example 6 - XXXXXXXXXXXXX -------------------------
// If the user wants to learn to use the OpenPose library, we highly recommend to start with the
// examples in `examples/tutorial_api_cpp/`.
// This example summarizes all the functionality of the OpenPose library:
@@ -21,9 +21,9 @@
// OpenPose dependencies
#include <openpose/headers.hpp>
// If the user needs his own variables, he can inherit the op::Datum struct and add them
// If the user needs his own variables, he can inherit the op::Datum struct and add them in there.
// UserDatum can be directly used by the OpenPose wrapper because it inherits from op::Datum, just define
// Wrapper<UserDatum> instead of Wrapper<op::Datum>
// WrapperT<std::vector<UserDatum>> instead of Wrapper (or equivalently WrapperT<std::vector<UserDatum>>)
struct UserDatum : public op::Datum
{
bool boolThatUserNeedsForSomeReason;
@@ -120,8 +120,7 @@ int openPoseDemo()
// OpenPose wrapper
op::log("Configuring OpenPose wrapper...", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__);
// op::Wrapper<std::vector<op::Datum>> opWrapper;
op::Wrapper<std::vector<UserDatum>> opWrapper;
op::WrapperT<std::vector<UserDatum>> opWrapper;
// Initializing the user custom classes
// Processing
@@ -1,4 +1,4 @@
// ------------------------- OpenPose Library Tutorial - Real Time Pose Estimation -------------------------
// ------------------------- OpenPose C++ API Tutorial - Example 7 - XXXXXXXXXXXXX -------------------------
// If the user wants to learn to use the OpenPose library, we highly recommend to start with the
// examples in `examples/tutorial_api_cpp/`.
// This example summarizes all the functionality of the OpenPose library:
@@ -27,9 +27,9 @@
DEFINE_string(image_dir, "examples/media/",
"Process a directory of images. Read all standard formats (jpg, png, bmp, etc.).");
// If the user needs his own variables, he can inherit the op::Datum struct and add them
// If the user needs his own variables, he can inherit the op::Datum struct and add them in there.
// UserDatum can be directly used by the OpenPose wrapper because it inherits from op::Datum, just define
// Wrapper<UserDatum> instead of Wrapper<op::Datum>
// WrapperT<std::vector<UserDatum>> instead of Wrapper (or equivalently WrapperT<std::vector<UserDatum>>)
struct UserDatum : public op::Datum
{
bool boolThatUserNeedsForSomeReason;
@@ -162,15 +162,14 @@ int openPoseDemo()
// OpenPose wrapper
op::log("Configuring OpenPose wrapper...", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__);
// op::Wrapper<std::vector<op::Datum>> opWrapper;
op::Wrapper<std::vector<UserDatum>> opWrapper;
op::WrapperT<std::vector<UserDatum>> opWrapperT;
// Initializing the user custom classes
// Frames producer (e.g. video, webcam, ...)
auto wUserInput = std::make_shared<WUserInput>(FLAGS_image_dir);
// Add custom processing
const auto workerInputOnNewThread = true;
opWrapper.setWorker(op::WorkerType::Input, wUserInput, workerInputOnNewThread);
opWrapperT.setWorker(op::WorkerType::Input, wUserInput, workerInputOnNewThread);
// Pose configuration (use WrapperStructPose{} for default and recommended configuration)
const op::WrapperStructPose wrapperStructPose{
@@ -205,17 +204,17 @@ int openPoseDemo()
FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port};
// Configure wrapper
opWrapper.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructExtra,
opWrapperT.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructExtra,
wrapperStructInput, wrapperStructOutput);
// Set to single-thread (for sequential processing and/or debugging and/or reducing latency)
if (FLAGS_disable_multi_thread)
opWrapper.disableMultiThreading();
opWrapperT.disableMultiThreading();
// Start processing
// Two different ways of running the program on multithread environment
op::log("Starting thread(s)...", op::Priority::High);
// Start, run & stop threads - it blocks this thread until all others have finished
opWrapper.exec();
opWrapperT.exec();
// // Option b) Keeping this thread free in case you want to do something else meanwhile, e.g. profiling the GPU
// memory
@@ -223,20 +222,20 @@ int openPoseDemo()
// // thread to plot visual results, so the final GUI (which uses OpenCV) would return an exception similar to:
// // `QMetaMethod::invoke: Unable to invoke methods with return values in queued connections`
// // Start threads
// opWrapper.start();
// opWrapperT.start();
// // Profile used GPU memory
// // 1: wait ~10sec so the memory has been totally loaded on GPU
// // 2: profile the GPU memory
// const auto sleepTimeMs = 10;
// for (auto i = 0 ; i < 10000/sleepTimeMs && opWrapper.isRunning() ; i++)
// for (auto i = 0 ; i < 10000/sleepTimeMs && opWrapperT.isRunning() ; i++)
// std::this_thread::sleep_for(std::chrono::milliseconds{sleepTimeMs});
// op::Profiler::profileGpuMemory(__LINE__, __FUNCTION__, __FILE__);
// // Keep program alive while running threads
// while (opWrapper.isRunning())
// while (opWrapperT.isRunning())
// std::this_thread::sleep_for(std::chrono::milliseconds{sleepTimeMs});
// // Stop and join threads
// op::log("Stopping thread(s)", op::Priority::High);
// opWrapper.stop();
// opWrapperT.stop();
// Measuring total time
const auto now = std::chrono::high_resolution_clock::now();
@@ -1,4 +1,4 @@
// ------------------------- OpenPose Library Tutorial - Real Time Pose Estimation -------------------------
// ------------------------- OpenPose C++ API Tutorial - Example 8 - XXXXXXXXXXXXX -------------------------
// If the user wants to learn to use the OpenPose library, we highly recommend to start with the
// examples in `examples/tutorial_api_cpp/`.
// This example summarizes all the functionality of the OpenPose library:
@@ -21,9 +21,9 @@
// OpenPose dependencies
#include <openpose/headers.hpp>
// If the user needs his own variables, he can inherit the op::Datum struct and add them
// If the user needs his own variables, he can inherit the op::Datum struct and add them in there.
// UserDatum can be directly used by the OpenPose wrapper because it inherits from op::Datum, just define
// Wrapper<UserDatum> instead of Wrapper<op::Datum>
// WrapperT<std::vector<UserDatum>> instead of Wrapper (or equivalently WrapperT<std::vector<UserDatum>>)
struct UserDatum : public op::Datum
{
bool boolThatUserNeedsForSomeReason;
@@ -167,15 +167,14 @@ int openPoseDemo()
// OpenPose wrapper
op::log("Configuring OpenPose wrapper...", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__);
// op::Wrapper<std::vector<op::Datum>> opWrapper;
op::Wrapper<std::vector<UserDatum>> opWrapper;
op::WrapperT<std::vector<UserDatum>> opWrapperT;
// Initializing the user custom classes
// GUI (Display)
auto wUserOutput = std::make_shared<WUserOutput>();
// Add custom processing
const auto workerOutputOnNewThread = true;
opWrapper.setWorker(op::WorkerType::Output, wUserOutput, workerOutputOnNewThread);
opWrapperT.setWorker(op::WorkerType::Output, wUserOutput, workerOutputOnNewThread);
// Pose configuration (use WrapperStructPose{} for default and recommended configuration)
const op::WrapperStructPose wrapperStructPose{
@@ -213,17 +212,17 @@ int openPoseDemo()
FLAGS_camera_fps, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_adam,
FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port};
// Configure wrapper
opWrapper.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructExtra,
opWrapperT.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructExtra,
wrapperStructInput, wrapperStructOutput);
// Set to single-thread (for sequential processing and/or debugging and/or reducing latency)
if (FLAGS_disable_multi_thread)
opWrapper.disableMultiThreading();
opWrapperT.disableMultiThreading();
// Start processing
// Two different ways of running the program on multithread environment
op::log("Starting thread(s)...", op::Priority::High);
// Start, run & stop threads - it blocks this thread until all others have finished
opWrapper.exec();
opWrapperT.exec();
// // Option b) Keeping this thread free in case you want to do something else meanwhile, e.g. profiling the GPU
// memory
@@ -231,20 +230,20 @@ int openPoseDemo()
// // thread to plot visual results, so the final GUI (which uses OpenCV) would return an exception similar to:
// // `QMetaMethod::invoke: Unable to invoke methods with return values in queued connections`
// // Start threads
// opWrapper.start();
// opWrapperT.start();
// // Profile used GPU memory
// // 1: wait ~10sec so the memory has been totally loaded on GPU
// // 2: profile the GPU memory
// const auto sleepTimeMs = 10;
// for (auto i = 0 ; i < 10000/sleepTimeMs && opWrapper.isRunning() ; i++)
// for (auto i = 0 ; i < 10000/sleepTimeMs && opWrapperT.isRunning() ; i++)
// std::this_thread::sleep_for(std::chrono::milliseconds{sleepTimeMs});
// op::Profiler::profileGpuMemory(__LINE__, __FUNCTION__, __FILE__);
// // Keep program alive while running threads
// while (opWrapper.isRunning())
// while (opWrapperT.isRunning())
// std::this_thread::sleep_for(std::chrono::milliseconds{sleepTimeMs});
// // Stop and join threads
// op::log("Stopping thread(s)", op::Priority::High);
// opWrapper.stop();
// opWrapperT.stop();
// Measuring total time
const auto now = std::chrono::high_resolution_clock::now();
@@ -1,4 +1,4 @@
// ------------------------- OpenPose Library Tutorial - Wrapper - Example 2 - Synchronous -------------------------
// ------------------------- OpenPose C++ API Tutorial - Example 9 - XXXXXXXXXXXXX -------------------------
// Synchronous mode: ideal for performance. The user can add his own frames producer / post-processor / consumer to the OpenPose wrapper or use the
// default ones.
@@ -27,9 +27,9 @@
DEFINE_string(image_dir, "examples/media/",
"Process a directory of images. Read all standard formats (jpg, png, bmp, etc.).");
// If the user needs his own variables, he can inherit the op::Datum struct and add them
// If the user needs his own variables, he can inherit the op::Datum struct and add them in there.
// UserDatum can be directly used by the OpenPose wrapper because it inherits from op::Datum, just define
// Wrapper<UserDatum> instead of Wrapper<op::Datum>
// WrapperT<std::vector<UserDatum>> instead of Wrapper (or equivalently WrapperT<std::vector<UserDatum>>)
struct UserDatum : public op::Datum
{
bool boolThatUserNeedsForSomeReason;
@@ -264,16 +264,16 @@ int openPoseTutorialWrapper2()
// GUI (Display)
auto wUserOutput = std::make_shared<WUserOutput>();
op::Wrapper<std::vector<UserDatum>> opWrapper;
op::WrapperT<std::vector<UserDatum>> opWrapperT;
// Add custom input
const auto workerInputOnNewThread = false;
opWrapper.setWorker(op::WorkerType::Input, wUserInput, workerInputOnNewThread);
opWrapperT.setWorker(op::WorkerType::Input, wUserInput, workerInputOnNewThread);
// Add custom processing
const auto workerProcessingOnNewThread = false;
opWrapper.setWorker(op::WorkerType::PostProcessing, wUserPostProcessing, workerProcessingOnNewThread);
opWrapperT.setWorker(op::WorkerType::PostProcessing, wUserPostProcessing, workerProcessingOnNewThread);
// Add custom output
const auto workerOutputOnNewThread = true;
opWrapper.setWorker(op::WorkerType::Output, wUserOutput, workerOutputOnNewThread);
opWrapperT.setWorker(op::WorkerType::Output, wUserOutput, workerOutputOnNewThread);
// Configure OpenPose
op::log("Configuring OpenPose wrapper...", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__);
const op::WrapperStructPose wrapperStructPose{
@@ -305,34 +305,34 @@ int openPoseTutorialWrapper2()
FLAGS_camera_fps, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_adam,
FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port};
// Configure wrapper
opWrapper.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructExtra,
opWrapperT.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructExtra,
op::WrapperStructInput{}, wrapperStructOutput);
// Set to single-thread (for sequential processing and/or debugging and/or reducing latency)
if (FLAGS_disable_multi_thread)
opWrapper.disableMultiThreading();
opWrapperT.disableMultiThreading();
op::log("Starting thread(s)...", op::Priority::High);
// Two different ways of running the program on multithread environment
// Start, run & stop threads - it blocks this thread until all others have finished
opWrapper.exec();
opWrapperT.exec();
// Option b) Keeping this thread free in case you want to do something else meanwhile, e.g. profiling the GPU memory
// // VERY IMPORTANT NOTE: if OpenCV is compiled with Qt support, this option will not work. Qt needs the main
// // thread to plot visual results, so the final GUI (which uses OpenCV) would return an exception similar to:
// // `QMetaMethod::invoke: Unable to invoke methods with return values in queued connections`
// // Start threads
// opWrapper.start();
// opWrapperT.start();
// // Profile used GPU memory
// // 1: wait ~10sec so the memory has been totally loaded on GPU
// // 2: profile the GPU memory
// std::this_thread::sleep_for(std::chrono::milliseconds{1000});
// op::log("Random task here...", op::Priority::High);
// // Keep program alive while running threads
// while (opWrapper.isRunning())
// while (opWrapperT.isRunning())
// std::this_thread::sleep_for(std::chrono::milliseconds{33});
// // Stop and join threads
// op::log("Stopping thread(s)", op::Priority::High);
// opWrapper.stop();
// opWrapperT.stop();
// Measuring total time
const auto now = std::chrono::high_resolution_clock::now();