Changes between Initial Version and Version 4 of Ticket #20

Show
Ignore:
Timestamp:
08/08/10 15:30:15 (4 years ago)
Author:
tmcdonell
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #20

    • Property version changed from to 0.7.1.0
  • Ticket #20 – description

    initial v4  
    22 
    33{{{ 
    4 {-# LANGUAGE ParallelListComp, ScopedTypeVariables #-} 
     4{-# LANGUAGE ScopedTypeVariables #-} 
    55 
    6 module Foo where 
     6module Main where 
    77 
    8 import Prelude hiding (map) 
    9 import qualified Prelude 
    10  
    11 import Data.Array.Unboxed 
    12 import Data.Array.IArray 
    13  
    14 import Data.Array.Accelerate 
    15 import qualified Data.Array.Accelerate as Acc 
     8import Data.Array.Accelerate                (Acc, Exp, Vector) 
     9import qualified Data.Array.Accelerate      as Acc 
    1610import qualified Data.Array.Accelerate.CUDA as CUDA 
    1711 
    18 foo :: Vector ((Float, Int), Double) -> Acc (Vector ((Float, Int), Double)) 
    19 foo xs = 
    20   let xs' = use xs 
    21   in flip map xs' $ \x -> let (a', c :: Exp Double) = untuple x 
    22                               (a :: Exp Float, b :: Exp Int) = untuple a' 
    23                           in  tuple (tuple (a + 1, b + 2), c + 3) 
     12test :: Vector ((Float, Int), Double) -> Acc (Vector ((Float, Int), Double)) 
     13test xs = 
     14  let xs' = Acc.use xs 
     15  in flip Acc.map xs' $ \x -> let (a', c :: Exp Double)          = Acc.untuple x 
     16                                  (a :: Exp Float, b :: Exp Int) = Acc.untuple a' 
     17                              in  Acc.tuple (Acc.tuple (a + 1, b + 2), c + 3) 
    2418 
    2519main :: IO () 
    26 main = do 
    27   let input = fromList 10 (Prelude.zip (Prelude.zip [0..9] [1..10]) [2..11]) :: Vector ((Float, Int), Double) 
    28   (CUDA.run $ foo input) >>= putStrLn . show 
     20main = 
     21  let input = Acc.fromList 10 (zip (zip [0..9] [1..10]) [2..11]) 
     22  in 
     23  print =<< CUDA.run (test input) 
    2924}}}