cublas.bend
bend-blas-lapack@0.0.0.1 · 64 lines · 12 definitions
1
2
3
4
5
6
7
8
9
10
11
12
13import Base
14
15
16def Cublas.available() -> IO(Result<&1, &1, U32 & String, Bool>):
17 import "./effs/cublas_available.c"
18 import "./effs/cublas_available.js"
19
20def Cublas.available.try() -> IO(Bool):
21 IO.try(Bool, Cublas.available())
22
23
24def Cublas.upload(n: U32, a: Array<F32>) -> IO(Result<&1, &1, U32 & String, U32>):
25 import "./effs/cublas_upload.c"
26 import "./effs/cublas_upload.js"
27
28def Cublas.upload.try(n: U32, a: Array<F32>) -> IO(U32):
29 IO.try(U32, Cublas.upload(n, a))
30
31
32def Cublas.download(id: U32) -> IO(Result<&1, &1, U32 & String, Array<F32>>):
33 import "./effs/cublas_download.c"
34 import "./effs/cublas_download.js"
35
36def Cublas.download.try(id: U32) -> IO(Array<F32>):
37 IO.try(Array<F32>, Cublas.download(id))
38
39
40def Cublas.free(id: U32) -> IO(Result<&1, &1, U32 & String, Unit>):
41 import "./effs/cublas_free.c"
42 import "./effs/cublas_free.js"
43
44def Cublas.free.try(id: U32) -> IO(Unit):
45 IO.try(Unit, Cublas.free(id))
46
47
48
49
50def Cublas.sgemm(ta: U32, tb: U32, m: U32, n: U32, k: U32, alpha: F32, a: Array<F32>, b: Array<F32>, beta: F32, c: Array<F32>) -> IO(Result<&1, &1, U32 & String, Array<F32>>):
51 import "./effs/cublas_sgemm.c"
52 import "./effs/cublas_sgemm.js"
53
54def Cublas.sgemm.try(ta: U32, tb: U32, m: U32, n: U32, k: U32, alpha: F32, a: Array<F32>, b: Array<F32>, beta: F32, c: Array<F32>) -> IO(Array<F32>):
55 IO.try(Array<F32>, Cublas.sgemm(ta, tb, m, n, k, alpha, a, b, beta, c))
56
57
58
59def Cublas.sgemm_w(ta: U32, tb: U32, m: U32, n: U32, k: U32, alpha: F32, a: Array<F32>, b: U32, beta: F32, c: Array<F32>) -> IO(Result<&1, &1, U32 & String, Array<F32>>):
60 import "./effs/cublas_sgemm_w.c"
61 import "./effs/cublas_sgemm_w.js"
62
63def Cublas.sgemm_w.try(ta: U32, tb: U32, m: U32, n: U32, k: U32, alpha: F32, a: Array<F32>, b: U32, beta: F32, c: Array<F32>) -> IO(Array<F32>):
64 IO.try(Array<F32>, Cublas.sgemm_w(ta, tb, m, n, k, alpha, a, b, beta, c))