Skip to content

Commit

Permalink
[dask] Check non-equal when setting threads. (#5421)
Browse files Browse the repository at this point in the history
* Check non-equal.

`nthread` can be restored from internal parameter, which is mis-interpreted as
user defined parameter.

* Check None.
  • Loading branch information
trivialfis authored Mar 17, 2020
1 parent b51124c commit 8ca06ab
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions python-package/xgboost/dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,14 @@ def dispatched_train(worker_addr):
local_history = {}
local_param = params.copy() # just to be consistent
msg = 'Overriding `nthreads` defined in dask worker.'
if 'nthread' in local_param.keys():
if 'nthread' in local_param.keys() and \
local_param['nthread'] is not None and \
local_param['nthread'] != worker.nthreads:
msg += '`nthread` is specified. ' + msg
LOGGER.warning(msg)
elif 'n_jobs' in local_param.keys():
elif 'n_jobs' in local_param.keys() and \
local_param['n_jobs'] is not None and \
local_param['n_jobs'] != worker.nthreads:
msg = '`n_jobs` is specified. ' + msg
LOGGER.warning(msg)
else:
Expand Down

0 comments on commit 8ca06ab

Please sign in to comment.