GPU Memory Detection

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

GPU Memory Detection

ianl
Hi all,

I am seeing a lot of out of memory errors when loading large data sets for volume rendering with the new VTK 7.0 release. These are as follows:

vtkTextureObject (424DB080): failed at glTexImage2D 1 OpenGL errors detected
  0 : (1285) Out of memory

These sets used to display fine with VTK 6.1, and now no longer do in VTK 7.0 . The set is not particularly large - a 512x512, 266 slice CT stack. Smaller sets render fine so there is no fundamental issue. One oddity I have noticed is that the GPU memory is being reported as being 128 MB (actually a 2GB card) which is what happens when the vtkDummyGPUInfoList is used rather than the vtkDirectXGPUInfoList to probe the available graphics memory. This used to be caused by not having the DirectX SDK installed in previous versions with similar visual symptoms (invisible volumes, only first/last slice drawn, etc). I notice that this class is not actually present in the Rendering/OpenGL2 source file directory, but is in the OpenGL directory.

So the question is - has this been replaced by a purely OpenGL mechanism which I somehow need to 'turn on' using CMake / compiler switches, etc? Am I barking up completely the wrong tree - is the new OpenGL2 version inherently more heavyweight?

I am building on Windows 10 with the June 2010 DirectX SDK installed, Visual Studio 2012, 32/64 bit build with the VTK_USE_64BIT_IDS flag on. The GPU is a 2GB AMD Radeon R7 200 with the latest drivers.

Thanks in advance for any light shed on this, it has me stumped currently.
Reply | Threaded
Open this post in threaded view
|

Re: GPU Memory Detection

Sankhesh Jhaveri-2
Could you try the development version of VTK? 

You can clone the latest version using git as documented here: https://gitlab.kitware.com/vtk/vtk/blob/master/Documentation/dev/git/download.md#clone


Sankhesh​

 

On Mon, Sep 12, 2016 at 12:21 PM, ianl <[hidden email]> wrote:
Hi all,

I am seeing a lot of out of memory errors when loading large data sets for
volume rendering with the new VTK 7.0 release. These are as follows:

vtkTextureObject (424DB080): failed at glTexImage2D 1 OpenGL errors detected
  0 : (1285) Out of memory

These sets used to display fine with VTK 6.1, and now no longer do in VTK
7.0 . The set is not particularly large - a 512x512, 266 slice CT stack.
Smaller sets render fine so there is no fundamental issue. One oddity I have
noticed is that the GPU memory is being reported as being 128 MB (actually a
2GB card) which is what happens when the vtkDummyGPUInfoList is used rather
than the vtkDirectXGPUInfoList to probe the available graphics memory. This
used to be caused by not having the DirectX SDK installed in previous
versions with similar visual symptoms (invisible volumes, only first/last
slice drawn, etc). I notice that this class is not actually present in the
Rendering/OpenGL2 source file directory, but is in the OpenGL directory.

So the question is - has this been replaced by a purely OpenGL mechanism
which I somehow need to 'turn on' using CMake / compiler switches, etc? Am I
barking up completely the wrong tree - is the new OpenGL2 version inherently
more heavyweight?

I am building on Windows 10 with the June 2010 DirectX SDK installed, Visual
Studio 2012, 32/64 bit build with the VTK_USE_64BIT_IDS flag on. The GPU is
a 2GB AMD Radeon R7 200 with the latest drivers.

Thanks in advance for any light shed on this, it has me stumped currently.



--
View this message in context: http://vtk.1045678.n5.nabble.com/GPU-Memory-Detection-tp5740281.html
Sent from the VTK - Users mailing list archive at Nabble.com.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: GPU Memory Detection

ianl
Hi, I have downloaded the latest master branch code and built the 32 bit version.

Slightly, but not much better - GetMaxMemoryInBytes() on the smart volume / gpu mapper still returns 134217728 (128 MB) and mostly no volume shown with lots of out of memory errors from OpenGL as before. I am reasonably sure that this particular set volume rendered fine in 32 bit mode with the 64 bit IDs flag on as it is one of our common test sets.

