This allows us to use single-source CUDA in binary-only crates (ones without lib.rs
).
New approach might seem a bit hacky with overriding Cargo behavior and enforcing --crate-type dylib
, but in the end, development workflow became much more convinient.
The crate does not provide a default panic_handler
anymore.
From now on, it either up to a user, or other crates (e.g. coming soon ptx-support
crate).
Next workaround should work in common cases, although it doesn't provide any panic details in runtime: ``` rust
unsafe fn breakpointpanichandler(: &::core::panic::PanicInfo) -> ! { core::intrinsics::breakpoint(); core::hint::unreachableunchecked(); } ```
build.rs
script was never so compact and clear before:
``` rust
use ptxbuilder::error::Result;
use ptxbuilder::prelude::*;
fn main() -> Result<()> { CargoAdapter::withenvvar("KERNELPTXPATH").build(Builder::new(".")?); } ```
This release comes with a significant documentation improvement! Check on docs.rs :)
The library should facilitate CUDA development with Rust. It can be used in a cargo build script of a host crate, and take responsibility for building device crates.
[PTX] Unable to get target details
[PTX]
[PTX] caused by:
[PTX] Command not found in PATH: 'ptx-linker'. You can install it with: 'cargo install ptx-linker'.
The library depends on ptx-linker and xargo.
Both can be installed from crates.io:
cargo install xargo
cargo install ptx-linker
Unfortunately, due to rustc-llvm-proxy#1 MSVS targets are not supported yet.
You might face similar errors:
Unable to find symbol 'LLVMContextCreate' in the LLVM shared lib
For now the only solution is to use GNU targets.
First, you need to specify a build script in host crate's Cargo.toml
and declare the library as a build-dependency:
toml
[build-dependencies]
ptx-builder = "0.5"
Then, typical build.rs
might look like:
``` rust
use ptxbuilder::error::Result;
use ptxbuilder::prelude::*;
fn main() -> Result<()> { CargoAdapter::withenvvar("KERNELPTXPATH").build(Builder::new(".")?); } ```