Crate ucc

source ·
Expand description

The universal compiler invocation library for Rust-CXX-CUDA interoperation and dependency management.

This crate serves as a universal bridge between Rust code and heterogeneous C++/CUDA/.. codes. It does the following work:

  • Manages and exports/imports the C++ headers between crates, through export_csrc. This feature makes use of the Cargo dependency management framework to conveniently manage C++/CUDA code dependencies.

  • Compile C++(OpenMP)/CUDA sources with out-of-the-box compilation settings and common platform detections.

  • Generates bindings of C++/CUDA host functions making use of ulib::UVec, through [bindgen].

Functions

  • Generate universal bindings for export "C" functions inside a specified c++/cuda source, and write that binding to a Rust source under OUT_DIR/uccbind.
  • This exports the csrc directory to the environment variable, so that it can be found and included by crates that depend on the current crate.
  • This imports the csrc directory of all direct dependency crates that were exported using export_csrc, save their files in a temp dir inside OUT_DIR, and return the path of that dir. If that dir is used as include search path, you can then use #include <crates/{crate name}/xxx.hpp> to include the csrc/xxx.hpp file in the dependency.