5d9b6a5d8f85d232e0dbf4869c702f2b8979d137,pyemma/_base/parallel.py,NJobsMixIn,n_jobs,#NJobsMixIn#Any#,23

Before Change


            import os
            import psutil
            // TODO: aint it better to use a distinct variable for this use case eg. PYEMMA_NJOBS in order to avoid multiplying OMP threads with njobs?
            omp_threads_from_env = os.getenv("OMP_NUM_THREADS", None)
            if omp_threads_from_env:
                try:
                    val = int(omp_threads_from_env)
                    if hasattr(self, "logger"):
                        self.logger.info("number of threads obtained from env variable"
                                         " "OMP_NUM_THREADS"=%s" % omp_threads_from_env)
                except ValueError as ve:
                    if hasattr(self, "logger"):
                        self.logger.warning("could not parse env variable "OMP_NUM_THREADS"."
                                            " Value="{}". Error={}. Will use {} jobs."
                                            .format(omp_threads_from_env, ve, val))
                    val = psutil.cpu_count()
            else:
                val = psutil.cpu_count()

        self._n_jobs = int(val)

After Change


                                                .format(err=ve, val=val, var=var))
                return None

            slurm_njobs = _from_env("SLURM_CPUS_ON_NODE")  // Number of CPUS on the allocated SLURM node.
            pyemma_njobs = _from_env("PYEMMA_NJOBS")

            if slurm_njobs and pyemma_njobs:
                import warning
                warning.warn("two settings for n_jobs from environment: PYEMMA_NJOBS and SLURM_CPUS_ON_NODE. "
                             "Respecting the SLURM setting to avoid overprovisioning")

            // slurm njobs will be used preferably.
            val = slurm_njobs or pyemma_njobs
            if not val:
                val = _from_hardware()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: markovmodel/PyEMMA
Commit Name: 5d9b6a5d8f85d232e0dbf4869c702f2b8979d137
Time: 2017-10-17
Author: m.scherer@fu-berlin.de
File Name: pyemma/_base/parallel.py
Class Name: NJobsMixIn
Method Name: n_jobs


Project Name: Kaggle/docker-python
Commit Name: 44f637a6fc9ab8d1e69b293e26425be0cdabc499
Time: 2019-07-09
Author: ifigotin@google.com
File Name: patches/sitecustomize.py
Class Name:
Method Name: init


Project Name: arraiy/torchgeometry
Commit Name: fff247ab24af51704f296b512e74b7ff4d6adb81
Time: 2020-04-26
Author: edgar.riba@gmail.com
File Name: setup.py
Class Name:
Method Name: