在支持GPU的iMac M1上安装XGBoost



我目前写了一些脚本在我的M1 iMac电脑上运行XGBoost。我已经在conda-forge中安装了XGBoost,如下所示:

...
wheel                     0.37.0             pyhd8ed1ab_1    conda-forge
xgboost                   1.5.0            py39ha480839_0    conda-forge
xz                        5.2.5                h642e427_1    conda-forge
...

但是我得到这个错误,不知道为什么:

Traceback (most recent call last):
File "/Volumes/XXXXDrive/ProjectDrive/Project/Project.py", line 195, in
xgb_model.fit(dtrainx, dtrainy)
File "/Users/XXXX/miniforge3/lib/python3.9/site-packages/xgboost/core.py", line 506, in inner_f
return f(**kwargs)
File "/Users/XXXX/miniforge3/lib/python3.9/site-packages/xgboost/sklearn.py", line 789, in fit
self._Booster = train(
File "/Users/XXXX/miniforge3/lib/python3.9/site-packages/xgboost/training.py", line 188, in train
bst = _train_internal(params, dtrain,
File "/Users/XXXX/miniforge3/lib/python3.9/site-packages/xgboost/training.py", line 81, in _train_internal
bst.update(dtrain, i, obj)
File "/Users/XXXX/miniforge3/lib/python3.9/site-packages/xgboost/core.py", line 1680, in update
_check_call(_LIB.XGBoosterUpdateOneIter(self.handle,
File "/Users/XXXX/miniforge3/lib/python3.9/site-packages/xgboost/core.py", line 218, in _check_call
raise XGBoostError(py_str(_LIB.XGBGetLastError()))
xgboost.core.XGBoostError: [01:00:46] /Users/runner/miniforge3/conda-bld/xgboost-split_1635105055642/work/src/gbm/../common/common.h:157: XGBoost version not compiled with GPU support.
Stack trace:
[bt] (0) 1   libxgboost.dylib                    0x000000011f9418b0 dmlc::LogMessageFatal::~LogMessageFatal() + 124
[bt] (1) 2   libxgboost.dylib                    0x000000011f9bf708 xgboost::gbm::GBTree::ConfigureUpdaters() + 464
[bt] (2) 3   libxgboost.dylib                    0x000000011f9bf248 xgboost::gbm::GBTree::Configure(std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > const&) + 1008
[bt] (3) 4   libxgboost.dylib                    0x000000011f9d91dc xgboost::LearnerConfiguration::Configure() + 1076
[bt] (4) 5   libxgboost.dylib                    0x000000011f9d951c xgboost::LearnerImpl::UpdateOneIter(int, std::__1::shared_ptr<xgboost::DMatrix>) + 144
[bt] (5) 6   libxgboost.dylib                    0x000000011f945b58 XGBoosterUpdateOneIter + 164
[bt] (6) 7   libffi.dylib                        0x0000000199014050 ffi_call_SYSV + 80
[bt] (7) 8   libffi.dylib                        0x000000019901c9e4 ffi_call_int + 948
[bt] (8) 9   _ctypes.cpython-39-darwin.so        0x0000000113f8c744 _ctypes_callproc + 1236

我猜我目前拥有的xgboost不是GPU支持,而是CPU支持。我的predictorgpu_predictor。但是有人知道如何检查我是否有GPU版本吗?或者至少我如何在我的M1 iMac上安装XGBoost的GPU版本?谢谢!

火,

xgb不支持Apple M1 GPU。你可以在Github上检查这个问题:https://github.com/dmlc/xgboost/issues/6408

我不期望xgb或lgbm很快支持苹果的GPU,这是非常不幸的。

欢呼

最新更新