When testing, I did get the volume to render a few times, and it looked like it was having to drop to the reduced volume (due to the incorrect 128MB measurement?). It may be this memory allocation that is failing.

Any ideas?

Reply | Threaded
Open this post in threaded view
|

Re: GPU Memory Detection

ianl
Hi all, I have just been having a poke around in the CMakeLists.txt for the OpenGL and OpenGL2 directories under the Rendering directory. It seems that the part that deals with the GPU info list has been replaced by a much shorter (placeholder?) section:

OpenGL:

# Now to see about the GPU info list.
list(APPEND vtk_module_overrides "vtkGPUInfoList")
if(VTK_USE_NVCONTROL)
  list(APPEND Module_SRCS "vtkXGPUInfoList.cxx")
  set(extra_libs ${NVCtrlLib_LIBRARY})
  include_directories(${NVCtrlLib_INCLUDE_DIR})
  set(vtk_module_vtkGPUInfoList_override "vtkXGPUInfoList")
elseif(VTK_USE_CORE_GRAPHICS)
  list(APPEND Module_SRCS "vtkCoreGraphicsGPUInfoList.cxx")
  set(extra_libs)
  set(vtk_module_vtkGPUInfoList_override "vtkCoreGraphicsGPUInfoList")
elseif(VTK_USE_DIRECTX)
  list(APPEND Module_SRCS "vtkDirectXGPUInfoList.cxx")
  set(extra_libs ${DirectX_LIBRARY} wbemuuid)
  include_directories(${DirectX_INCLUDE_DIR})
  set(vtk_module_vtkGPUInfoList_override "vtkDirectXGPUInfoList")
else()
  # Shouldn't this just be the base class, and the others override if needed?
  list(APPEND Module_SRCS "vtkDummyGPUInfoList.cxx")
  set(vtk_module_vtkGPUInfoList_override "vtkDummyGPUInfoList")
endif()

has become in OpenGL2:

# Now to see about the GPU info list.
list(APPEND vtk_module_overrides "vtkGPUInfoList")
list(APPEND Module_SRCS "vtkDummyGPUInfoList.cxx")
set(vtk_module_vtkGPUInfoList_override "vtkDummyGPUInfoList")

So could I just copy the relevent classes to the OpenGL2 directory and update the CMakelists.txt to match (including the bit earlier where the VTK_USE_DIRECTX flag is worked out)? Alternatively, I could hack the part in vtkGPUVolumeRayCastMapper to default to a larger number than 128 MB. What is my best way forward here? I am reluctant to switch back to the old OpenGL rendering as the speed improvements in the new implementation are very beneficial.
Reply | Threaded
Open this post in threaded view
|

Re: GPU Memory Detection

ianl
Apologies for replying to my own message again - just an update on progress. I have downloaded and built the latest master version today (23rd Sept).

vtkDirectXGPUInfoList is still missing in action when using OpenGL2 - I have double checked that I have the June 2010 direct X SDK installed. This results in vtkGPUVolumeRayCastMapper using its default of 128MB and therefore resampling unnecessarily.

Some of the symptoms I was seeing with the 7.0 release were actually due to us setting UserMatrix on vtkVolume to be non identity - we use this to set the original data orientation (oblique slices, bottom to top slice order, etc). This resulted in only the edges of the volume being drawn. This now seems to work fine in the master build. When the out of memory messages occur, nothing gets drawn.

I have hacked the default of 128 MB to be 1024MB and rebuilt for now which gets us up and running. Is this something that can be looked at for the upcoming 7.1 release?
Reply | Threaded
Open this post in threaded view
|

Re: GPU Memory Detection

ianl
Hi, sorry to bump this thread again. Is it worth raising this as an issue in the bug tracker as the VTK 7.1 release is coming up, or have I misunderstood something here?