Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Atrace prints message before evaluating argument #100

Open
tomsmeding opened this issue May 1, 2024 · 0 comments
Open

[BUG] Atrace prints message before evaluating argument #100

tomsmeding opened this issue May 1, 2024 · 0 comments

Comments

@tomsmeding
Copy link
Member

Description
The implementation of Atrace prints the message before the argument (that is passed on) is evaluated:

liftIO $ atraceOp msg a1'
travA a2

This is just like Debug.Trace works in Haskell, but Haskell's behaviour is because of laziness, whereas Accelerate is strict and hence this behaviour is neither helpful nor terribly intuitive.

Steps to reproduce

{-# LANGUAGE OverloadedStrings #-}
module Main where
import qualified Data.Array.Accelerate as A
import qualified Data.Array.Accelerate.Debug.Trace as A
import qualified Data.Array.Accelerate.LLVM.Native as CPU

prog :: A.Acc (A.Vector Int) -> A.Acc (A.Vector Int)
prog a = A.atrace "second" (A.map (+1) (A.atrace "first" a))

main :: IO ()
main = print $ CPU.runN prog (A.fromList (A.Z A.:. 10) [1..10])

This prints:

second
first
Vector (Z :. 10) [2,3,4,5,6,7,8,9,10,11]

Expected behaviour
Get first, then second.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant