镜像
============

docker pull harbor.sourcefind.cn:5443/dcu/admin/base/vllm:0.11.0-ubuntu22.04-dtk26.04-py3.10

创建容器
============

docker run -it --name lightgbm-tlh --privileged --shm-size=256G --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --ulimit memlock=-1:-1 --ipc=host --network host --group-add video --device /dev/kfd --device /dev/dri --device /dev/mkfd -v /opt/hyhal:/opt/hyhal:ro -v /public/tianlh:/workspace  harbor.sourcefind.cn:5443/dcu/admin/base/vllm:0.11.0-ubuntu22.04-dtk26.04-py3.10 /bin/bash

下载仓库
============
git clone --recursive xxx.git

环境、脚本准备
============

cd LightGBM
git checkout release/4.6.0.99
pip install scikit_build_core
修改build-python.sh，148行，改成下方内容

.. code:: bash

        --rocm)
                BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_ROCM=ON"
                BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_HIP_COMPILER=dcc"
        ;;

构建whl
============

.. code:: bash

        export CMAKE_PREFIX_PATH=/opt/dtk
        export CMAKE_CXX_COMPILER=hipcc
        ./build-python.sh bdist_wheel --rocm --no-isolation

安装whl
============

pip install dist/amd_lightgbm*.whl

验证安装
============

   .. code-block:: shell

      pip show -v amd_lightgbm

   .. dropdown:: Example output

      .. code-block:: shell-session

          Name: amd_lightgbm
          Version: 4.6.0.99
          Summary: ROCm Port of LightGBM Python-package
         ... [output truncated]

测试程序
============

   .. code-block:: shell

        hipprof HIP_VISIBLE_DEVICES=0 python lightgbm_test.py

