PaNOSC-ViNYL / SimEx

Start-to-end photon experiment simulation platform
https://simex.readthedocs.io/
GNU General Public License v3.0
26 stars 25 forks source link

SingFELPhotonDiffractor.py used too many openMP threads #219

Closed JunCEEE closed 3 years ago

JunCEEE commented 3 years ago

At line about 239 (line number might differ due to code version):

   def _backengineWithPdb(self):
        """ """
        """
        Run the diffraction simulation if the sample is a pdb.
        Codes is based on pysingfel/tests/test_particle.test_calFromPDB
        """

        # Dump self to file.
        fname = IOUtilities.getTmpFileName()
        self.dumpToFile(fname)

        # Setup the mpi call.
        forcedMPIcommand = self.parameters.forced_mpi_command

        if forcedMPIcommand == "" or forcedMPIcommand is None:
            (np, ncores) = self.computeNTasks()
            mpicommand = ParallelUtilities.prepareMPICommandArguments(
                np, ncores)
        else:
            mpicommand = forcedMPIcommand

        mpicommand += " ".join(("", sys.executable, __file__, fname))

This mpicommand = ParallelUtilities.prepareMPICommandArguments(np, ncores) will create command like this 'mpirun -np 40 --map-by node --bind-to none -x OMP_NUM_THREADS=40 -x OMPI_MCA_mpi_warn_on_fork=0 -x OMPI_MCA_btl_base_warn_component_unused=0' to use 40 threads per core, which will exceed system limit.

JunCEEE commented 3 years ago

Fixed in this commit https://github.com/PaNOSC-ViNYL/SimEx/commit/3543f65fd63f76ad6eef547807c3a54f9eb2fe7d