diff --git a/AmpTools/IUAmpTools/NormIntInterface.h b/AmpTools/IUAmpTools/NormIntInterface.h index d702f155..07e028d0 100644 --- a/AmpTools/IUAmpTools/NormIntInterface.h +++ b/AmpTools/IUAmpTools/NormIntInterface.h @@ -91,7 +91,6 @@ class NormIntInterface void invalidateTerms(); - // needs different implementations in MPI so make virtual virtual void loadMC() const; #endif diff --git a/AmpTools/IUAmpToolsMPI/AmpToolsInterfaceMPI.cc b/AmpTools/IUAmpToolsMPI/AmpToolsInterfaceMPI.cc index 91ee339c..28f69543 100644 --- a/AmpTools/IUAmpToolsMPI/AmpToolsInterfaceMPI.cc +++ b/AmpTools/IUAmpToolsMPI/AmpToolsInterfaceMPI.cc @@ -123,6 +123,8 @@ AmpToolsInterfaceMPI::AmpToolsInterfaceMPI(ConfigurationInfo* configurationInfo) NormIntInterface* normInt = NULL; if (genMCRdr && accMCRdr && intenMan && !(reaction->normIntFileInput())){ normInt = new NormIntInterfaceMPI(genMCRdr, accMCRdr, *intenMan); + // no need to call loadMC() here because the constructor of + // NormIntInterfaceMPI calls it through setupMPI() m_normIntMap[reactionName] = normInt; if (reaction->normIntFile() == "") report( WARNING, kModule ) << "no name given to NormInt file for reaction " diff --git a/AmpTools/IUAmpToolsMPI/NormIntInterfaceMPI.cc b/AmpTools/IUAmpToolsMPI/NormIntInterfaceMPI.cc index a998f1b5..70a9b911 100644 --- a/AmpTools/IUAmpToolsMPI/NormIntInterfaceMPI.cc +++ b/AmpTools/IUAmpToolsMPI/NormIntInterfaceMPI.cc @@ -130,6 +130,8 @@ NormIntInterfaceMPI::setupMPI() // load the MC into CPU memory on the follower nodes -- this is effectively // a copy from the DataReaderMPI cache to the AmpVecs structure + // and it is only run on the followers to avoid large memory + // usage on the lead node loadMC(); long int thisEvents; @@ -203,9 +205,10 @@ NormIntInterfaceMPI::sumIntegrals( IntType type ) const } void -NormIntInterfaceMPI::loadMC() const -{ - // avoids large memory allocations on the lead node +NormIntInterfaceMPI::loadMC() const{ + + // do not load MC on the leader node + // only the followers need the MC if( !m_isLeader ) NormIntInterface::loadMC(); } diff --git a/AmpTools/IUAmpToolsMPI/NormIntInterfaceMPI.h b/AmpTools/IUAmpToolsMPI/NormIntInterfaceMPI.h index 3f450586..067c047f 100644 --- a/AmpTools/IUAmpToolsMPI/NormIntInterfaceMPI.h +++ b/AmpTools/IUAmpToolsMPI/NormIntInterfaceMPI.h @@ -59,7 +59,7 @@ class NormIntInterfaceMPI : public NormIntInterface void forceCacheUpdate( bool normIntOnly = false ) const; void loadMC() const; - + private: void setupMPI();