Skip to content

Commit

Permalink
limit threads during tests
Browse files Browse the repository at this point in the history
Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz committed Nov 8, 2024
1 parent 9f9c174 commit 31f9e87
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions source/tests/jax/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
import os

os.environ["XLA_FLAGS"] = " ".join(
(
"--xla_cpu_multi_thread_eigen=false",
"intra_op_parallelism_threads=1",
"inter_op_parallelism_threads=1",
)
)
5 changes: 5 additions & 0 deletions source/tests/jax/jax2tf/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
import tensorflow as tf

# limit the number of threads
tf.config.threading.set_inter_op_parallelism_threads(1)
tf.config.threading.set_intra_op_parallelism_threads(1)

0 comments on commit 31f9e87

Please sign in to comment.