SoLDMGlobalResourceParameters Class |
Global resource parameters for LDM.
Namespace: OIV.LDM
The SoLDMGlobalResourceParameters type exposes the following members.
Name | Description | |
---|---|---|
Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
GetDefaultMaxMainMem | Returns the default maximum system (CPU) memory in MB. | |
GetDefaultMaxTexMem | Returns the default maximum GPU memory in MB. | |
GetHashCode |
Overrides GetHashCode().
(Inherited from SoNetBase.) | |
GetIgnoreFullyTransparentTiles | Returns the IgnoreFullyTransparentTiles flag. | |
GetLoadNotificationRate | Returns the load notification rate. | |
GetMax2DTexMemory | Get the maximum number of 2D textures allowed to be loaded. | |
GetMaxMainMemory | Returns the maximum main memory in MB for all the VolumeViz data sets. | |
GetMaxTexMemory | Returns the maximum texture memory in MB for all the VolumeViz data sets. | |
GetMoveLowResolution | Obsolete. Returns the move low resolution flag. | |
GetNumIO | Returns the current number of loading threads. | |
GetScreenResolutionCulling | Returns the screen resolution culling state. | |
GetSliceEqualResolution | Returns the slice equal resolution flag. | |
GetTex2LoadRate | Returns the maximum number of 2D textures allowed to be loaded into texture memory per frame for all the VolumeViz data sets. | |
GetTex3LoadRate | Returns the maximum number of tiles (3D textures) allowed to be downloaded into texture (GPU) memory per frame for all the VolumeViz data sets. | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GetViewCulling | Returns the view culling flag. | |
GetViewpointRefinement | Returns the viewpoint refinement flag. | |
GetVisualFeedbackParam | Returns the state of the specified visual feedback parameter. | |
SetIgnoreFullyTransparentTiles | Sets the IgnoreFullyTransparentTiles flag. | |
SetLoadNotificationRate | Sets the load notification rate (number of tiles). | |
SetMax2DTexMemory | Sets the maximum 2D texture GPU memory in MB allowed to be loaded for all VolumeViz data sets. | |
SetMaxMainMemory | Sets the maximum main (CPU) memory, in MB, to use for all VolumeViz data sets. | |
SetMaxTexMemory | Sets the maximum texture (GPU) memory, in MB, for all VolumeViz data sets. | |
SetMonitoringCB | Sets a monitoring delegate. | |
SetMoveLowResolution | Obsolete. Sets the low resolution when moving flag. | |
SetNumIO | Sets how many simultaneous tile loading threads to use if multi I/O mode is on (it is on when LDM mode is on). | |
SetScreenResolutionCulling | Sets the screen resolution culling flag. | |
SetSliceEqualResolution(Boolean) | Calls SetSliceEqualResolution(state, true). | |
SetSliceEqualResolution(Boolean, Boolean) | Sets the slice equal resolution flag. | |
SetTex2LoadRate | Sets the maximum number of 2D textures allowed to be downloaded into texture (GPU) memory per frame (render traversal) for all the VolumeViz data sets. | |
SetTex3LoadRate | Sets the maximum number of 3D textures allowed to be downloaded into texture (GPU) memory, per frame (render traversal), for all VolumeViz data sets. | |
SetViewCulling(Boolean) | Calls SetViewCulling(state, true). | |
SetViewCulling(Boolean, Boolean) | Sets the view culling flag. | |
SetViewpointRefinement | Sets the viewpoint refinement flag. | |
SetVisualFeedbackParam | Sets the specified visual feedback parameter to true or false. | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
LoadCallback | Sets a delegateto be called with the tile loading state. |
This class contains functions for controlling global resource parameters for the LDM module.
For extensions that use the LDM module, particularly VolumeViz, these parameters can have a significant effect on resource usage (primarily memory) and rendering performance.
Memory management
This class allows the application to specify how much CPU and GPU memory VolumeViz can use to load data and textures. By default the main memory and texture memory limits are set to a percentage of the total available system and GPU memory (see the OIV.LDM.SoLDMGlobalResourceParameters.SetMaxMainMemory(System.Int32) and OIV.LDM.SoLDMGlobalResourceParameters.SetMaxTexMemory(System.Int32) methods). Applications can use the OIV.Inventor.Devices.SoCpuDevice and OIV.Inventor.Devices.SoGLDevice classes to query the total and available memory on the CPU and GPU. There is an additional memory allocation for the BufferObject cache described below. How VolumeViz uses CPU memory depends on the data source (tiled or not tiled), the tile cache policy (see OIV.LDM.Nodes.SoLDMResourceParameters.tileCachePolicy field) and the OIV.Inventor.SoPreferences variable LDM_USE_IN_MEM_COMPRESSION.
Tiles: VolumeViz uses a data manager called LDM to manage volume data. LDM manages volume data in chunks called “tiles”. If the volume size is larger than the tile size, then there are two classes of tile: full-resolution tiles containing actual data values and low-resolution tiles containing sub-sampled data values. The application may have native data that is already tiled or the data may be pre-processed to create tiles and store them in the LDM file format. In an LDM format file the tiles may optionally be compressed to save disk space and memory, but in this case, the tiles must be expanded before sending to the GPU. If the data is not tiled, for example disk formats like DICOM and SEGY or an in-memory volume, then tiles must be created in memory at runtime.
Tile size: Note that the default tile size is small and generally you wll get better performance with non-tiled data by explicitly setting a larger tile size (see the ldmResourceParameters field and OIV.LDM.Nodes.SoLDMResourceParameters.tileDimension). If the volume size is 512^3 or less then the tile size may be set to the volume size to avoid the overhead of tiling. Do not set the tile size larger than 512 for a volume data set. However, if the volume is actually a large "image", i.e. the Z dimension is 1, then setting the tile size to 1024 may improve performance.
Caches: LDM allocates CPU memory for the CPU Tile Cache and the secondary BufferObject cache. The CPU tile cache is normally as large as needed or other memory requirements allow. If the volume is larger than the available or allowed CPU memory, then LDM keeps the “most important” tiles in memory (importance is determined by various heuristics set in this class and in OIV.LDM.Nodes.SoLDMResourceParameters). The BufferObject cache is normally small and is used to temporarily store tiles that are created by LDM at run-time.
CPU Tile Cache (main memory) VolumeViz uses this amount of CPU memory as the primary cache for LDM data tiles. The main memory limit is set in megabytes using the OIV.LDM.SoLDMGlobalResourceParameters.SetMaxMainMemory(System.Int32) method. If the data set is small enough to fit in system memory, then generally the memory limit should be set high enough to allow this. If the data set is larger than system memory, then the memory limit should be set as high as possible without impacting the application's other needs for memory. If the tile size is (for example) 64 and each voxel is a float value, then each tile requires approximately 1 MB of system memory. However since Open Inventor 8.5, the system memory requirement is reduced for compressed LDM tiles (stored compressed) and for uniform tiles (stored as a single value). When there are multiple LDM data sets, by default each data set receives OIV.LDM.SoLDMGlobalResourceParameters.GetMaxMainMemory() divided by the number of datasets. Each time a new data set is created the per-dataset value is recomputed and some memory is taken away from existing data sets. Note: This default allocation of memory to multiple data sets is not optimal if the data sets have significantly different sizes. For example the memory required for a height field is normally much less than for a volume. In this case the application can explicitly allocate memory to each data set using the maxMainMemory field of the OIV.LDM.Nodes.SoLDMResourceParameters object associated with the data set (see the OIV.LDM.Nodes.SoDataSet.ldmResourceParameters field).
GPU Tile Cache (texture memory) VolumeViz uses this amount of GPU memory to cache LDM data tiles on the GPU. The texture memory limit is set in megabytes using the OIV.LDM.SoLDMGlobalResourceParameters.SetMaxTexMemory(System.Int32) method. This value can also be set separately for each data set using OIV.LDM.Nodes.SoLDMResourceParameters.
Caution |
---|
Some systems integrate GPU memory with CPU memory. In this case, if you allocate 4GB of CPU memory and 4GB of GPU memory, the system may see a total of 8GB private memory used by the process, leading to out-of-memory errors or swapping issues. If you face such issues, you should ensure that max CPU memory + max GPU memory is less than the total available CPU memory in your machine. |
BufferObject cache In some cases LDM needs to create tiles on-the-fly at runtime. To reduce memory usage and avoid duplicating application data, these created tiles are considered temporary and are stored in the BufferObject cache. This is a secondary cache that is separate from, and in addition to, the CPU tile cache (main memory). How the BufferObject cache is used depends on the data source (tiled or not) and the tile caching policy (see OIV.LDM.Nodes.SoLDMResourceParameters.tileCachePolicy). For example when compressed tiles are loaded from an LDM format file, they are stored in the CPU tile cache still compressed (to reduce the memory requirement). When the tile data is needed to send data to the GPU, a temporary uncompressed tile is created and stored in the BufferObject cache. The BufferObject cache is also used to expand uniform tiles, which are stored in the LDM file and in memory as a single value. For non-tiled data (e.g. SEGY or DICOM or in-memory volume), depending on the tile cache policy, tiles are created from the source data when needed to send data to the GPU and temporarily stored in the BufferObject cache. The BufferObject cache size can only be set using the OIV.Inventor.SoPreferences variable OIV_BUFFER_OBJECT_CACHE_SIZE. The size is set in number of tiles (not amount of memory) so the actual size of this cache depends on both the tile size and the data type size, i.e. it is larger for floating point data than for byte data. The default size is 50 tiles. The BufferObject cache size can only be set globally, not for each data set. The BufferObject cache was added in Open Inventor version 8.5.