Skip to content

Commit

Permalink
w4
Browse files Browse the repository at this point in the history
  • Loading branch information
jslee02 committed Jun 4, 2024
1 parent 38b0c52 commit ef25b7f
Showing 1 changed file with 0 additions and 56 deletions.
56 changes: 0 additions & 56 deletions dart/constraint/BoxedLcpConstraintSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,62 +561,6 @@ void BoxedLcpConstraintSolver::solveConstrainedGroups()
}

// Solve problems
// for (auto i = 0u; i < numGroups; ++i) {
// solveBoxedLcp(mProblems[i], mConstrainedGroups[i]);
// }

// Solve problems in multi-thread using std::thread
// std::vector<std::thread> threads;
// threads.reserve(numGroups);

// for (auto i = 0u; i < numGroups; ++i) {
// // Capture `i` by value to ensure each thread uses the correct index
// threads.emplace_back(
// [this, i]() { solveBoxedLcp(mProblems[i], mConstrainedGroups[i]); });
// }

// // Join threads
// for (auto& thread : threads) {
// if (thread.joinable()) {
// thread.join();
// }
// }

// {
// DART_PROFILE_SCOPED;

// // Determine the number of available cores
// // const unsigned int numThreads = std::thread::hardware_concurrency();
// const unsigned int numThreads = 16;

// // Use futures and async to manage the tasks
// std::vector<std::future<void>> futures;

// for (auto i = 0u; i < numGroups; ++i) {
// // Check if we've reached the concurrency limit
// if (futures.size() >= numThreads) {
// // Wait for one of the futures to finish
// for (auto& fut : futures) {
// if (fut.wait_for(std::chrono::seconds(0))
// == std::future_status::ready) {
// fut.get(); // Clear the completed future
// break; // Break the loop to add a new task
// }
// }
// }

// // Launch a new task
// futures.push_back(std::async(std::launch::async, [this, i]() {
// solveBoxedLcp(mProblems[i], mConstrainedGroups[i]);
// }));
// }

// // Ensure all tasks are completed
// for (auto& fut : futures) {
// fut.get();
// }
// }

{
DART_PROFILE_SCOPED_N("Solve problems");
mTaskflow.for_each_index(0, numGroups, 1, [&](int i) {
Expand Down

0 comments on commit ef25b7f

Please sign in to comment.