File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ module Main where
44
55import Control.Monad
66
7+ import Data.Maybe (isJust )
78import Data.Proxy
89import Spec (spec )
910import Test.Hspec (hspec )
@@ -13,14 +14,19 @@ import Test.QuickCheck.Classes
1314import qualified ArrayFire as A
1415import ArrayFire (Array )
1516
17+ import System.Environment (lookupEnv )
1618import System.IO.Unsafe
1719
1820instance (A. AFType a , Arbitrary a ) => Arbitrary (Array a ) where
1921 arbitrary = pure $ unsafePerformIO (A. randu [2 ,2 ])
2022
2123main :: IO ()
2224main = do
23- A. setBackend A. Default
25+ -- In CI there's often no GPU/OpenCL device available, which makes the
26+ -- default backend throw (e.g. cl::Error: clGetDeviceIDs). Fall back to
27+ -- the CPU backend when running in CI.
28+ inCI <- isJust <$> lookupEnv " CI"
29+ A. setBackend (if inCI then A. CPU else A. Default )
2430 A. info
2531-- checks (Proxy :: Proxy (A.Array (A.Complex Float)))
2632-- checks (Proxy :: Proxy (A.Array (A.Complex Double)))
You can’t perform that action at this time.
0 commit comments