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

"lost device memory reference" when using accessing size of array when reshaping #27

Closed
meric opened this issue Oct 2, 2011 · 3 comments
Labels
cuda backend [deprecated]

Comments

@meric
Copy link

meric commented Oct 2, 2011

test2 - when reshaping the array and finding size of array at the same time, fails with "lost device memory reference" error.

test2 is successful when using Data.Array.Accelerate.Interpreter instead.

module Test where
import Data.Array.Accelerate as Acc
import Data.Array.Accelerate.CUDA
import Debug.Trace

-- Exp a -> a
fromExp :: (Elt a) => Exp a -> a
fromExp x = (toList(run $ unit $ x))!!0

arr = use$fromList(fromExp (index1 4)) ([1, 3, 5, 7]::[Int])

first len = fromExp $ (reshape (index1 len) arr) ! (index1 0)

test0 = 4 == (fromExp $ size arr) -- Success, returns True
test1 = first (4::Exp Int) -- Success, returns 1
test2 = first (size arr::Exp Int) -- Failure, "lost device memory reference", expected return 1
test3 = first (lift $ fromExp $ size arr::Exp Int) -- Success, returns 1
@tmcdonell
Copy link
Member

Hi meric,

I'm currently overseas, but will look into it once I get back. This problem has come up before in other contexts, but hopefully this will help me narrow down the problem. Thanks a lot for the minimal test case!!

-T

@tmcdonell
Copy link
Member

so this is actually fixed now, since I have switched to using finalisers for memory management instead of explicit reference counting. but... this work hasn't been merged from my fork into the main repo yet, so I'll leave this open until we get a new hackage release out.

@mchakravarty
Copy link
Member

Since we merged @tmcdonell and my branch, this issue should now be resolved.

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

No branches or pull requests

3 participants