Skip to content

Commit 3fe2eed

Browse files
committed
Merge rapidsai/release/26.02 into rapidsai/main
2 parents b7ea204 + 800203c commit 3fe2eed

30 files changed

+2111
-227
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- "main"
7+
- "release/*"
78
tags:
89
- v[0-9][0-9].[0-9][0-9].[0-9][0-9]
910
workflow_dispatch:

README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,42 @@ docker cp $tmp_id:/input notebooks
9999
docker rm -v ${tmp_id}
100100
```
101101

102+
## cuslide2 Plugin (Experimental)
103+
104+
cuCIM includes an experimental `cuslide2` plugin that uses [nvImageCodec](https://developer.nvidia.com/nvimagecodec) for GPU-accelerated TIFF decoding. This plugin provides enhanced performance for batch ROI decoding operations.
105+
106+
### Enabling cuslide2
107+
108+
To enable the cuslide2 plugin, set the `ENABLE_CUSLIDE2` environment variable:
109+
110+
```bash
111+
ENABLE_CUSLIDE2=1 python your_script.py
112+
```
113+
114+
### Test Scripts
115+
116+
cuCIM provides test scripts to verify cuslide2 functionality with different TIFF formats:
117+
118+
**Aperio SVS files:**
119+
120+
```bash
121+
# Download a sample SVS file and run the test
122+
python scripts/test_aperio_svs.py --download
123+
124+
# Or test with your own SVS file
125+
ENABLE_CUSLIDE2=1 python scripts/test_aperio_svs.py /path/to/your/file.svs
126+
```
127+
128+
**Philips TIFF files:**
129+
130+
```bash
131+
# Test with a Philips TIFF file
132+
ENABLE_CUSLIDE2=1 python scripts/test_philips_tiff.py /path/to/your/philips.tiff
133+
134+
# List available test options
135+
python scripts/test_philips_tiff.py --help
136+
```
137+
102138
## Build/Install from Source
103139

104140
See build [instructions](CONTRIBUTING.md#setting-up-your-build-environment).
@@ -119,4 +155,4 @@ is used in this project.
119155

120156
Apache-2.0 License (see [LICENSE](LICENSE) file).
121157

122-
Copyright (c) 2020-2025, NVIDIA CORPORATION.
158+
Copyright (c) 2020-2026, NVIDIA CORPORATION.

benchmarks/skimage/_image_bench.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. All rights reserved.
1+
# SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

44
import itertools
@@ -127,6 +127,17 @@ def _index(self, name, var_kwargs, dtype=None, shape=None):
127127
index += ", " + self.index_str
128128
return index
129129

130+
def _prep_kwargs_string(self, kwargs):
131+
params = []
132+
for k, v in kwargs.items():
133+
if isinstance(v, types.FunctionType):
134+
params.append(f"{k}={v.__name__}")
135+
elif isinstance(v, (np.ndarray, cp.ndarray)):
136+
params.append(f"{k}=array,shape={v.shape},dtype={v.dtype.name}")
137+
else:
138+
params.append(f"{k}={v}")
139+
return ", ".join(params)
140+
130141
def get_reps(self, func, args, kwargs, target_duration=5, cpu=True):
131142
if not cpu:
132143
# dry run
@@ -165,19 +176,22 @@ def run_benchmark(self, duration=3, verbose=True):
165176
if "brute_force" in var_kwargs_gpu:
166177
var_kwargs_gpu["brute_force"] = True
167178

168-
kw_cpu = {**self.fixed_kwargs_cpu, **var_kwargs_cpu}
169179
kw_gpu = {**self.fixed_kwargs_gpu, **var_kwargs_gpu}
170-
rep_kwargs_cpu = self.get_reps(
171-
self.func_cpu, self.args_cpu, kw_cpu, duration, cpu=True
172-
)
173180
rep_kwargs_gpu = self.get_reps(
174181
self.func_gpu, self.args_gpu, kw_gpu, duration, cpu=False
175182
)
176-
print("Number of Repetitions : ", rep_kwargs_gpu)
183+
print("Number of Repetitions (GPU): ", rep_kwargs_gpu)
184+
185+
if self.run_cpu is True:
186+
kw_cpu = {**self.fixed_kwargs_cpu, **var_kwargs_cpu}
187+
rep_kwargs_cpu = self.get_reps(
188+
self.func_cpu, self.args_cpu, kw_cpu, duration, cpu=True
189+
)
177190
perf_gpu = repeat(
178191
self.func_gpu, self.args_gpu, kw_gpu, **rep_kwargs_gpu
179192
)
180193

194+
df.at[index, "GPU: kwargs"] = self._prep_kwargs_string(kw_gpu)
181195
df.at[index, "shape"] = f"{self.shape}"
182196
# df.at[index, "description"] = index
183197
df.at[index, "function_name"] = self.function_name
@@ -194,6 +208,7 @@ def run_benchmark(self, duration=3, verbose=True):
194208
df.at[index, "CPU: host (mean)"] = perf.cpu_times.mean()
195209
df.at[index, "CPU: host (std)"] = perf.cpu_times.std()
196210

211+
df.at[index, "CPU: kwargs"] = self._prep_kwargs_string(kw_cpu)
197212
df.at[index, "GPU: host (mean)"] = perf_gpu.cpu_times.mean()
198213
df.at[index, "GPU: host (std)"] = perf_gpu.cpu_times.std()
199214
df.at[index, "GPU: device (mean)"] = perf_gpu.gpu_times.mean()
@@ -202,14 +217,14 @@ def run_benchmark(self, duration=3, verbose=True):
202217
props = cp.cuda.runtime.getDeviceProperties(device.id)
203218
gpu_name = props["name"].decode()
204219

205-
df.at[index, "GPU: DEV Name"] = [gpu_name for i in range(len(df))]
220+
df.at[index, "GPU: DEV Name"] = gpu_name
206221
cmd = "cat /proc/cpuinfo"
207222
cpuinfo = subprocess.check_output(cmd, shell=True).strip()
208223
cpu_name = (
209224
re.search("\nmodel name.*\n", cpuinfo.decode()).group(0).strip("\n")
210225
)
211226
cpu_name = cpu_name.replace("model name\t: ", "")
212-
df.at[index, "CPU: DEV Name"] = [cpu_name for i in range(len(df))]
227+
df.at[index, "CPU: DEV Name"] = cpu_name
213228

214229
# accelerations[arr_index] = df.at[index, "GPU accel"]
215230
if verbose:

benchmarks/skimage/cucim_restoration_bench.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. All rights reserved.
1+
# SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

44
import argparse
@@ -157,8 +157,6 @@ def main(args):
157157
module_gpu=cucim.skimage.restoration,
158158
run_cpu=run_cpu,
159159
)
160-
results = B.run_benchmark(duration=args.duration)
161-
all_results = pd.concat([all_results, results["full"]])
162160

163161
elif function_name in [
164162
"wiener",
@@ -175,8 +173,8 @@ def main(args):
175173
module_gpu=cucim.skimage.restoration,
176174
run_cpu=run_cpu,
177175
)
178-
results = B.run_benchmark(duration=args.duration)
179-
all_results = pd.concat([all_results, results["full"]])
176+
results = B.run_benchmark(duration=args.duration)
177+
all_results = pd.concat([all_results, results["full"]])
180178

181179
fbase = os.path.splitext(pfile)[0]
182180
all_results.to_csv(fbase + ".csv")
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
#!/bin/bash
2-
# SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION. All rights reserved.
2+
# SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION. All rights reserved.
33
# SPDX-License-Identifier: Apache-2.0
44

5+
# Use env var if set/non-empty, otherwise default to 10
6+
MAX_DURATION="${CUCIM_BENCHMARK_MAX_DURATION:-10}"
7+
58
param_shape=("512,512" "3840,2160" "192,192,192")
69
param_filt=(convert_colorspace rgb2hed hed2rgb lab2lch lch2lab xyz2lab lab2xyz rgba2rgb label2rgb)
710
param_dt=(float32 uint8)
811
for shape in "${param_shape[@]}"; do
912
for filt in "${param_filt[@]}"; do
1013
for dt in "${param_dt[@]}"; do
11-
python cucim_color_bench.py -f "$filt" -i "$shape" -d "$dt" -t 10
14+
python cucim_color_bench.py -f "$filt" -i "$shape" -d "$dt" -t "$MAX_DURATION"
1215
done
1316
done
1417
done
@@ -19,7 +22,7 @@ param_dt=("float32" "float64")
1922
for shape in "${param_shape[@]}"; do
2023
for filt in "${param_filt[@]}"; do
2124
for dt in "${param_dt[@]}"; do
22-
python cucim_color_bench.py -f "$filt" -i "$shape" -d "$dt" -t 10
25+
python cucim_color_bench.py -f "$filt" -i "$shape" -d "$dt" -t "$MAX_DURATION"
2326
done
2427
done
2528
done
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
#!/bin/bash
2-
# SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION. All rights reserved.
2+
# SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION. All rights reserved.
33
# SPDX-License-Identifier: Apache-2.0
44

5+
# Use env var if set/non-empty, otherwise default to 10
6+
MAX_DURATION="${CUCIM_BENCHMARK_MAX_DURATION:-10}"
7+
58
param_shape=("512,512" "3840,2160" "3840,2160,3" "192,192,192")
69
param_filt=(equalize_adapthist cumulative_distribution equalize_hist rescale_intensity adjust_gamma adjust_log adjust_sigmoid is_low_contrast match_histograms)
710
param_dt=(float32 uint8)
811
for shape in "${param_shape[@]}"; do
912
for filt in "${param_filt[@]}"; do
1013
for dt in "${param_dt[@]}"; do
11-
python cucim_exposure_bench.py -f "$filt" -i "$shape" -d "$dt" -t 10
14+
python cucim_exposure_bench.py -f "$filt" -i "$shape" -d "$dt" -t "$MAX_DURATION"
1215
done
1316
done
1417
done
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
#!/bin/bash
2-
# SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION. All rights reserved.
2+
# SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION. All rights reserved.
33
# SPDX-License-Identifier: Apache-2.0
44

5+
# Use env var if set/non-empty, otherwise default to 10
6+
MAX_DURATION="${CUCIM_BENCHMARK_MAX_DURATION:-10}"
7+
58
param_shape=("512,512" "3840,2160" "3840,2160,3" "192,192,192")
69
param_filt=(multiscale_basic_features canny daisy structure_tensor hessian_matrix hessian_matrix_det shape_index corner_kitchen_rosenfeld corner_harris corner_shi_tomasi corner_foerstner corner_peaks match_template blob_dog blob_log blob_doh)
710
param_dt=(float64 float32)
811
for shape in "${param_shape[@]}"; do
912
for filt in "${param_filt[@]}"; do
1013
for dt in "${param_dt[@]}"; do
11-
python cucim_feature_bench.py -f "$filt" -i "$shape" -d "$dt" -t 3
14+
python cucim_feature_bench.py -f "$filt" -i "$shape" -d "$dt" -t "$MAX_DURATION"
1215
done
1316
done
1417
done
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
#!/bin/bash
2-
# SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION. All rights reserved.
2+
# SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION. All rights reserved.
33
# SPDX-License-Identifier: Apache-2.0
44

5+
# Use env var if set/non-empty, otherwise default to 10
6+
MAX_DURATION="${CUCIM_BENCHMARK_MAX_DURATION:-10}"
7+
58
param_shape=("512,512" "3840,2160" "3840,2160,3" "192,192,192")
69
param_filt=(gabor gaussian median rank_order unsharp_mask sobel prewitt scharr roberts roberts_pos_diag roberts_neg_diag farid laplace meijering sato frangi hessian threshold_isodata threshold_otsu threshold_yen threshold_local threshold_li threshold_minimum threshold_mean threshold_triangle threshold_niblack threshold_sauvola apply_hysteresis_threshold threshold_multiotsu)
710
# param_filt=(rank_order )
811
param_dt=(float64 float32 float16)
912
for shape in "${param_shape[@]}"; do
1013
for filt in "${param_filt[@]}"; do
1114
for dt in "${param_dt[@]}"; do
12-
python cucim_filters_bench.py -f "$filt" -i "$shape" -d "$dt" -t 10
15+
python cucim_filters_bench.py -f "$filt" -i "$shape" -d "$dt" -t "$MAX_DURATION"
1316
done
1417
done
1518
done

benchmarks/skimage/run-nv-bench-measure.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
#!/bin/bash
2-
# SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION. All rights reserved.
2+
# SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION. All rights reserved.
33
# SPDX-License-Identifier: Apache-2.0
44

5+
# Use env var if set/non-empty, otherwise default to 10
6+
MAX_DURATION="${CUCIM_BENCHMARK_MAX_DURATION:-10}"
7+
58
param_shape=("512,512" "3840,2160" "3840,2160,3" "192,192,192")
69
param_filt=(label regionprops moments moments_central centroid inertia_tensor inertia_tensor_eigvals block_reduce shannon_entropy profile_line)
710
param_dt=(float32 uint8)
811
for shape in "${param_shape[@]}"; do
912
for filt in "${param_filt[@]}"; do
1013
for dt in "${param_dt[@]}"; do
11-
python cucim_measure_bench.py -f "$filt" -i "$shape" -d "$dt" -t 10
14+
python cucim_measure_bench.py -f "$filt" -i "$shape" -d "$dt" -t "$MAX_DURATION"
1215
done
1316
done
1417
done
@@ -21,7 +24,7 @@ done
2124
# for shape in "${param_shape[@]}"; do
2225
# for filt in "${param_filt[@]}"; do
2326
# for dt in "${param_dt[@]}"; do
24-
# python cucim_measure_bench.py -f $filt -i $shape -d $dt -t 10
27+
# python cucim_measure_bench.py -f $filt -i $shape -d $dt -t "$MAX_DURATION"
2528
# done
2629
# done
2730
# done
@@ -33,7 +36,7 @@ done
3336
# for shape in "${param_shape[@]}"; do
3437
# for filt in "${param_filt[@]}"; do
3538
# for dt in "${param_dt[@]}"; do
36-
# python cucim_measure_bench.py -f $filt -i $shape -d $dt -t 10
39+
# python cucim_measure_bench.py -f $filt -i $shape -d $dt -t "$MAX_DURATION"
3740
# done
3841
# done
3942
# done

benchmarks/skimage/run-nv-bench-metrics.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
#!/bin/bash
2-
# SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION. All rights reserved.
2+
# SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION. All rights reserved.
33
# SPDX-License-Identifier: Apache-2.0
44

5+
# Use env var if set/non-empty, otherwise default to 10
6+
MAX_DURATION="${CUCIM_BENCHMARK_MAX_DURATION:-10}"
7+
58
param_shape=("512,512" "3840,2160" "3840,2160,3" "192,192,192")
69
param_filt=(structural_similarity mean_squared_error normalized_root_mse peak_signal_noise_ratio normalized_mutual_information)
710
param_dt=(float32 uint8)
811
for shape in "${param_shape[@]}"; do
912
for filt in "${param_filt[@]}"; do
1013
for dt in "${param_dt[@]}"; do
11-
python cucim_metrics_bench.py -f "$filt" -i "$shape" -d "$dt" -t 4
14+
python cucim_metrics_bench.py -f "$filt" -i "$shape" -d "$dt" -t "$MAX_DURATION"
1215
done
1316
done
1417
done
@@ -20,7 +23,7 @@ param_dt=(uint8)
2023
for shape in "${param_shape[@]}"; do
2124
for filt in "${param_filt[@]}"; do
2225
for dt in "${param_dt[@]}"; do
23-
python cucim_metrics_bench.py -f "$filt" -i "$shape" -d "$dt" -t 4
26+
python cucim_metrics_bench.py -f "$filt" -i "$shape" -d "$dt" -t "$MAX_DURATION"
2427
done
2528
done
2629
done

0 commit comments

Comments
 (0)