Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

Commit

Permalink
Merge #343
Browse files Browse the repository at this point in the history
343: Check for OOM when doing malloc. r=maleadt a=maleadt

Addresses #340

Crashes on `-g2` with the following MWE though:

```
using CUDAnative, StaticArrays

function knl!()
  r_a = MArray{Tuple{4}, Float32}(undef)

  for k in 1:4
    @inbounds r_a[k] = 0
  end

  nothing
end

@cuda threads=(5, 5) blocks=4000 knl!()

using CUDAdrv
CUDAdrv.synchronize()
```

Co-authored-by: Tim Besard <tim.besard@gmail.com>
  • Loading branch information
bors[bot] and maleadt committed Feb 14, 2019
2 parents c000bc0 + 53605ce commit c72a594
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/device/runtime_intrinsics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ end

function gc_pool_alloc(sz::Csize_t)
ptr = malloc(sz)
if ptr == C_NULL
@cuprintf("ERROR: Out of dynamic GPU memory (trying to allocate %i bytes)\n", sz)
throw(OutOfMemoryError())
end
return unsafe_pointer_to_objref(ptr)
end

Expand Down

0 comments on commit c72a594

Please sign in to comment.