Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move RNG memory init before particle memory init #1547

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions src/picongpu/include/simulationControl/MySimulation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,20 @@ class MySimulation : public SimulationHelper<simDim>

laser = new LaserPhysics(cellDescription->getGridLayout());

// Initialize random number generator and synchrotron functions, if there are synchrotron photon species
typedef typename PMacc::particles::traits::FilterByFlag<VectorAllSpecies,
synchrotronPhotons<> >::type AllSynchrotronPhotonsSpecies;
if(!bmpl::empty<AllSynchrotronPhotonsSpecies>::value)
{
// create factory for the random number generator
this->rngFactory = new RNGFactory(Environment<simDim>::get().SubGrid().getLocalDomain().size);
// init factory
PMacc::GridController<simDim>& gridCon = PMacc::Environment<simDim>::get().GridController();
this->rngFactory->init(gridCon.getScalarPosition());

this->synchrotronFunctions.init();
}

ForEach<VectorAllSpecies, particles::CreateSpecies<bmpl::_1>, MakeIdentifier<bmpl::_1> > createSpeciesMemory;
createSpeciesMemory(forward(particleStorage), cellDescription);

Expand Down Expand Up @@ -341,20 +355,6 @@ class MySimulation : public SimulationHelper<simDim>

/* add CUDA streams to the StreamController for concurrent execution */
Environment<>::get().StreamController().addStreams(6);

// Initialize random number generator and synchrotron functions, if there are synchrotron photon species
typedef typename PMacc::particles::traits::FilterByFlag<VectorAllSpecies,
synchrotronPhotons<> >::type AllSynchrotronPhotonsSpecies;
if(!bmpl::empty<AllSynchrotronPhotonsSpecies>::value)
{
// create factory for the random number generator
this->rngFactory = new RNGFactory(Environment<simDim>::get().SubGrid().getLocalDomain().size);
// init factory
PMacc::GridController<simDim>& gridCon = PMacc::Environment<simDim>::get().GridController();
this->rngFactory->init(gridCon.getScalarPosition());

this->synchrotronFunctions.init();
}
}

virtual uint32_t fillSimulation()
Expand Down