-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathBackend.hs
More file actions
32 lines (24 loc) · 811 Bytes
/
Backend.hs
File metadata and controls
32 lines (24 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
module ArrayFire.Backend where
import Foreign.Marshal
import Foreign.Storable
import Foreign.C.String
import ArrayFire.Internal.Backend
import ArrayFire.Exception
import ArrayFire.FFI
import ArrayFire.Types
import ArrayFire.Internal.Defines
setBackend :: Backend -> IO ()
setBackend = afCall . af_set_backend . toAFBackend
getBackendCount :: IO Int
getBackendCount =
fromIntegral <$>
afCall1 af_get_backend_count
getAvailableBackends :: IO [Backend]
getAvailableBackends =
toBackends <$> afCall1 af_get_available_backends
getBackendID :: Array a -> Backend
getBackendID = toBackend . flip infoFromArray af_get_backend_id
getActiveBackend :: IO Backend
getActiveBackend = toBackend <$> afCall1 af_get_active_backend
getDeviceID :: Array a -> Int
getDeviceID = flip infoFromArray af_get_device_id