How to set thread number used in booster.predict to one?


#1

I have xgb model which is loaded by a new booster. Then I use this booster to predict some data. The code like “booster.predict(matrix);”.

Is there any method allowing me to limit thread number used in “booster.predict” to 1?

Any comments is much appreciated.


#2

You can set the environment variable OMP_NUM_THREADS to 1, to force OpenMP runtime to use only a single thread.