Giter VIP home page Giter VIP logo

Comments (3)

smattheis avatar smattheis commented on September 4, 2024

Matcher and RoadMap are thread-safe in such a way that both are accessed read-only during map matching. However, Matcher is already running shortest path searches in parallel (data parallelism), i.e. for n candidates (sources) in t-1 and m candidates (targets) in t, it runs n SSMT shortest path searches in parallel (SSMT - single source multiple target); see line 246 and 295 in the Matcher class. The only non-thread-safe objects relevant during map matching are KState and MatcherKState, respectively.
To the best of my knowledge, 'more' parallelization of map matching of a single track requires non-trivial task parallelism, e.g., a parallel implementation of Dijkstra algorithm. However, processing multiple tracks in parallel is just data parallelism which is already implemented if you use the stand-alone server, see lines 252-261 in the Server class.
All in all, I don't see that much potential for trivial parallelization. You could check the speed-up of your application, if you set matcherNumThreads to one and to the number of virtual cores, respectively. If you use Barefoot as a library, run StaticScheduler.reset(1) and StaticScheduler.reset(p) where p is again the number of virtual cores before the map matching.
Finally, I would recommand to not use threads for further parallelization because it may conflict with Barefoot's internal work-stealing scheduler (planned to be extracted in a separate library in future), that provides (user-level) task parallelism with spawnand syncoperations as presented in Leiserson et al., Introduction to Algorithms, MIT Press, 3rd edition (see chapter 27).

from barefoot.

raethlo avatar raethlo commented on September 4, 2024

Thanks for such a thorough answer. The parallelism in my case is indeed needed to load separate traces in parallel and then match them, with a code something like so in the implementation of Runnable#run() method:

while (loader.next()){
    List<List<MatcherSample>> samples = loader.loadCurrentBatch();

    for (List<MatcherSample> trace : samples) {
        MatcherKState candidate_state = mapTrace(trace);
        saveRoadSpeeds(candidate_state.samples(), candidate_state.sequence());
    }
}

thanks for the reference to the Server class, will check that code and see if it can improve the design I currently have.

Cheers!

from barefoot.

smattheis avatar smattheis commented on September 4, 2024

In that case (batch processing), I would just start as many threads as you have cores available and run that code.

If you're having a Spark cluster available, you could check out this to run it on the cluster: scalable map matching.

from barefoot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.