summaryrefslogtreecommitdiff
path: root/test/Main.hs
blob: 19105dd5a479e77de5761ee341d77a27f8e72442 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module Main where

import qualified Data.Array.Accelerate as A
import qualified Data.Array.Accelerate.Interpreter as I
import System.Exit

import qualified Data.Array.Accelerate.C as C

import qualified Examples.Mandel as Mandel
import Examples.Utils.PPM


main :: IO ()
main = do
    let viewport = ((640, 480), (-0.5, 0.0), 3.0)
        img = I.run1 Mandel.afun (A.fromList A.Z [(viewport, 200)])
    case C.translateAcc "mandelkernel" Mandel.afun of
      Left err -> die err
      Right (code, _, _) -> writeFile "mandel-out.c" code
    ppmWrite img "mandel.ppm"