Any idea of what I am doing wrong?
I tried to search for cudaMemAllocPitch problems in the forums, but could not find anything useful.
Is there any known limitation? … or obvious bug in my code?
memfill.cu (3.89 KB)
The attached code is quite simple: it just tries to allocate as many 2d-arrays as possible.
It seems to work just fine on my laptop (GeForce GT 220M, drivers 280.26, win7x86), but fails systematically on C2070s (“out of memory” with about half the memory still free!)
The attached small code produces the following output on C2070 (drivers 275.33, win7x64):
+--------------------------------+
Version driver(4000), runtime(4000)
+--------------------------------+
+==============
test memfill: gpu0 mem free 6080991232 bytes
+==============
[1500x1500] 2d-arrays, 9216000 bytes (pad=512)
=> 659 2d-arrays will occupy 6073344000 bytes
est. free mem remaining: 7647232
gpu0 alloc array #0 (stride=6144, 9216000 bytes)
mem free: 6071685120 bytes, 9306112 bytes used (90112 over used, 90112 total over)
gpu0 alloc array #1 (stride=6144, 9216000 bytes)
mem free: 6062379008 bytes, 9306112 bytes used (90112 over used, 180224 total over)
....
gpu0 alloc array #317 (stride=6144, 9216000 bytes)
mem free: 3121647616 bytes, 9306112 bytes used (90112 over used, 28655616 total over)
*****
array #318 alloc failed: out of memory
*****
gpu0 memory free: 3121647616 bytes
..allocated 318 arrays
[font=“Verdana”]What is really strange is that it fails after the same number of allocated elements regardless of the available memory (gpu#2 is connected to a display):[/font]
..using gpu2
+--------------------------------+
Version driver(4000), runtime(4000)
+--------------------------------+
+==============
test memfill: gpu2 mem free 5411921920 bytes
+==============
[1500x1500] 2d-arrays, 9216000 bytes (pad=512)
=> 587 2d-arrays will occupy 5409792000 bytes
est. free mem remaining: 2129920
gpu2 alloc array #0 (stride=6144, 9216000 bytes)
mem free: 5402615808 bytes, 9306112 bytes used (90112 over used, 90112 total over)
gpu2 alloc array #1 (stride=6144, 9216000 bytes)
mem free: 5393309696 bytes, 9306112 bytes used (90112 over used, 180224 total over)
...
gpu2 alloc array #317 (stride=6144, 9216000 bytes)
mem free: 2452578304 bytes, 9306112 bytes used (90112 over used, 28655616 total over)
*****
array #318 alloc failed: out of memory
*****
gpu2 memory free: 2452578304 bytes..allocated 318 arrays
Can anyone reproduce/help/workaround/solve? (-- no more hair to pull here External Image)
[font=“Verdana”]
Thanks[/font]