Skip to content

Commit

Permalink
Config: Always get physical cores
Browse files Browse the repository at this point in the history
  • Loading branch information
dgasmith committed Jun 21, 2018
1 parent 81d0398 commit 0cdad20
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions qcengine/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
_globals = {}
_cpuinfo = cpuinfo.get_cpu_info()

# We want physical cores
_cpuinfo["count"] = psutil.cpu_count(logical=False)

_globals["hostname"] = socket.gethostname()
_globals["cpu"] = _cpuinfo["brand"]
_globals["username"] = getpass.getuser()
Expand Down Expand Up @@ -53,9 +56,7 @@ def _process_autos(data):
if data.get("nthreads_per_job", False) == "auto":
nthreads = _cpuinfo["count"]

# Watch hyperthreading
if "Intel" in _cpuinfo["vendor_id"]:
nthreads = nthreads // 2
# Figure out number of threads per job
data["nthreads_per_job"] = int(nthreads / data["jobs_per_node"])
if data["nthreads_per_job"] < 1:
raise KeyError("Number of jobs per node exceeds the number of available cores.")
Expand Down

0 comments on commit 0cdad20

Please sign in to comment.