Skip to content

Commit

Permalink
use Debug.Trace.traceIO
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcdonell committed Jan 8, 2021
1 parent 76148dd commit fb5a543
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions src/Data/Array/Accelerate/Interpreter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ import Control.Monad.ST
import Data.Bits
import Data.Primitive.ByteArray
import Data.Primitive.Types
import Debug.Trace
import System.IO.Unsafe ( unsafePerformIO )
import Text.Printf ( printf )
import Unsafe.Coerce
Expand Down Expand Up @@ -864,20 +865,10 @@ evalBoundary bnd aenv =
AST.Function f -> Function (evalFun f aenv)

atraceOp :: String -> ArraysR as -> as -> IO ()
atraceOp msg TupRunit () = do
putStrLn msg
atraceOp msg (TupRsingle (ArrayR ShapeRz tp)) as = do
putStr msg
putStr ": "
putStrLn $ showElt tp $ linearIndexArray tp as 0
atraceOp msg (TupRsingle (ArrayR shr tp)) as = do
putStr msg
putStr ": "
putStrLn $ showArray (showsElt tp) (ArrayR shr tp) as
atraceOp msg repr as = do
putStr msg
putStrLn ":"
putStrLn $ showArrays repr as
atraceOp msg TupRunit () = traceIO msg
atraceOp msg (TupRsingle (ArrayR ShapeRz eR)) as = traceIO $ printf "%s: %s" msg (showElt eR $ linearIndexArray eR as 0)
atraceOp msg (TupRsingle (ArrayR shR eR)) as = traceIO $ printf "%s: %s" msg (showArray (showsElt eR) (ArrayR shR eR) as)
atraceOp msg aR as = traceIO $ printf "%s: %s" msg (showArrays aR as)

-- Scalar expression evaluation
-- ----------------------------
Expand Down

0 comments on commit fb5a543

Please sign in to comment.