Commit 64ac843c authored by Karthik Kashyap Thatipamula's avatar Karthik Kashyap Thatipamula
Browse files

Add ROCM documentation

parent 8d9c0ce9
...@@ -478,3 +478,15 @@ dask-worker-space/ ...@@ -478,3 +478,15 @@ dask-worker-space/
.mypy_cache/ .mypy_cache/
.dmypy.json .dmypy.json
dmypy.json dmypy.json
# documentation artifacts
_build/
_images/
__pycache__/
_static/
_templates/
_toc.yml
docBin/
_doxygen/
_readthedocs/
__pycache__/
...@@ -7,6 +7,8 @@ option(USE_CUDA "Enable CUDA-accelerated training " OFF) ...@@ -7,6 +7,8 @@ option(USE_CUDA "Enable CUDA-accelerated training " OFF)
option(USE_ROCM "Enable ROCm-accelerated training " OFF) option(USE_ROCM "Enable ROCm-accelerated training " OFF)
option(USE_DEBUG "Set to ON for Debug mode" OFF) option(USE_DEBUG "Set to ON for Debug mode" OFF)
option(USE_SANITIZER "Use sanitizer flags" OFF) option(USE_SANITIZER "Use sanitizer flags" OFF)
option(ENABLE_CODE_COVERAGE "Enable code coverage instrumentation for C++ and CUDA code" OFF)
set( set(
ENABLED_SANITIZERS ENABLED_SANITIZERS
"address" "leak" "undefined" "address" "leak" "undefined"
...@@ -82,6 +84,13 @@ elseif(MSVC) ...@@ -82,6 +84,13 @@ elseif(MSVC)
endif() endif()
endif() endif()
# Host code coverage (GCC/Clang only, not MSVC)
if(ENABLE_CODE_COVERAGE AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
message(STATUS "Enabling code coverage (host)")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-instr-generate -fcoverage-mapping -O0")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-instr-generate -fcoverage-mapping -O0")
endif()
if(USE_SWIG) if(USE_SWIG)
find_package(SWIG REQUIRED) find_package(SWIG REQUIRED)
find_package(Java REQUIRED) find_package(Java REQUIRED)
...@@ -277,8 +286,13 @@ if(USE_ROCM) ...@@ -277,8 +286,13 @@ if(USE_ROCM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DISABLED_WARNINGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DISABLED_WARNINGS}")
set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} ${DISABLED_WARNINGS}") set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} ${DISABLED_WARNINGS}")
if(USE_DEBUG) if(ENABLE_CODE_COVERAGE)
message(STATUS "Enabling code coverage (ROCm/HIP)")
if(CMAKE_HIP_COMPILER)
set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} -fprofile-instr-generate -fcoverage-mapping -O0")
endif()
elseif(USE_DEBUG)
set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} -g -O0") set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} -g -O0")
else() else()
set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} -O3") set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} -O3")
...@@ -852,3 +866,4 @@ if(INSTALL_HEADERS) ...@@ -852,3 +866,4 @@ if(INSTALL_HEADERS)
FILES_MATCHING PATTERN "*.h" FILES_MATCHING PATTERN "*.h"
) )
endif() endif()
# coding: utf-8
"""Comparison of `binary` and `xentropy` objectives.
BLUF: The `xentropy` objective does logistic regression and generalizes
to the case where labels are probabilistic (i.e. numbers between 0 and 1).
Details: Both `binary` and `xentropy` minimize the log loss and use
`boost_from_average = TRUE` by default. Possibly the only difference
between them with default settings is that `binary` may achieve a slight
speed improvement by assuming that the labels are binary instead of
probabilistic.
"""
import time
import numpy as np
import pandas as pd
from scipy.special import expit
import lightgbm as lgb
#################
# Simulate some binary data with a single categorical and
# single continuous predictor
rng = np.random.default_rng(seed=0)
N = 1000
X = pd.DataFrame({"continuous": range(N), "categorical": np.repeat([0, 1, 2, 3, 4], N / 5)})
CATEGORICAL_EFFECTS = [-1, -1, -2, -2, 2]
LINEAR_TERM = np.array(
[-0.5 + 0.01 * X["continuous"][k] + CATEGORICAL_EFFECTS[X["categorical"][k]] for k in range(X.shape[0])]
) + rng.normal(loc=0, scale=1, size=X.shape[0])
TRUE_PROB = expit(LINEAR_TERM)
Y = rng.binomial(n=1, p=TRUE_PROB, size=N)
DATA = {
"X": X,
"probability_labels": TRUE_PROB,
"binary_labels": Y,
"lgb_with_binary_labels": lgb.Dataset(X, Y),
"lgb_with_probability_labels": lgb.Dataset(X, TRUE_PROB),
}
#################
# Set up a couple of utilities for our experiments
def log_loss(preds, labels):
"""Logarithmic loss with non-necessarily-binary labels."""
log_likelihood = np.sum(labels * np.log(preds)) / len(preds)
return -log_likelihood
def experiment(objective, label_type, data):
"""Measure performance of an objective.
Parameters
----------
objective : {'binary', 'xentropy'}
Objective function.
label_type : {'binary', 'probability'}
Type of the label.
data : dict
Data for training.
Returns
-------
result : dict
Experiment summary stats.
"""
nrounds = 5
lgb_data = data[f"lgb_with_{label_type}_labels"]
params = {"objective": objective, "feature_fraction": 1, "bagging_fraction": 1, "verbose": -1, "seed": 123, "device":"cuda"}
time_zero = time.time()
gbm = lgb.train(params, lgb_data, num_boost_round=nrounds)
y_fitted = gbm.predict(data["X"])
y_true = data[f"{label_type}_labels"]
duration = time.time() - time_zero
return {"time": duration, "correlation": np.corrcoef(y_fitted, y_true)[0, 1], "logloss": log_loss(y_fitted, y_true)}
#################
# Observe the behavior of `binary` and `xentropy` objectives
print("Performance of `binary` objective with binary labels:")
print(experiment("binary", label_type="binary", data=DATA))
print("Performance of `xentropy` objective with binary labels:")
print(experiment("xentropy", label_type="binary", data=DATA))
print("Performance of `xentropy` objective with probability labels:")
print(experiment("xentropy", label_type="probability", data=DATA))
# Trying this throws an error on non-binary values of y:
# experiment('binary', label_type='probability', DATA)
# The speed of `binary` is not drastically different than
# `xentropy`. `xentropy` runs faster than `binary` in many cases, although
# there are reasons to suspect that `binary` should run faster when the
# label is an integer instead of a float
K = 10
A = [experiment("binary", label_type="binary", data=DATA)["time"] for k in range(K)]
B = [experiment("xentropy", label_type="binary", data=DATA)["time"] for k in range(K)]
print(f"Best `binary` time: {min(A)}")
print(f"Best `xentropy` time: {min(B)}")
...@@ -36,6 +36,12 @@ Benefiting from these advantages, LightGBM is being widely-used in many [winning ...@@ -36,6 +36,12 @@ Benefiting from these advantages, LightGBM is being widely-used in many [winning
[Comparison experiments](https://github.com/microsoft/LightGBM/blob/master/docs/Experiments.rst#comparison-experiment) on public datasets show that LightGBM can outperform existing boosting frameworks on both efficiency and accuracy, with significantly lower memory consumption. What's more, [distributed learning experiments](https://github.com/microsoft/LightGBM/blob/master/docs/Experiments.rst#parallel-experiment) show that LightGBM can achieve a linear speed-up by using multiple machines for training in specific settings. [Comparison experiments](https://github.com/microsoft/LightGBM/blob/master/docs/Experiments.rst#comparison-experiment) on public datasets show that LightGBM can outperform existing boosting frameworks on both efficiency and accuracy, with significantly lower memory consumption. What's more, [distributed learning experiments](https://github.com/microsoft/LightGBM/blob/master/docs/Experiments.rst#parallel-experiment) show that LightGBM can achieve a linear speed-up by using multiple machines for training in specific settings.
Get Started on ROCm and Documentation
-----------------------------
LightGBM is enabled and optimised for ROCm software which enables the library to run on AMD Instinct GPUs. For details on installation on ROCm refer to the [ROCm Documentation](https://rocm.docs.amd.com/projects/lightgbm/en/latest/index.html).
Get Started and Documentation Get Started and Documentation
----------------------------- -----------------------------
......
.venv
build
# documentation artifacts
_build/
_images/
__pycache__/
_static/
_templates/
_toc.yml
docBin/
_doxygen/
_readthedocs/
__pycache__/
version: 2
sphinx:
configuration: amd-docs/conf.py
python:
install:
- requirements: amd-docs/sphinx/requirements.txt
build:
os: ubuntu-24.04
tools:
python: "3.10"
.. meta::
:description: LightGBM license information
:keywords: amd, rocm, license, contribute, open, source, code, software, reuse, distribute
*********************
ROCm LightGBM license
*********************
.. literalinclude:: ../../LICENSE
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import os
from pathlib import Path
RELEASE_VERSION = "4.6.0.99"
DOCS_DIR = Path(__file__).parent.resolve()
project = "LightGBM"
project_path = str(DOCS_DIR).replace("\\", "/")
author = "Advanced Micro Devices, Inc."
copyright = "Copyright (c) %Y Advanced Micro Devices, Inc. All rights reserved."
version = RELEASE_VERSION
release = RELEASE_VERSION
setting_all_article_info = True
all_article_info_os = ["linux"]
all_article_info_author = ""
extensions = [
"rocm_docs",
]
external_toc_path = "./sphinx/_toc.yml"
external_projects_remote_repository = "lightgbm"
html_theme = "rocm_docs_theme"
html_theme_options = {
"flavor": "rocm-finance",
}
html_title = f"LightGBM {RELEASE_VERSION}"
html_context = {}
if os.environ.get("READTHEDOCS", "") == "True":
html_context["READTHEDOCS"] = True
latex_engine = "xelatex"
latex_elements = {
"fontpkg": r"""
\usepackage{tgtermes}
\usepackage{tgheros}
\renewcommand\ttdefault{txtt}
"""
}
.. meta::
:description: Use LightGBM with ROCm support on AMD GPUs
:keywords: amd, rocm, finance, financial, fintech, algorithm, gpu
**********************
LightGBM documentation
**********************
Use LightGBM on ROCm for GPU-accelerated gradient boosting on AMD Instinct
GPUs, enabling scalable performance for financial modeling tasks with large,
imbalanced, and categorical datasets.
LightGBM uses histogram‑based splitting and leaf‑wise tree growth to achieve
rapid convergence on datasets with many categorical features (such as
employment type or verification status) without requiring one‑hot encoding. It
maintains a low memory footprint and handles sparsity effectively, making it
well‑suited to credit risk and scoring workloads. GPU acceleration can provide
2x to 5x performance gains through optimized histogram computation; however, care is
needed to avoid overfitting without parameters such as ``min_data_in_leaf``.
ROCm enablement accelerates LightGBM on AMD Instinct GPUs with optimized
kernels and efficient memory handling, delivering meaningful performance gains
over CPU‑only baselines, especially for finance pipelines rich in categorical
data.
LightGBM is part of the `AMD ROCm Finance toolkit
<https://rocm.docs.amd.com/projects/rocm-finance/en/latest/>`__.
The ROCm-Finance LightGBM source code is hosted on GitHub at
`<https://github.com/ROCm/LightGBM/>`__.
ROCm-Finance LightGBM documentation is organized into the following categories:
.. grid:: 2
:gutter: 3
.. grid-item-card:: Install
* :doc:`/install/install`
* :doc:`/install/build-from-source`
.. grid-item-card:: Reference
* `Python quick start (upstream) <https://lightgbm.readthedocs.io/en/v4.6.0/Python-Intro.html>`__
* `Python API (upstream) <https://lightgbm.readthedocs.io/en/v4.6.0/Python-API.html>`__
.. grid-item-card:: Tutorial
* `Examples (GitHub) <https://github.com/ROCm/rocm-finance/tree/main/examples/lightgbm>`__
.. meta::
:description: Build LightGBM with ROCm support from source for AMD GPUs
:keywords: amd, rocm, finance, financial, fintech, algorithm, gpu, install, setup, env, docker, package, contribute, develop, build, pip, make
*******************************
Build ROCm LightGBM from source
*******************************
Prerequisites
=============
Before proceeding, ensure that you have installed a supported ROCm version,
operating system, and Python environment that are compatible with the ROCm
Finance libraries. Verify that your system includes a supported AMD Instinct
GPU. For guidance, see `ROCm finance installation prerequisites
<https://rocm.docs.amd.com/projects/rocm-finance/en/latest/install/prerequisites.html>`__.
For a consistent and streamlined setup experience, it's recommended to use
a ROCm development environment Docker container. See `Install ROCm Finance
<https://rocm.docs.amd.com/projects/rocm-finance/en/latest/install/install.html>`__
for instructions.
Build from source
=================
1. Clone the `<https://github.com/ROCm/LightGBM>`__ source code from GitHub.
.. code-block:: shell
git clone --recurse-submodules https://github.com/ROCm/lightgbm/
2. Create and activate a Python virtual environment.
.. code-block:: shell
python -m venv lightgbm_build
source lightgbm_build/bin/activate
3. Configure the ``build`` directory and CMake -- make sure you're using CMake version
3.8 or greater.
.. code-block:: shell
export CMAKE_PREFIX_PATH=/opt/rocm
export CMAKE_CXX_COMPILER=hipcc
cmake -DUSE_ROCM=1 -B build -S . -D CMAKE_PREFIX_PATH=/opt/rocm
4. Build the executable binary.
.. code-block:: shell
cd build
make -j
You should see the LightGBM executable built and placed just outside the ``build`` directory.
.. code-block:: shell
cd ..
5. Build the exectuable binary with unit tests.
.. code-block:: shell
export CMAKE_PREFIX_PATH=/opt/rocm
export CMAKE_CXX_COMPILER=hipcc
cmake -DUSE_ROCM=1 -DBUILD_CPP_TEST=ON -B build -S . CMAKE_PREFIX_PATH=/opt/rocm
cd build
cmake --target testlightgbm -j
To run the unit tests, use:
.. code-block:: shell
cd ..
./testlightgbm
6. Build and install the Python module.
.. code-block:: shell
export CMAKE_PREFIX_PATH=/opt/rocm
pip install --upgrade pip
pip install --upgrade --force-reinstall numpy pandas scikit-learn scipy setuptools matplotlib cloudpickle pytest psutil joblib pyarrow dask cffi
./build-python.sh bdist_wheel --rocm
pip install dist/amd_lightgbm*.whl
7. Verify the installation.
.. 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]
.. meta::
:description: Install LightGBM with ROCm support for AMD GPUs
:keywords: amd, rocm, finance, financial, fintech, algorithm, gpu, install, setup, env, docker, pip, package, quick, start, lib
*************************
Install LightGBM with pip
*************************
.. _lightgbm-install-prerequisites:
Prerequisites
=============
Before proceeding, ensure that you have installed a supported ROCm version,
operating system, and Python version that are compatible with the ROCm Finance
libraries. Verify that your system includes a supported AMD Instinct GPU. For
guidance, see `ROCm-Finance installation prerequisites
<https://rocm.docs.amd.com/projects/rocm-finance/en/latest/install/prerequisites.html>`__.
For a consistent and streamlined setup experience, it's recommended to use
a ROCm development environment Docker container. See `Install ROCm Finance
<https://rocm.docs.amd.com/projects/rocm-finance/en/latest/install/install.html>`__
for instructions.
Install using pip
=================
Install the ROCm-enabled LightGBM library from the AMD-hosted PyPI repository.
.. tab-set::
.. tab-item:: ROCm 7.0.2
:sync: rocm7
.. code-block:: shell
pip install amd_lightgbm --extra-index-url=https://pypi.amd.com/rocm-7.0.2/simple
.. tab-item:: ROCm 6.4.4
:sync: rocm6
.. code-block:: shell
pip install amd_lightgbm --extra-index-url=https://pypi.amd.com/rocm-6.4.4/simple
Verify your installation
------------------------
Use ``pip show`` to verify your installation:
.. 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]
After installing LightGBM, import and use the library. For example:
.. code-block:: python
import lightgbm as lgb
import numpy as np
rng = np.random.default_rng()
data = rng.uniform(size=(500, 10)) # 500 entities, each contains 10 features
label = rng.integers(low=0, high=2, size=(500, )) # binary target
train_data = lgb.Dataset(data, label=label)
# Variables of the form ${<variable>} are substituted, currently the following
# list is supported:
# - ${branch} (or {branch}) the name of the current branch
# - ${url} (or {url}) github url of the current project
# - ${project:<project_name>} base url of the documentation of <project_name>
# based on intersphinx_mapping.
# These comments will also be removed.
defaults:
numbered: False
maxdepth: 6
root: index
subtrees:
- caption: Install
entries:
- file: install/install.rst
title: Install with pip
- file: install/build-from-source.rst
title: Build from source
- caption: Reference
entries:
- url: https://lightgbm.readthedocs.io/en/v4.6.0/Python-Intro.html
title: Python quick start (upstream)
- url: https://lightgbm.readthedocs.io/en/v4.6.0/Python-API.html
title: Python API (upstream)
- caption: Tutorial
entries:
- url: https://github.com/ROCm/rocm-finance/tree/${branch}/examples/lightgbm
title: Examples
- caption: About
entries:
- file: about/license.rst
title: License
rocm-docs-core==1.31.0
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --cert=None --client-cert=None --index-url=None --pip-args=None amd-docs/sphinx/requirements.in
#
accessible-pygments==0.0.5
# via pydata-sphinx-theme
alabaster==1.0.0
# via sphinx
asttokens==3.0.1
# via stack-data
attrs==25.4.0
# via
# jsonschema
# jupyter-cache
# referencing
babel==2.17.0
# via
# pydata-sphinx-theme
# sphinx
beautifulsoup4==4.14.3
# via pydata-sphinx-theme
breathe==4.36.0
# via rocm-docs-core
certifi==2025.11.12
# via requests
cffi==2.0.0
# via
# cryptography
# pynacl
charset-normalizer==3.4.4
# via requests
click==8.3.1
# via
# jupyter-cache
# sphinx-external-toc
comm==0.2.3
# via ipykernel
cryptography==46.0.3
# via pyjwt
debugpy==1.8.17
# via ipykernel
decorator==5.2.1
# via ipython
docutils==0.21.2
# via
# myst-parser
# pydata-sphinx-theme
# sphinx
exceptiongroup==1.3.1
# via ipython
executing==2.2.1
# via stack-data
fastjsonschema==2.21.2
# via
# nbformat
# rocm-docs-core
gitdb==4.0.12
# via gitpython
gitpython==3.1.45
# via rocm-docs-core
greenlet==3.3.0
# via sqlalchemy
idna==3.11
# via requests
imagesize==1.4.1
# via sphinx
importlib-metadata==8.7.0
# via
# jupyter-cache
# myst-nb
ipykernel==7.1.0
# via myst-nb
ipython==8.37.0
# via
# ipykernel
# myst-nb
jedi==0.19.2
# via ipython
jinja2==3.1.6
# via
# myst-parser
# sphinx
jsonschema==4.25.1
# via nbformat
jsonschema-specifications==2025.9.1
# via jsonschema
jupyter-cache==1.0.1
# via myst-nb
jupyter-client==8.6.3
# via
# ipykernel
# nbclient
jupyter-core==5.9.1
# via
# ipykernel
# jupyter-client
# nbclient
# nbformat
markdown-it-py==3.0.0
# via
# mdit-py-plugins
# myst-parser
markupsafe==3.0.3
# via jinja2
matplotlib-inline==0.2.1
# via
# ipykernel
# ipython
mdit-py-plugins==0.5.0
# via myst-parser
mdurl==0.1.2
# via markdown-it-py
myst-nb==1.3.0
# via rocm-docs-core
myst-parser==4.0.1
# via myst-nb
nbclient==0.10.2
# via
# jupyter-cache
# myst-nb
nbformat==5.10.4
# via
# jupyter-cache
# myst-nb
# nbclient
nest-asyncio==1.6.0
# via ipykernel
packaging==25.0
# via
# ipykernel
# pydata-sphinx-theme
# sphinx
parso==0.8.5
# via jedi
pexpect==4.9.0
# via ipython
platformdirs==4.5.1
# via jupyter-core
prompt-toolkit==3.0.52
# via ipython
psutil==7.1.3
# via ipykernel
ptyprocess==0.7.0
# via pexpect
pure-eval==0.2.3
# via stack-data
pycparser==2.23
# via cffi
pydata-sphinx-theme==0.15.4
# via
# rocm-docs-core
# sphinx-book-theme
pygithub==2.8.1
# via rocm-docs-core
pygments==2.19.2
# via
# accessible-pygments
# ipython
# pydata-sphinx-theme
# sphinx
pyjwt[crypto]==2.10.1
# via pygithub
pynacl==1.6.1
# via pygithub
python-dateutil==2.9.0.post0
# via jupyter-client
pyyaml==6.0.3
# via
# jupyter-cache
# myst-nb
# myst-parser
# rocm-docs-core
# sphinx-external-toc
pyzmq==27.1.0
# via
# ipykernel
# jupyter-client
referencing==0.37.0
# via
# jsonschema
# jsonschema-specifications
requests==2.32.5
# via
# pygithub
# sphinx
rocm-docs-core==1.31.0
# via -r amd-docs/sphinx/requirements.in
rpds-py==0.30.0
# via
# jsonschema
# referencing
six==1.17.0
# via python-dateutil
smmap==5.0.2
# via gitdb
snowballstemmer==3.0.1
# via sphinx
soupsieve==2.8
# via beautifulsoup4
sphinx==8.1.3
# via
# breathe
# myst-nb
# myst-parser
# pydata-sphinx-theme
# rocm-docs-core
# sphinx-book-theme
# sphinx-copybutton
# sphinx-design
# sphinx-external-toc
# sphinx-notfound-page
sphinx-book-theme==1.1.4
# via rocm-docs-core
sphinx-copybutton==0.5.2
# via rocm-docs-core
sphinx-design==0.6.1
# via rocm-docs-core
sphinx-external-toc==1.0.1
# via rocm-docs-core
sphinx-notfound-page==1.1.0
# via rocm-docs-core
sphinxcontrib-applehelp==2.0.0
# via sphinx
sphinxcontrib-devhelp==2.0.0
# via sphinx
sphinxcontrib-htmlhelp==2.1.0
# via sphinx
sphinxcontrib-jsmath==1.0.1
# via sphinx
sphinxcontrib-qthelp==2.0.0
# via sphinx
sphinxcontrib-serializinghtml==2.0.0
# via sphinx
sqlalchemy==2.0.44
# via jupyter-cache
stack-data==0.6.3
# via ipython
tabulate==0.9.0
# via jupyter-cache
tomli==2.3.0
# via sphinx
tornado==6.5.2
# via
# ipykernel
# jupyter-client
traitlets==5.14.3
# via
# ipykernel
# ipython
# jupyter-client
# jupyter-core
# matplotlib-inline
# nbclient
# nbformat
typing-extensions==4.15.0
# via
# beautifulsoup4
# cryptography
# exceptiongroup
# ipython
# myst-nb
# pydata-sphinx-theme
# pygithub
# referencing
# sqlalchemy
urllib3==2.6.1
# via
# pygithub
# requests
wcwidth==0.2.14
# via prompt-toolkit
zipp==3.23.0
# via importlib-metadata
...@@ -21,12 +21,13 @@ dependencies = [ ...@@ -21,12 +21,13 @@ dependencies = [
"numpy>=1.17.0", "numpy>=1.17.0",
"scipy" "scipy"
] ]
description = "LightGBM Python-package" description = "ROCm Port of LightGBM Python-package"
license = {file = "LICENSE"} license = {file = "LICENSE"}
maintainers = [ maintainers = [
{name = "Yu Shi", email = "yushi@microsoft.com"} {name = "Yu Shi", email = "yushi@microsoft.com"},
{name = "Advanced Micro Devices Inc"}
] ]
name = "lightgbm" name = "amd_lightgbm"
readme = "README.rst" readme = "README.rst"
requires-python = ">=3.9" requires-python = ">=3.9"
version = "4.6.0.99" version = "4.6.0.99"
...@@ -52,10 +53,9 @@ scikit-learn = [ ...@@ -52,10 +53,9 @@ scikit-learn = [
] ]
[project.urls] [project.urls]
homepage = "https://github.com/microsoft/LightGBM" homepage = "https://github.com/rocm/LightGBM"
documentation = "https://lightgbm.readthedocs.io/en/latest/" documentation = "https://rocm.docs.amd.com/projects/lightgbm/en/latest/index.html"
repository = "https://github.com/microsoft/LightGBM.git" repository = "https://github.com/rocm/LightGBM.git"
changelog = "https://github.com/microsoft/LightGBM/releases"
# start:build-system # start:build-system
[build-system] [build-system]
...@@ -76,6 +76,7 @@ wheel.py-api = "py3" ...@@ -76,6 +76,7 @@ wheel.py-api = "py3"
experimental = false experimental = false
strict-config = false strict-config = false
minimum-version = "build-system.requires" minimum-version = "build-system.requires"
wheel.packages = ["lightgbm"]
[tool.scikit-build.cmake] [tool.scikit-build.cmake]
version = "CMakeLists.txt" version = "CMakeLists.txt"
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <cmath> #include <cmath>
#include <cstdlib> #include <cstdlib>
#include <vector>
using LightGBM::ArrowChunkedArray; using LightGBM::ArrowChunkedArray;
using LightGBM::ArrowTable; using LightGBM::ArrowTable;
...@@ -153,39 +152,7 @@ class ArrowChunkedArrayTest : public testing::Test { ...@@ -153,39 +152,7 @@ class ArrowChunkedArrayTest : public testing::Test {
/* ------------------------------------- SCHEMA CREATION ------------------------------------- */ /* ------------------------------------- SCHEMA CREATION ------------------------------------- */
template <typename T> template <typename T>
ArrowSchema create_primitive_schema() { ArrowSchema create_primitive_schema();
std::logic_error("not implemented");
}
template <>
ArrowSchema create_primitive_schema<float>() {
ArrowSchema schema;
schema.format = "f";
schema.name = nullptr;
schema.metadata = nullptr;
schema.flags = 0;
schema.n_children = 0;
schema.children = nullptr;
schema.dictionary = nullptr;
schema.release = nullptr;
schema.private_data = nullptr;
return schema;
}
template <>
ArrowSchema create_primitive_schema<bool>() {
ArrowSchema schema;
schema.format = "b";
schema.name = nullptr;
schema.metadata = nullptr;
schema.flags = 0;
schema.n_children = 0;
schema.children = nullptr;
schema.dictionary = nullptr;
schema.release = nullptr;
schema.private_data = nullptr;
return schema;
}
ArrowSchema create_nested_schema(const std::vector<ArrowSchema*>& arrays) { ArrowSchema create_nested_schema(const std::vector<ArrowSchema*>& arrays) {
auto children = static_cast<ArrowSchema**>(malloc(sizeof(ArrowSchema*) * arrays.size())); auto children = static_cast<ArrowSchema**>(malloc(sizeof(ArrowSchema*) * arrays.size()));
...@@ -209,6 +176,37 @@ class ArrowChunkedArrayTest : public testing::Test { ...@@ -209,6 +176,37 @@ class ArrowChunkedArrayTest : public testing::Test {
} }
}; };
/* explicit specializations must be defined outside the class */
template <>
ArrowSchema ArrowChunkedArrayTest::create_primitive_schema<float>() {
ArrowSchema schema;
schema.format = "f";
schema.name = nullptr;
schema.metadata = nullptr;
schema.flags = 0;
schema.n_children = 0;
schema.children = nullptr;
schema.dictionary = nullptr;
schema.release = nullptr;
schema.private_data = nullptr;
return schema;
}
template <>
ArrowSchema ArrowChunkedArrayTest::create_primitive_schema<bool>() {
ArrowSchema schema;
schema.format = "b";
schema.name = nullptr;
schema.metadata = nullptr;
schema.flags = 0;
schema.n_children = 0;
schema.children = nullptr;
schema.dictionary = nullptr;
schema.release = nullptr;
schema.private_data = nullptr;
return schema;
}
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
/* TESTS */ /* TESTS */
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
......
...@@ -505,7 +505,7 @@ def test_consistent_state_for_dataset_fields(): ...@@ -505,7 +505,7 @@ def test_consistent_state_for_dataset_fields():
lgb_data.set_feature_name(feature_names) lgb_data.set_feature_name(feature_names)
check_asserts(lgb_data) check_asserts(lgb_data)
@pytest.mark.skip(reason="Skipping this test as Positions in learning to rank is not supported in CUDA version yet.")
def test_dataset_construction_overwrites_user_provided_metadata_fields(): def test_dataset_construction_overwrites_user_provided_metadata_fields():
X = np.array([[1.0, 2.0], [3.0, 4.0]]) X = np.array([[1.0, 2.0], [3.0, 4.0]])
...@@ -1034,6 +1034,7 @@ def test_equal_datasets_from_one_and_several_matrices_w_different_layouts(rng, t ...@@ -1034,6 +1034,7 @@ def test_equal_datasets_from_one_and_several_matrices_w_different_layouts(rng, t
"weight", "weight",
], ],
) )
@pytest.mark.skip(reason="Skipping this test as Positions in learning to rank is not supported in CUDA version yet.")
def test_set_field_none_removes_field(rng, field_name): def test_set_field_none_removes_field(rng, field_name):
X = rng.uniform(size=(10, 1)) X = rng.uniform(size=(10, 1))
d = lgb.Dataset(X).construct() d = lgb.Dataset(X).construct()
......
...@@ -794,6 +794,7 @@ def test_ranking_with_position_information_with_file(tmp_path): ...@@ -794,6 +794,7 @@ def test_ranking_with_position_information_with_file(tmp_path):
@pytest.mark.skipif( @pytest.mark.skipif(
getenv("TASK", "") == "cuda", reason="Positions in learning to rank is not supported in CUDA version yet" getenv("TASK", "") == "cuda", reason="Positions in learning to rank is not supported in CUDA version yet"
) )
@pytest.mark.skip(reason="Skipping this test as Positions in learning to rank is not supported in CUDA version yet.")
def test_ranking_with_position_information_with_dataset_constructor(tmp_path): def test_ranking_with_position_information_with_dataset_constructor(tmp_path):
rank_example_dir = Path(__file__).absolute().parents[2] / "examples" / "lambdarank" rank_example_dir = Path(__file__).absolute().parents[2] / "examples" / "lambdarank"
params = { params = {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment