Struct bindgen_cuda::Builder

source ·
pub struct Builder { /* private fields */ }
Expand description

Core builder to setup the bindings options

Implementations§

source§

impl Builder

source

pub fn kernel_paths<P: Into<PathBuf>>(self, paths: Vec<P>) -> Self

Setup the kernel paths. All path must be set at once and be valid files.

let builder = bindgen_cuda::Builder::default().kernel_paths(vec!["src/mykernel.cu"]);
source

pub fn watch<T, P>(self, paths: T) -> Self
where T: IntoIterator<Item = P>, P: Into<PathBuf>,

Setup the paths that the lib depend on but does not need to build

let builder =
bindgen_cuda::Builder::default().watch(vec!["kernels/"]);
source

pub fn include_paths<P: Into<PathBuf>>(self, paths: Vec<P>) -> Self

Setup the kernel paths. All path must be set at once and be valid files.

let builder = bindgen_cuda::Builder::default().include_paths(vec!["src/mykernel.cuh"]);
source

pub fn kernel_paths_glob(self, glob: &str) -> Self

Setup the kernels with a glob.

let builder = bindgen_cuda::Builder::default().kernel_paths_glob("src/**/*.cu");
source

pub fn include_paths_glob(self, glob: &str) -> Self

Setup the include files with a glob.

let builder = bindgen_cuda::Builder::default().kernel_paths_glob("src/**/*.cuh");
source

pub fn out_dir<P: Into<PathBuf>>(self, out_dir: P) -> Self

Modifies the output directory. By default this is OUT_DIR

let builder = bindgen_cuda::Builder::default().out_dir("out/");
source

pub fn arg(self, arg: &'static str) -> Self

Sets up extra nvcc compile arguments.

let builder = bindgen_cuda::Builder::default().arg("--expt-relaxed-constexpr");
source

pub fn cuda_root<P>(&mut self, path: P)
where P: Into<PathBuf>,

Forces the cuda root to a specific directory. By default all standard directories will be visited.

let builder = bindgen_cuda::Builder::default().cuda_root("/usr/local/cuda");
source

pub fn build_lib<P>(self, out_file: P)
where P: Into<PathBuf>,

Consumes the builder and create a lib in the out_dir. It then needs to be linked against in your build.rs

let builder = bindgen_cuda::Builder::default().build_lib("libflash.a");
println!("cargo:rustc-link-lib=flash");
source

pub fn build_ptx(self) -> Result<Bindings, Error>

Consumes the builder and outputs 1 ptx file for each kernels found. This function returns Bindings which can then be unused to create a rust source file that will include those kernels.

let bindings = bindgen_cuda::Builder::default().build_ptx().unwrap();
bindings.write("src/lib.rs").unwrap();

Trait Implementations§

source§

impl Debug for Builder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Builder

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.