| Summary: | Event biasing creates a data race which leads to erratic behaviour in MT mode | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | alexander.howard |
| Component: | geometry/biasing | Assignee: | alexander.howard |
| Status: | CLOSED FIXED | ||
| Severity: | normal | CC: | jverburg |
| Priority: | P4 | ||
| Version: | 10.3 | ||
| Hardware: | All | ||
| OS: | All | ||
|
Description
alexander.howard
2017-03-07 15:04:17 CET
A fix has been proposed: geombias-10-03-00 This involves putting in mutex locks around methods which are accessed by the biasing process. Thus preventing erratic behaviour due to changes in the returned importance values during the request. The member functions of G4IStore and G4ImportanceAlgorithm are affected. I have the same problem with my simulations. Incorrect importance values get returned because of the race condition in G4IStore::GetImportance, which leads to random simulation behavior. A mutex may not be needed. The problem is the temporary member variable used for iteration (fCurrentIterator). Using a local iterator instead should solve it. Thanks Joost! You are correct, however, I wanted to first check that the problem could be resolved with this "brute force" method, as the problem was not so easy to reproduce - one reason why the bug remained for such a long time. The local iterator solution will be tested next. Thanks. FYI, using a local iterator did solve the problem for me: https://github.com/joostverburg/geant4/commit/8f8b31bcff9c673546d179d664d983c73a4502e6 A fix should now be included in the recent Geant4 patch. There was an additional problem with a threadrace in setting the parallel worlds. I have left the fixes as an Autolock, however, I would like to change the design such that the configuration can be handled better. Nonetheless for now the bug will be closed. |