Skip to content

Commit 8594330

Browse files
sebergRAMitchell
andauthored
MAINT: Bump legate dependencies to 25.08 (#236)
* MAINT: Bump legate dependencies to 25.08 Signed-off-by: Sebastian Berg <sebastianb@nvidia.com> * Transition from tcb/span to cuda/std/span Signed-off-by: Sebastian Berg <sebastianb@nvidia.com> * Fix clang-tidy Signed-off-by: Sebastian Berg <sebastianb@nvidia.com> * Fix exp function * More fixes * One more 404 --------- Signed-off-by: Sebastian Berg <sebastianb@nvidia.com> Co-authored-by: Rory Mitchell <r.a.mitchell.nz@gmail.com>
1 parent 590a830 commit 8594330

21 files changed

Lines changed: 123 additions & 95 deletions

conda/environments/all_cuda-122.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ dependencies:
1515
- cuda-nvcc
1616
- cuda-toolkit
1717
- cuda-version>=12.2
18-
- cupynumeric==25.07.*,>=0.0.0.dev0
18+
- cupynumeric==25.08.*,>=0.0.0.dev0
1919
- hypothesis>=6
20-
- legate==25.07.*,>=0.0.0.dev0
20+
- legate==25.08.*,>=0.0.0.dev0
2121
- libcublas-dev
2222
- llvm-openmp
2323
- make

conda/recipes/legate-boost/conda_build_config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ gpu_enabled:
2626
- false
2727

2828
cupynumeric_version:
29-
- "=25.07.*,>=0.0.0.dev0"
29+
- "=25.08.*,>=0.0.0.dev0"
3030
legate_version:
31-
- "=25.07.*,>=0.0.0.dev0"
31+
- "=25.08.*,>=0.0.0.dev0"

dependencies.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ dependencies:
8181
- output_types: [conda, pyproject, requirements]
8282
packages:
8383
- cmake>=3.26.4,!=3.30.0
84-
- &legate legate==25.07.*,>=0.0.0.dev0
84+
- &legate legate==25.08.*,>=0.0.0.dev0
8585
- ninja>=1.11.1.1
8686
clang_tidy:
8787
common:
@@ -160,7 +160,7 @@ dependencies:
160160
- typing-extensions>=4.0
161161
- output_types: [conda, pyproject, requirements]
162162
packages:
163-
- cupynumeric==25.07.*,>=0.0.0.dev0
163+
- cupynumeric==25.08.*,>=0.0.0.dev0
164164
- *legate
165165
test:
166166
common:

legateboost/metrics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ def metric(self, y: cn.ndarray, pred: cn.ndarray, w: cn.ndarray) -> cn.ndarray:
343343
f = cn.log(pred) * (K - self.one) # undo softmax
344344
y_k = cn.full((y.size, K), -self.one / (K - self.one))
345345

346-
set_col_by_idx(y_k, y.astype(cn.int32), self.one)
347-
# y_k[cn.arange(y.size), y.astype(cn.int32)] = 1.0
346+
# y_k[cn.arange(y.size), y.astype(cn.int32)] = self.one
347+
y_k = set_col_by_idx(y_k, y.astype(cn.int32), self.one)
348348

349349
exp = cn.exp(-1 / K * cn.sum(y_k * f, axis=1))
350350
return (exp * w).sum() / w.sum()

legateboost/objectives.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ def gradient(self, y: cn.ndarray, pred: cn.ndarray) -> GradPair:
598598
f = cn.log(pred) * (K - 1) # undo softmax
599599
y_k = cn.full((y.size, K), -self.one / (K - self.one))
600600
labels = y.astype(cn.int32).squeeze()
601-
set_col_by_idx(y_k, labels, self.one)
601+
y_k = set_col_by_idx(y_k, labels, self.one)
602602
# y_k[cn.arange(y.size), labels] = 1.0
603603
exp = cn.exp(-1 / K * cn.sum(y_k * f, axis=1))
604604

legateboost/test/models/test_tree.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ def get_feature_distribution(model):
8282
histogram = cn.zeros(model.n_features_in_)
8383
for m in model:
8484
histogram += cn.histogram(
85-
m.feature, bins=model.n_features_in_, range=(0, model.n_features_in_)
85+
m.feature.astype(cn.int64),
86+
bins=model.n_features_in_,
87+
range=(0, model.n_features_in_),
8688
)[0]
8789
return histogram / histogram.sum()
8890

legateboost/test/test_examples.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import subprocess
55
import sys
66
from pathlib import Path
7+
from urllib.error import HTTPError
78

89
import pytest
910

@@ -29,7 +30,12 @@ def test_examples(path):
2930
os.environ["CI"] = "1"
3031
rel = path.relative_to(example_dir).with_suffix("")
3132
rel = str(rel).replace("/", ".")
32-
importlib.import_module(rel)
33+
# temporary openml issue, this try/catch could be removed once fixed
34+
# https://github.com/openml/OpenML/issues/1232
35+
try:
36+
importlib.import_module(rel)
37+
except HTTPError as e:
38+
print(f"HTTP error in {path}: {e}")
3339

3440

3541
notebooks = list(noteboook_dir.glob("*.ipynb"))
@@ -55,8 +61,13 @@ def test_notebooks(path):
5561
except subprocess.CalledProcessError as e:
5662
print(e.stderr.decode())
5763
raise e
58-
# import the script to run it in the existing python process
59-
importlib.import_module(path.stem)
64+
65+
# temporary openml issue, this try/catch could be removed once fixed
66+
# https://github.com/openml/OpenML/issues/1232
67+
try:
68+
importlib.import_module(path.stem)
69+
except HTTPError as e:
70+
print(f"HTTP error in {path}: {e}")
6071

6172

6273
def test_benchmark(benchmark_dir):

legateboost/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def pick_col_by_idx(a: cn.ndarray, b: cn.ndarray) -> cn.ndarray:
105105
return result.sum(axis=1)
106106

107107

108-
def set_col_by_idx(a: cn.ndarray, b: cn.ndarray, delta: float) -> None:
108+
def set_col_by_idx(a: cn.ndarray, b: cn.ndarray, delta: float) -> cn.ndarray:
109109
"""Alternative implementation for a[cn.arange(b.size), b] = delta."""
110110

111111
assert a.ndim == 2
@@ -116,7 +116,7 @@ def set_col_by_idx(a: cn.ndarray, b: cn.ndarray, delta: float) -> None:
116116
bools = b[:, cn.newaxis] == range[cn.newaxis, :]
117117
a -= a * bools
118118
a += delta * bools
119-
return
119+
return a
120120

121121

122122
def mod_col_by_idx(a: cn.ndarray, b: cn.ndarray, delta: float) -> None:

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ commit-files = ["legateboost/GIT_COMMIT"]
1212
matrix-entry = "cuda_suffixed=true"
1313
requires = [
1414
"cmake>=3.26.4,!=3.30.0",
15-
"legate==25.07.*,>=0.0.0.dev0",
15+
"legate==25.08.*,>=0.0.0.dev0",
1616
"ninja>=1.11.1.1",
1717
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit dependencies.yaml and run `rapids-dependency-file-generator`.
1818

@@ -31,8 +31,8 @@ classifiers = [
3131
"Programming Language :: Python :: 3.12",
3232
]
3333
dependencies = [
34-
"cupynumeric==25.07.*,>=0.0.0.dev0",
35-
"legate==25.07.*,>=0.0.0.dev0",
34+
"cupynumeric==25.08.*,>=0.0.0.dev0",
35+
"legate==25.08.*,>=0.0.0.dev0",
3636
"numpy<2",
3737
"scikit-learn>=1.6",
3838
"typing-extensions>=4.0",

src/cpp_utils/cpp_utils.cuh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,20 @@
1616

1717
#pragma once
1818

19+
#include "cpp_utils.h"
20+
1921
#include <nccl.h>
2022
#include <thrust/execution_policy.h>
2123
#include <thrust/system_error.h>
22-
#include <cstddef>
24+
25+
#include <cuda/std/span>
2326
#include <cstdio>
24-
#include <utility>
27+
#include <cstddef>
2528
#include <string>
26-
#include <tcb/span.hpp>
29+
#include <utility>
30+
2731
#include "legate.h"
2832
#include "legate/cuda/cuda.h"
29-
#include "cpp_utils.h"
3033

3134
namespace legateboost {
3235

@@ -96,7 +99,10 @@ inline void LaunchN(size_t n, cudaStream_t stream, const L& lambda)
9699
}
97100

98101
template <typename T>
99-
void AllReduce(legate::TaskContext context, tcb::span<T> x, ncclRedOp_t op, cudaStream_t stream)
102+
void AllReduce(legate::TaskContext context,
103+
cuda::std::span<T> x,
104+
ncclRedOp_t op,
105+
cudaStream_t stream)
100106
{
101107
const auto& domain = context.get_launch_domain();
102108
size_t const num_ranks = domain.get_volume();
@@ -123,7 +129,7 @@ void AllReduce(legate::TaskContext context, tcb::span<T> x, ncclRedOp_t op, cuda
123129
}
124130

125131
template <typename T>
126-
void SumAllReduce(legate::TaskContext context, tcb::span<T> x, cudaStream_t stream)
132+
void SumAllReduce(legate::TaskContext context, cuda::std::span<T> x, cudaStream_t stream)
127133
{
128134
AllReduce(context, x, ncclSum, stream);
129135
}

0 commit comments

Comments
 (0)