Ticket #12 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

Unused array computations lead to memory leaks

Reported by: tmcdonell Owned by:
Priority: major Milestone:
Component: CUDA backend Version: 0.8.0.0
Keywords: Cc:

Description

The CUDA backend uses explicit reference tracking for device arrays. However, if the result of a computation is not used, it may not be released until the entire CUDA environment is closed down. This is evident for computations under Let2, but may exist more generally. In the example below, we modify the runCUDA function display any active memory records on finalisation.

test_scan = do
  let xs :: Acc (Vector Int) = use $ fromList 10 [0..]
      expr = Acc.scanl (+) 0 xs

  putStrLn "scan"
  print =<< CUDA.run (Prelude.fst expr)

  putStrLn "reduction"
  print =<< CUDA.run (Prelude.snd expr)

Results in:

*Test> test_scan
scan
 91488264:=MemoryEntry {_refcount = 0, _memsize = 4, _arena = 1049088}

Array 10 [0,0,1,3,6,10,15,21,28,36]
reduction
 118558728:=MemoryEntry {_refcount = 0, _memsize = 40, _arena = 1048832}

Array () [45]

Change History

Changed 4 years ago by tmcdonell

  • version set to 0.7.1.0

Changed 4 years ago by tmcdonell

  • summary changed from unused array computations lead to memory leaks to Unused array computations lead to memory leaks

Changed 4 years ago by chak

  • version changed from 0.7.1.0 to 0.8.0.0

Changed 4 years ago by tmcdonell

  • status changed from new to closed
  • resolution set to fixed

This should be fixed now, and will now generate a real error if this is not the case instead of silently correcting the problem.

Note: See TracTickets for help on using tickets.