rstsr_openblas/rayon_auto_impl/
op_with_func.rs

1use crate::prelude_dev::*;
2
3/* #region impl op_func for DeviceRayonAutoImpl */
4
5impl<TA, TB, TC, D, F> DeviceOp_MutC_RefA_RefB_API<TA, TB, TC, D, F> for DeviceRayonAutoImpl
6where
7    TA: Clone + Send + Sync,
8    TB: Clone + Send + Sync,
9    TC: Clone + Send + Sync,
10    D: DimAPI,
11    F: Fn(&mut MaybeUninit<TC>, &TA, &TB) + ?Sized + Send + Sync,
12{
13    fn op_mutc_refa_refb_func(
14        &self,
15        c: &mut Vec<MaybeUninit<TC>>,
16        lc: &Layout<D>,
17        a: &Vec<TA>,
18        la: &Layout<D>,
19        b: &Vec<TB>,
20        lb: &Layout<D>,
21        f: &mut F,
22    ) -> Result<()> {
23        let pool = self.get_current_pool();
24        op_mutc_refa_refb_func_cpu_rayon(c, lc, a, la, b, lb, f, pool)
25    }
26}
27
28impl<TA, TB, TC, D, F> DeviceOp_MutC_RefA_NumB_API<TA, TB, TC, D, F> for DeviceRayonAutoImpl
29where
30    TA: Clone + Send + Sync,
31    TB: Clone + Send + Sync,
32    TC: Clone + Send + Sync,
33    D: DimAPI,
34    F: Fn(&mut MaybeUninit<TC>, &TA, &TB) + ?Sized + Send + Sync,
35{
36    fn op_mutc_refa_numb_func(
37        &self,
38        c: &mut Vec<MaybeUninit<TC>>,
39        lc: &Layout<D>,
40        a: &Vec<TA>,
41        la: &Layout<D>,
42        b: TB,
43        f: &mut F,
44    ) -> Result<()> {
45        let pool = self.get_current_pool();
46        op_mutc_refa_numb_func_cpu_rayon(c, lc, a, la, b, f, pool)
47    }
48}
49
50impl<TA, TB, TC, D, F> DeviceOp_MutC_NumA_RefB_API<TA, TB, TC, D, F> for DeviceRayonAutoImpl
51where
52    TA: Clone + Send + Sync,
53    TB: Clone + Send + Sync,
54    TC: Clone + Send + Sync,
55    D: DimAPI,
56    F: Fn(&mut MaybeUninit<TC>, &TA, &TB) + ?Sized + Send + Sync,
57{
58    fn op_mutc_numa_refb_func(
59        &self,
60        c: &mut Vec<MaybeUninit<TC>>,
61        lc: &Layout<D>,
62        a: TA,
63        b: &Vec<TB>,
64        lb: &Layout<D>,
65        f: &mut F,
66    ) -> Result<()> {
67        let pool = self.get_current_pool();
68        op_mutc_numa_refb_func_cpu_rayon(c, lc, a, b, lb, f, pool)
69    }
70}
71
72impl<TA, TB, D, F> DeviceOp_MutA_RefB_API<TA, TB, D, F> for DeviceRayonAutoImpl
73where
74    TA: Clone + Send + Sync,
75    TB: Clone + Send + Sync,
76    D: DimAPI,
77    F: Fn(&mut MaybeUninit<TA>, &TB) + ?Sized + Send + Sync,
78{
79    fn op_muta_refb_func(
80        &self,
81        a: &mut Vec<MaybeUninit<TA>>,
82        la: &Layout<D>,
83        b: &Vec<TB>,
84        lb: &Layout<D>,
85        f: &mut F,
86    ) -> Result<()> {
87        let pool = self.get_current_pool();
88        op_muta_refb_func_cpu_rayon(a, la, b, lb, f, pool)
89    }
90}
91
92impl<TA, TB, D, F> DeviceOp_MutA_NumB_API<TA, TB, D, F> for DeviceRayonAutoImpl
93where
94    TA: Clone + Send + Sync,
95    TB: Clone + Send + Sync,
96    D: DimAPI,
97    F: Fn(&mut MaybeUninit<TA>, &TB) + ?Sized + Send + Sync,
98{
99    fn op_muta_numb_func(&self, a: &mut Vec<MaybeUninit<TA>>, la: &Layout<D>, b: TB, f: &mut F) -> Result<()> {
100        let pool = self.get_current_pool();
101        op_muta_numb_func_cpu_rayon(a, la, b, f, pool)
102    }
103}
104
105impl<T, D, F> DeviceOp_MutA_API<T, D, F> for DeviceRayonAutoImpl
106where
107    T: Clone + Send + Sync,
108    D: DimAPI,
109    F: Fn(&mut MaybeUninit<T>) + ?Sized + Send + Sync,
110{
111    fn op_muta_func(&self, a: &mut Vec<MaybeUninit<T>>, la: &Layout<D>, f: &mut F) -> Result<()> {
112        let pool = self.get_current_pool();
113        op_muta_func_cpu_rayon(a, la, f, pool)
114    }
115}
116
117/* #endregion */