accel-derive
Procedural-macro crate for #[kernel]
Requirements
Install nightly-2020-01-02 toolchain
rustup toolchain add nightly-2020-01-02 --profile minimal
and rust-ptx-linker
cargo install ptx-linker -f
#[accel_derive::kernel]
#[kernel]
function will be converted to two part:
- Device code will be compiled into PTX assembler
- Host code which call the generated device code (PTX asm) using
accel::module
API
Generate PTX assember
use kernel;
// Strings in `()` will be parsed as TOML
pub unsafe
will generate a crate with a device code
pub unsafe extern "ptx-kernel"
and Cargo.toml
[]
= "0.2.0-alpha"
This crate will be compiled into PTX assembler using nvptx64-nvidia-cuda
target.
nvptx64-nvidia-cuda
target does not support libstd currently.
You need to write codes in no_std
manner.
Kernel launcher
On the other hand, corresponding host code will also generated:
use ;
where {{PTX_STRING}}
is a PTX assembler string compiled from the device code.
This can be called like following:
let grid = x;
let block = x;
add;