arrayfire-0.9.0.0: Haskell bindings to the ArrayFire general-purpose GPU library
CopyrightDavid Johnson (c) 2019-2026
LicenseBSD3
MaintainerDavid Johnson <code@dmj.io>
StabilityExperimental
PortabilityGHC
Safe HaskellNone
LanguageHaskell2010

ArrayFire.Device

Description

Information about ArrayFire API and devices

>>> info
 ArrayFire v3.6.4 (OpenCL, 64-bit Mac OSX, build 1b8030c5)
[0] APPLE: AMD Radeon Pro 555X Compute Engine, 4096 MB
-1- APPLE: Intel(R) UHD Graphics 630, 1536 MB
Synopsis

Documentation

withArrayFire :: IO a -> IO a Source #

Bracket for ArrayFire usage. Wrap your main (or top-level IO action) with this to ensure the safe-finalizer shutdown flag is set before GHC's finalizer thread runs, preventing a "double free or corruption" abort when GC-managed array handles outlive ArrayFire's C++ allocator teardown.

main :: IO ()
main = withArrayFire $ do
  ...

info :: IO () Source #

Retrieve info from ArrayFire API

ArrayFire v3.6.4 (OpenCL, 64-bit Mac OSX, build 1b8030c5)
[0] APPLE: AMD Radeon Pro 555X Compute Engine, 4096 MB
-1- APPLE: Intel(R) UHD Graphics 630, 1536 MB

afInit :: IO () Source #

Calls af_init C function from ArrayFire API

>>> afInit
()

getInfoString :: IO String Source #

Retrieves ArrayFire device information as String, same as info.

>>> getInfoString
"ArrayFire v3.6.4 (OpenCL, 64-bit Mac OSX, build 1b8030c5)\n[0] APPLE: AMD Radeon Pro 555X Compute Engine, 4096 MB\n-1- APPLE: Intel(R) UHD Graphics 630, 1536 MB\n"

getDeviceCount :: IO Int Source #

Retrieves count of devices

>>> getDeviceCount
2

setDevice :: Int -> IO () Source #

Sets a device by Int

>>> setDevice 0
()

getDevice :: IO Int Source #

Retrieves device identifier

>>> getDevice
0

deviceGC :: IO () Source #

Runs the device garbage collector, freeing any cached memory buffers.