Git Product home page Git Product logo

Comments (4)

hayakawa16 avatar hayakawa16 commented on June 7, 2024

There is renewed interest. In the link above, 2 methods are described: 1) Threadpool, 2) Parallel.For. I tried the Parallel.For because it is easy to add around the MonteCarloSimulation.cs for loop that loops over each photon.

I first tried on a linux 18 core, 2 threads per core machine. Without any code modifications N=1e6 photons took 1/2 hour to run. This machine utilizes the threads on its own and typically I see 8-12 threads being used during a simulation. With the code fix the code took 1.7 hours! Not sure why. I thought possibly the threading management was conflicting with the parallelized code somehow.

So I tried the same on a linux computer with 4 cores, no threads. Without the code fix N=1e6 took about an hour. With the code fix, the code compiles but the many unit tests fail.

The Threadpool requires a larger code modification. I will look into this method and continue searching for other options.

from vts.

dcuccia avatar dcuccia commented on June 7, 2024

Based on your last comment, it sounds like we can close this Item. As you discovered, I think the Task Parallel Library (TPL) probably isn't a great fit for "per-photon" parallelization, which is best suited for parallelizing "large" jobs. Seeking this level of performance from parallelization likely requires some significant work. Have we done any profiling of our code to identify the bottlenecks? Wonder if the biggest item is the RNG? Or the double-precision cosine calculations? Or perhaps the heap- and allocation-happy simulation structure? Lots to think about and explore!

from vts.

hayakawa16 avatar hayakawa16 commented on June 7, 2024

Yes, Lisa helping me with this task and we now have a command line option to run in parallel. Here is our current documentation:
https://github.com/VirtualPhotonics/Vts.MonteCarlo/wiki/MCCL-Parallel-Processing

from vts.

dcuccia avatar dcuccia commented on June 7, 2024

Neat! Thanks for sharing the link.

from vts.

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.