huangyh09/brie

brie-quant uses all available resources

supermaxiste opened this issue · 1 comments

Hello,

I was wondering if there was any plan to add resource usage (i.e. number of threads) as an option to use brie-quant. Right now the code has maximum resources hardcoded:

brie/brie/bin/quant.py

Lines 207 to 211 in 8f83c56

## maximum number of threads (to fix)
# if options.nproc != -1:
# tf.config.threading.set_inter_op_parallelism_threads(options.nproc)
nproc = -1

This is an issue for people using shared computer clusters. I didn't have time to test this, but would changing this line of code lead to less resources used?

Thank you in advance for the reply

Thanks for raising this important issue. Indeed TensorFlow will use all available CPU threads by default. We have just fixed it in the new release v2.2.2. By default, it will use up to 6 threads.

brie/brie/bin/quant.py

Lines 207 to 211 in 2a9e13a

## maximum number of threads (to fix)
if options.nproc != -1:
import tensorflow as tf
tf.config.threading.set_intra_op_parallelism_threads(options.nproc)
tf.config.threading.set_inter_op_parallelism_threads(options.nproc)

Yuanhua