Skip to content

Commit

Permalink
Limit number of BLAS threads during parallelization. Fixes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewThe committed Jan 2, 2024
1 parent 3fce61b commit 0411ec4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions job_pool/job_pool.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from threadpoolctl import threadpool_limits
import time
import signal
from typing import Optional
Expand Down Expand Up @@ -58,6 +59,7 @@ class AbnormalWorkerTerminationError(Exception):


class JobPool:
@threadpool_limits.wrap(limits=1, user_api='blas')
def __init__(
self,
processes: int = 1,
Expand Down
13 changes: 12 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ packages = [{include = "job_pool"}]
[tool.poetry.dependencies]
python = "^3.8"
tqdm = "^4.66.1"
threadpoolctl = "^3.2.0"


[tool.poetry.group.dev.dependencies]
Expand Down

0 comments on commit 0411ec4

Please sign in to comment.