Common build and runtime questions, distilled from GitHub issues.
Unresolved __std_* symbols (__std_find_trivial_*, __std_max_element_*,
__std_search_*, ...) mean the linker's MSVC STL is too old. The prebuilt
ONNX Runtime binaries that ort-sys downloads are compiled with Visual
Studio 2022 (MSVC v143) and reference vectorized STL helpers that do not
exist in the VS 2019 (v142) link libraries.
Fix:
- Install Visual Studio 2022 or Build Tools for Visual Studio 2022 with the "Desktop development with C++" workload (MSVC v143 + Windows SDK).
- Run
cargo cleanand rebuild — rustc picks the newest installed MSVC toolset automatically.
VS 2019 and VS 2022 build tools can coexist; only the newer one needs to be present for linking. (See issue #105.)
Expected. The tiny/small models are so small that per-call overhead — host↔device tensor copies, kernel launches, CPU/GPU synchronization, plus pre/post-processing that always runs on the CPU — outweighs the compute the GPU saves. Measured on an RTX 4090 + i9-13900KF (single image, warmup excluded):
| Model | CPU | GPU (CUDA EP) |
|---|---|---|
| tiny | 34 ms/img | 44 ms/img |
| small | 59 ms/img | 77 ms/img |
| medium | 404 ms/img | 173 ms/img (2.3× faster) |
Guidelines:
- For tiny/small, use the default CPU mode (the
simdfeature is on by default). - Use the medium model, or batch several images per
predict()call, when GPU acceleration matters. - Exclude the first call when benchmarking: it includes cuDNN initialization and algorithm selection (~5× slower than steady state).
Also note that requesting OrtExecutionProvider::CUDA without building with
--features cuda makes the pipeline builder return an error — check the
Result of .build(). Without the cuda feature, the downloaded ONNX
Runtime is CPU-only and the GPU is never used.
(See issue #151.)