Jump to content

Torsten

Community Newbie
  • Posts

    1
  • Joined

  • Last visited

Torsten's Achievements

Tiro

Tiro (1/14)

1

Reputation

  1. Hi there, it should be very easy to calculate several paths in parallel - but some functions used by Compute(Short)Path and themself use this PROFILE stuff which can be used only by the main thread. If that will get fixed it should be that easy (you need to add '-fopenmp' to LIBS/C(XX)FLAGS): Index: source/simulation2/components/CCmpPathfinder.cpp===================================================================--- source/simulation2/components/CCmpPathfinder.cpp (revision 14386)+++ source/simulation2/components/CCmpPathfinder.cpp (working copy)@@ -576,6 +578,7 @@ void CCmpPathfinder::ProcessLongRequests(const std::vector<AsyncLongPathRequest>& longRequests) {+ #pragma omp parallel for for (size_t i = 0; i < longRequests.size(); ++i) { const AsyncLongPathRequest& req = longRequests[i];@@ -582,12 +585,16 @@ Path path; ComputePath(req.x0, req.z0, req.goal, req.passClass, req.costClass, path); CMessagePathResult msg(req.ticket, path);- GetSimContext().GetComponentManager().PostMessage(req.notify, msg);+ #pragma omp critical+ {+ GetSimContext().GetComponentManager().PostMessage(req.notify, msg);+ } } } void CCmpPathfinder::ProcessShortRequests(const std::vector<AsyncShortPathRequest>& shortRequests) {+ #pragma omp parallel for for (size_t i = 0; i < shortRequests.size(); ++i) { const AsyncShortPathRequest& req = shortRequests[i];@@ -595,7 +602,10 @@ ControlGroupMovementObstructionFilter filter(req.avoidMovingUnits, req.group); ComputeShortPath(filter, req.x0, req.z0, req.r, req.range, req.goal, req.passClass, path); CMessagePathResult msg(req.ticket, path);- GetSimContext().GetComponentManager().PostMessage(req.notify, msg);+ #pragma omp critical+ {+ GetSimContext().GetComponentManager().PostMessage(req.notify, msg);+ } } }
×
×
  • Create New...