Build with C++20 and use std::format #1229
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1229"
general
weight: 0.35
gigony
<!--
Thank you for contributing to cuCIM :)
Here are some guidelines to help the review process go smoothly.
1. Please write a description in this text box of the changes that are being
made.
2. Please ensure that you have written units tests for the changes made/features
added.
3. If you are closing an issue please use one of the automatic closing words as
noted here: https://help.github.com/articles/closing-issues-using-keywords/
4. If your pull request is not ready for review but you want to make use of the
continuous integration testing facilities please label it with
[WIP].5. If your pull request is ready to be reviewed without requiring additional
work on top of it, then remove the
[WIP]label (if present) and replaceit with
[REVIEW]. If assistance is required to complete the functionality,for example when the C/C++ code of a feature is complete but Python bindings
are still required, then add the label
[HELP-REQ]so that others can triageand assist. The additional changes then can be implemented on top of the
same PR. If the assistance is done by members of the rapidsAI team, then no
additional actions are required by the creator of the original PR for this,
otherwise the original author of the PR needs to give permission to the
person(s) assisting to commit to their personal fork of the project. If that
doesn't happen then a new PR based on the code of the original PR can be
opened by the person assisting, which then will be the PR that will be
merged.
6. Once all work has been done and review has taken place please do not add
features or make changes out of the scope of those requested by the reviewer
(doing this just add delays as already reviewed code ends up having to be
re-reviewed/it is hard to tell what is new etc!). Further, please do not
rebase your branch on main/force push/rewrite history, doing any of these
causes the context of any comments made by reviewers to be lost. If
conflicts occur against main they should be resolved by merging main
into the branch used for making the pull request.
Many thanks in advance for your cooperation!
-->
This PR builds cuCIM as C++20, as #1191 proposes, and moves cuCIM's own sources from fmt to the C++20 standard library, so fmt is no longer a dependency. The rest of RAPIDS and Holoscan already build as C++20.
Closes #1191.
Who is affected
<format>, which GCC provides from version 13. The conda recipes pin GCC 14, and the CI wheel image usesgcc-toolset-14.<format>as well:- The exported
cucim::cucimCMake target requirescxx_std_20, so CMake compiles targets that link it as C++20 or newer.- The installed headers
cucim/util/cuda.handcucim/memory/dlpack.h, and the newcucim/util/print.h, include<format>.- The install no longer ships fmt headers under
include/cucim/3rdpartyor exportscucim::fmt-header-only. Code that got fmt from cuCIM's install has to get it elsewhere.Commits
1. Build with C++20. Every first-party CMake project (libcucim, the GDS stub, the three plugins, the Python bindings, and their tests, benchmarks, and examples) moves from C++17 to C++20. The libcucim compile feature stays
PRIVATEin this commit. Three small fixes keep the-Werrorbuild passing:-
Timer::printpasses a runtime format string tofmt::print, which fmt only accepts throughfmt::runtimein C++20 mode.- cuCIM's
libcuckoo.patchreplacesstd::is_pod, which C++20 deprecates, withstd::is_standard_layoutandstd::is_trivial. Commit 7 drops this hunk again.- cuslide2's
TIFF::construct_ifdsshrinks a non-empty vector witheraseinstead ofresize(1), which avoids a false GCC 14-Warray-boundserror.2. Use std::format instead of fmt::format. 164 calls in 35 files change. This commit leaves
fmt::print,fmt::join, and thefmt::formatcalls in the installed headers on fmt.3. Remove the fmt dependency.
- Adds
cucim/util/print.hwithcucim::printandcucim::vprint, which format withstd::vformatand write withstd::fwrite, because C++20 has nostd::print. 319fmt::printcalls in 24 files move to these helpers, including the two inTimer::printthat neededfmt::runtime.- Converts the installed headers
cucim/util/cuda.handcucim/memory/dlpack.htostd::formatandcucim::print, and makes libcucim'scxx_std_20compile featurePUBLIC.- Replaces
fmt::joinin cuslide2'snvimgcodec_tiff_parser.cppand inexamples/cpp/tiff_image/main.cppwith small loops overstd::format_to.- Removes the remaining
<fmt/...>includes, adds<cstring>to two files that got it through fmt, and removes fmt from every CMake project, the install, and the third-party license files.4. Find Git before applying cuslide dependency patches. The cuslide plugin patches libjpeg-turbo, libopenjpeg, and libtiff with
${GIT_EXECUTABLE}, which was set only because fmt was the first dependency the plugin fetched. Each of the three files now callsfind_package(Git REQUIRED), as libcucim's dependency files already do.5. Report failed writes from cucim::print.
cucim::vprintthrowsstd::system_errorwhenfwritewrites fewer bytes than were formatted, asfmt::printdid. The newcpp/tests/test_print.cppcovers a normal write and an unbuffered write to/dev/full.6. Update C++17 references in nvcc comments to C++20. 16 CMake comments quoted nvcc's error for
-std=c++17. No other C++17 references remain.7. Upgrade libcuckoo to v0.3.1. v0.3.1 contains the
std::is_podfix from commit 1, solibcuckoo.patchdrops that hunk. The CMake hunk is regenerated for v0.3.1, and the Boost.Interprocess hunks are unchanged.8. Note the planned move to std::print in print.h. The comment points to #1258.
9. Update commented-out fmt calls to cucim::print and std::format. The commented-out debug code in
cufile_driver.cpp,image_cache_shared_memory.cpp, andtest_metadata.cppno longer names fmt.Follow-up issues
cucim::printwithstd::printonce cuCIM builds with C++23.libcuckoo.patchare still needed with libcuckoo v0.3.1.Validation
The branch is based on
release/26.12at938324c4. It merges cleanly with the currentrelease/26.12(8e879475), whose only newer commit, #1196, changes Python files that this PR does not touch.CI on
71332ca8. Run 45316708818 passed all 39 checks:Local checks on
71332ca8. These ran on x86_64 with GCC 14, CUDA 13.3, and CMake 4.4.-Wclobberedwarnings in cuslide'slibjpeg_turbo.cpp, which predate this PR. CMake compiles that file with-Wno-error.cucim::printtest cases pass. Before commit 5, the/dev/fullcase failed.tests/unit/claragives 153 passed and 16 skipped. Fifteen of the skipped tests need the cuslide2 plugin, which was left out because the local environment has nvImageCodec 0.9 and cuslide2 needs 0.10. The other skipped test is marked as failing (gh-626).shared_memorycache serves the second pass from the cache. The pixels matchtifffileand an uncached read.libcuckoo v0.3 and v0.3.1. On the previous base,
tests/unit/claragave the same outcome for each of its 153 tests with both versions, and the shared-memory check passed with both.Not covered: the C++ test binaries other than the
cucim::printtests (CI does not run them either), the shared-memory cache used from more than one process (see #1260), compilers other than GCC 14, and a C++ program that consumes the new install. Some converted calls are not compiled by any target: those in cuslide2'stests/test_read_rawtiff.cpp, which no CMake target lists, those in macro bodies in cuslide'stests/test_read_rawtiff.cppthat are never expanded, and those in cuslide2'stiff/ifd.cppin the branch for builds without nvImageCodec.