ringkernel_accnet/cuda/
mod.rs1#[cfg(feature = "cuda")]
9pub mod codegen;
10#[cfg(feature = "cuda")]
11pub mod executor;
12pub mod runtime;
13
14#[cfg(feature = "cuda")]
15pub use codegen::*;
16#[cfg(feature = "cuda")]
17pub use executor::{BenchmarkResults, GpuAnalysisResult, GpuExecutor, KernelBenchmark};
18pub use runtime::{AnalysisRuntime, Backend, RuntimeStatus};
19
20#[derive(Debug, Clone)]
22pub struct CudaKernelConfig {
23 pub block_size: u32,
25 pub shared_mem_size: u32,
27 pub async_execution: bool,
29}
30
31impl Default for CudaKernelConfig {
32 fn default() -> Self {
33 Self {
34 block_size: 256,
35 shared_mem_size: 0,
36 async_execution: true,
37 }
38 }
39}
40
41#[derive(Debug, Clone, Copy, PartialEq, Eq)]
43pub enum CudaKernelType {
44 JournalTransform,
46 SuspenseDetection,
48 GaapViolation,
50 FraudPattern,
52 BenfordAnalysis,
54 PageRank,
56 CircularFlowDetection,
58 TemporalAnomaly,
60}
61
62impl CudaKernelType {
63 pub fn recommended_block_size(&self) -> u32 {
65 match self {
66 Self::JournalTransform => 256,
67 Self::SuspenseDetection => 128,
68 Self::GaapViolation => 256,
69 Self::FraudPattern => 128,
70 Self::BenfordAnalysis => 256,
71 Self::PageRank => 256,
72 Self::CircularFlowDetection => 64,
73 Self::TemporalAnomaly => 128,
74 }
75 }
76
77 pub fn name(&self) -> &'static str {
79 match self {
80 Self::JournalTransform => "journal_transform_kernel",
81 Self::SuspenseDetection => "suspense_detection_kernel",
82 Self::GaapViolation => "gaap_violation_kernel",
83 Self::FraudPattern => "fraud_pattern_kernel",
84 Self::BenfordAnalysis => "benford_analysis_kernel",
85 Self::PageRank => "pagerank_kernel",
86 Self::CircularFlowDetection => "circular_flow_kernel",
87 Self::TemporalAnomaly => "temporal_anomaly_kernel",
88 }
89 }
90}
91
92#[cfg(test)]
93mod tests {
94 use super::*;
95
96 #[test]
97 fn test_kernel_config() {
98 let config = CudaKernelConfig::default();
99 assert_eq!(config.block_size, 256);
100 }
101
102 #[test]
103 fn test_kernel_types() {
104 assert_eq!(
105 CudaKernelType::JournalTransform.name(),
106 "journal_transform_kernel"
107 );
108 assert_eq!(CudaKernelType::PageRank.recommended_block_size(), 256);
109 }
110}