QMCPACK / QMCPACK/qmcpack

Global Random found Harmful

Open
#1,983 6 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
403
Forks
154
Avg merge
1d 13h
Merged PRs (30d)
90

Description

So
```C++
NonLocalECPotential::NonLocalECPotential(ParticleSet& ions,
ParticleSet& els,
TrialWaveFunction& psi,
bool computeForces,
bool useVP)
: IonConfig(ions),
Psi(psi),
UseTMove(TMOVE_OFF),
myRNG(&Random),
```
Random is a global object and not threadsafe. In the new DMCBatched driver NonLocalECPPotential::evaluate is called in a threaded context. It does this
```C++
PPset[ipp]->randomize_grid(*myRNG);
```
This rather randomly causes SIGSEGV

This took me quite some time to catch in a core dump. Enough with the global objects and unclear scopes.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.