python - 如何在使用 GPU 支持编译的 macOS 上安装 Xgboost?

标签 python macos gpu xgboost

我正在尝试从过去 3 天开始在我的 MacOS Mojave(10.14.6) 上安装与 GPU 支持集成的 xgboost,但是没有成功。我尝试了两种方法:

  • pip 安装 xgboost

  • xgboost 安装在这里,它在没有 GPU 选项的情况下成功运行(即,没有 tree_method='gpu_hist')。
    我想通过在树参数中给出“tree_method='gpu_hist'”来运行 gpu_hist。当我在树参数中给出“tree_method='gpu_hist'”时,出现了以下错误:
    XGBoostError: [12:10:34] /Users/travis/build/dmlc/xgboost/src/gbm/../common/common.h:153: XGBoost version not compiled with GPU support.
    Stack trace:
    [bt] (0) 1 libxgboost.dylib 0x000000012256ba60 dmlc::LogMessageFatal::~LogMessageFatal() + 112
    [bt] (1) 2 libxgboost.dylib 0x00000001225f92b3 xgboost::gbm::GBTree::ConfigureUpdaters() + 531
    [bt] (2) 3 libxgboost.dylib 0x00000001225f8b97 xgboost::gbm::GBTree::Configure(std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > > const&) + 967
    [bt] (3) 4 libxgboost.dylib 0x0000000122611a0c xgboost::LearnerConfiguration::Configure() + 1500
    [bt] (4) 5 libxgboost.dylib 0x0000000122611e68 xgboost::LearnerImpl::UpdateOneIter(int, std::__1::shared_ptr) + 120
    [bt] (5) 6 libxgboost.dylib 0x000000012256331d XGBoosterUpdateOneIter + 157
    [bt] (6) 7 libffi.7.dylib 0x0000000102102ead ffi_call_unix64 + 85
    [bt] (7) 8 ??? 0x00007ffeee291da0 0x0 + 140732894092704
    
  • 我的第二种方法:
    git clone –递归https://github.com/dmlc/xgboost
    cd xgboost/
    制作 -j4
    cd python 包
    python3 setup.py 安装
    虽然它安装了 xgboost,但在运行此语句时抛出以下错误:
    dtrain=xgb.DMatrix(df_train_features,label=df_train_label)#,missing=-999)
    AttributeError: dlsym(0x7ffe9aed62f0, XGDMatrixSetDenseInfo): 未找到符号

  • 任何帮助,将不胜感激

    最佳答案

    由于过时 libxgboost.so,我也遇到了同样的情况在全新安装期间没有更新。
    解决问题并安装 xgboost使用 GPU 支持,您应该执行以下操作:

    # remove libxgboost.so manually from where it resides
    rm /home/$USER/anaconda3/lib/libxgboost.so 
    pip uninstall -y xgboost 
    git clone --recursive https://github.com/dmlc/xgboost
    cd xgboost && mkdir build && cd build && cmake .. -DUSE_CUDA=ON
    make -j12
    cd ../python-package
    python setup.py install
    

    关于python - 如何在使用 GPU 支持编译的 macOS 上安装 Xgboost?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65103861/

    相关文章:

    c++ - 如何使用 CUDA 将 std::vector<std::string> 复制到 GPU 设备

    c++ - Metal - 针对内存延迟优化 GPU 矩阵乘法

    python - Django 模型中的复杂级联

    macos - gcc 11.3.0 on macOS/Apple Silicon 和 SHA-3 指令

    Python 3.4 : LXML : Parsing Tables

    macos - 如何在 OSX 上安装特定的 clang 版本?

    java - 无法在 netbeans 中添加 apache tomcat 服务器

    MATLAB 和 ATi GPU

    Python Web Scraping title in a special div & Page 1 + 15

    python - 尝试在 python 中将 Plotly 图保存到图像文件时出现奇怪的错误?