Closed ryamy closed 1 year ago
I found it seems that xgboost can not access to gpu.
(espp) user@hostname:~/ESP_prediction_function$ python
Python 3.8.18 | packaged by conda-forge | (default, Oct 10 2023, 15:44:36)
[GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import xgboost as xgb
>>> import pandas as pd
>>> import numpy
>>> import numpy as np
>>> data_url = "http://lib.stat.cmu.edu/datasets/boston"
>>> raw_df = pd.read_csv(data_url, sep="\s+", skiprows=22, header=None)
>>> data = np.hstack([raw_df.values[::2, :], raw_df.values[1::2, :2]])
>>> target = raw_df.values[1::2, 2]
>>> params = {'tree_method': 'hist', 'max_depth': 3, 'learning_rate': 0.1}
>>> dtrain = xgb.DMatrix(data, target)
/opt/conda/envs/espp/lib/python3.8/site-packages/xgboost/data.py:104: UserWarning: Use subset (sliced data) of np.ndarray is not recommended because it will generate extra copies and increase memory consumption
warnings.warn(
>>> xgb.train(params, dtrain, evals=[(dtrain, "train")])
[0] train-rmse:21.60208
[1] train-rmse:19.55555
[2] train-rmse:17.71453
[3] train-rmse:16.06071
[4] train-rmse:14.57054
[5] train-rmse:13.23501
[6] train-rmse:12.03721
[7] train-rmse:10.94917
[8] train-rmse:9.98378
[9] train-rmse:9.10604
<xgboost.core.Booster object at 0x7f90dd0de820>
>>> params = {'tree_method': 'gpu_hist', 'max_depth': 3, 'learning_rate': 0.1}
>>>
>>> xgb.train(params, dtrain, evals=[(dtrain, "train")])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/conda/envs/espp/lib/python3.8/site-packages/xgboost/training.py", line 227, in train
bst = _train_internal(params, dtrain,
File "/opt/conda/envs/espp/lib/python3.8/site-packages/xgboost/training.py", line 102, in _train_internal
bst.update(dtrain, i, obj)
File "/opt/conda/envs/espp/lib/python3.8/site-packages/xgboost/core.py", line 1280, in update
_check_call(_LIB.XGBoosterUpdateOneIter(self.handle,
File "/opt/conda/envs/espp/lib/python3.8/site-packages/xgboost/core.py", line 189, in _check_call
raise XGBoostError(py_str(_LIB.XGBGetLastError()))
xgboost.core.XGBoostError: [02:02:19] ../src/gbm/../common/common.h:156: XGBoost version not compiled with GPU support.
Stack trace:
[bt] (0) /opt/conda/envs/espp/lib/libxgboost.so(+0x9f738) [0x7f90d4c47738]
[bt] (1) /opt/conda/envs/espp/lib/libxgboost.so(xgboost::gbm::GBTree::ConfigureUpdaters()+0x106) [0x7f90d4d44886]
[bt] (2) /opt/conda/envs/espp/lib/libxgboost.so(xgboost::gbm::GBTree::Configure(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&)+0x241) [0x7f90d4d597c1]
[bt] (3) /opt/conda/envs/espp/lib/libxgboost.so(+0x1e0c5e) [0x7f90d4d88c5e]
[bt] (4) /opt/conda/envs/espp/lib/libxgboost.so(+0x1cfdbd) [0x7f90d4d77dbd]
[bt] (5) /opt/conda/envs/espp/lib/libxgboost.so(XGBoosterUpdateOneIter+0x64) [0x7f90d4c4cb04]
[bt] (6) /opt/conda/envs/espp/lib/python3.8/lib-dynload/../../libffi.so.8(+0x6a4a) [0x7f90faa13a4a]
[bt] (7) /opt/conda/envs/espp/lib/python3.8/lib-dynload/../../libffi.so.8(+0x5fea) [0x7f90faa12fea]
[bt] (8) /opt/conda/envs/espp/lib/python3.8/lib-dynload/_ctypes.cpython-38-x86_64-linux-gnu.so(_ctypes_callproc+0x377) [0x7f90faa2bfc7]
>>>
So I uninstalled xgboost which was installed via conda install -c conda-forge py-xgboost=1.3.3
(as following README.md). Then I installed xgboost via pip install xgboost
resulted in scipy-1.10.1 and xgboost-2.0.0 installation.
After that Tutorial ESP prediction.ipynb
works fine in my environment. I hope this helps for someone facing similar issues.
Thanks for your excellent work, I am interested in ESP prediction. I tried to execute
Tutorial ESP prediction.ipynb
with no modification and following error was produced in cell[2]. How can I handle this error? I would appreciate any comments.