pub struct CudaModule {
pub includes: Vec<String>,
pub constant_decls: Vec<(CudaType, String, Option<CudaExpr>)>,
pub device_functions: Vec<DeviceFunction>,
pub kernels: Vec<CudaKernel>,
pub host_code: Vec<String>,
}Expand description
Top-level CUDA module representing a single .cu file.
Fields§
§includes: Vec<String>#include directives (just the header names, e.g. "cuda_runtime.h")
constant_decls: Vec<(CudaType, String, Option<CudaExpr>)>__constant__ memory declarations at file scope
device_functions: Vec<DeviceFunction>__device__ (or __host__ __device__) helper functions
kernels: Vec<CudaKernel>__global__ kernels
host_code: Vec<String>Host-side code (helper functions, main, etc.) as raw strings
Implementations§
Source§impl CudaModule
impl CudaModule
Sourcepub fn add_include(self, header: impl Into<String>) -> Self
pub fn add_include(self, header: impl Into<String>) -> Self
Add an #include (just the name; angle brackets / quotes are added by emitter).
Sourcepub fn add_constant(
self,
ty: CudaType,
name: impl Into<String>,
init: Option<CudaExpr>,
) -> Self
pub fn add_constant( self, ty: CudaType, name: impl Into<String>, init: Option<CudaExpr>, ) -> Self
Declare a __constant__ variable at file scope.
Sourcepub fn add_device_function(self, f: DeviceFunction) -> Self
pub fn add_device_function(self, f: DeviceFunction) -> Self
Add a device function.
Sourcepub fn add_kernel(self, k: CudaKernel) -> Self
pub fn add_kernel(self, k: CudaKernel) -> Self
Add a kernel.
Sourcepub fn add_host_code(self, code: impl Into<String>) -> Self
pub fn add_host_code(self, code: impl Into<String>) -> Self
Append raw host-side C++ code.
Trait Implementations§
Source§impl Clone for CudaModule
impl Clone for CudaModule
Source§fn clone(&self) -> CudaModule
fn clone(&self) -> CudaModule
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CudaModule
impl Debug for CudaModule
Source§impl Default for CudaModule
impl Default for CudaModule
Source§impl PartialEq for CudaModule
impl PartialEq for CudaModule
impl StructuralPartialEq for CudaModule
Auto Trait Implementations§
impl Freeze for CudaModule
impl RefUnwindSafe for CudaModule
impl Send for CudaModule
impl Sync for CudaModule
impl Unpin for CudaModule
impl UnsafeUnpin for CudaModule
impl UnwindSafe for CudaModule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more