# How to use multithread computation in the Garfield++

**URL:** <https://root-forum.cern.ch/t/how-to-use-multithread-computation-in-the-garfield/57593>\
**Category:** Garfield++\
**Created:** [December 19, 2023, 2:41am UTC](https://root-forum.cern.ch/t/how-to-use-multithread-computation-in-the-garfield/57593 "2023-12-19T02:41:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![XiCheng](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@XiCheng](https://root-forum.cern.ch/u/XiCheng)\
**Post date:** [December 19, 2023, 2:41am UTC](https://root-forum.cern.ch/t/how-to-use-multithread-computation-in-the-garfield/57593/1 "2023-12-19T02:41:18Z")

</div>

How to use multithread computation in the Garfield++ to improve the calculation efficiency. When the number of the particles are large enough, the calculation processing would be killed or very slow.

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/3/2/32d5893ee09e23282d764072c9c395f0da984607.png)

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [December 19, 2023, 7:43am UTC](https://root-forum.cern.ch/t/how-to-use-multithread-computation-in-the-garfield/57593/2 "2023-12-19T07:43:32Z")

</div>

I think @hschindl can help you.

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [December 26, 2023, 10:44am UTC](https://root-forum.cern.ch/t/how-to-use-multithread-computation-in-the-garfield/57593/3 "2023-12-26T10:44:33Z")

</div>

Sorry for the delay. You can use OpenMP to parallelize e. g. the simulation of electron drift lines/avalanches along a track as in [this example](https://gitlab.cern.ch/garfield/garfieldpp/-/blob/master/Examples/Tcad/pixel_mt.C?ref_type=heads) or [this example](https://gitlab.cern.ch/garfield/garfieldpp/-/blob/master/Examples/DriftTube/mdt_mt.C?ref_type=heads). It won’t help though if the program gets killed because of individual very large avalanches/running out of memory…

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [January 9, 2024, 10:45am UTC](https://root-forum.cern.ch/t/how-to-use-multithread-computation-in-the-garfield/57593/4 "2024-01-09T10:45:12Z")

</div>

Closed on January 9, 2024, 10:45am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
