# Reporting allocations per stream in multithread CUDA.jl application

**URL:** <https://discourse.julialang.org/t/reporting-allocations-per-stream-in-multithread-cuda-jl-application/75866>\
**Category:** GPU\
**Created:** [February 5, 2022, 4:49pm UTC](https://discourse.julialang.org/t/reporting-allocations-per-stream-in-multithread-cuda-jl-application/75866 "2022-02-05T16:49:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpdoane](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jpdoane](https://discourse.julialang.org/u/jpdoane)\
**Post date:** [February 5, 2022, 4:49pm UTC](https://discourse.julialang.org/t/reporting-allocations-per-stream-in-multithread-cuda-jl-application/75866/1 "2022-02-05T16:49:42Z")

</div>

Is there a reliable way to monitor CUDA.jl allocations for each stream in a multithreaded application? In trying to track down the source of some excessive allocations using @CUDA.time macros, I am seeing some operations appear to allocate that clearly dont, e.g.:

```julia
             CUDA.synchronize()
             @info "Not doing anything here..."
             @CUDA.time sleep(.5)
             @info "Done"
             CUDA.synchronize()

```

which results in:

```julia
[ Info: Not doing anything here...
  0.500947 seconds (857 CPU allocations: 43.234 KiB) (5 GPU allocations: 5.008 MiB, 0.01% memmgmt time)
[ Info: Done

```

I assume that what is being reported here are allocations that are occurring in another stream/thread? Is this how @CUDA.time works, or is something else wacky going on here? Is there a better method for reporting allocations specifically for each stream/thread?

---

<div class="post-metadata">

**Author:** ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)\
**Post date:** [February 7, 2022, 9:50am UTC](https://discourse.julialang.org/t/reporting-allocations-per-stream-in-multithread-cuda-jl-application/75866/2 "2022-02-07T09:50:32Z")

</div>

> [@jpdoane](#):
>
> I assume that what is being reported here are allocations that are occurring in another stream/thread? Is this how @CUDA.time works, or is something else wacky going on here?

Yeah, `CUDA.@time` currently doesn’t take tasks or threads into account. That would be a useful addition though, can you open an issue on the CUDA.jl repository?
