QTrk
Public Member Functions | Public Attributes | List of all members
QueuedCUDATracker::Device Struct Reference

Structure to maintain data for each GPU. More...

#include <QueuedCUDATracker.h>

Public Member Functions

 Device (int index)
 Initialize a GPU/CUDA Device. More...
 
 ~Device ()
 
void SetRadialZLUT (float *data, int radialsteps, int planes, int numLUTs)
 Copy the ZLUT data to device memory. More...
 
void SetPixelCalibrationImages (float *offset, float *gain, int img_width, int img_height)
 Set pixel calibration images. More...
 
void SetRadialWeights (float *zcmp)
 Set the radial weights used to calculate ZLUT plane match scores. More...
 

Public Attributes

cudaImageListf radial_zlut
 List in which to keep the lookup table images. More...
 
cudaImageListf calib_offset
 List in which to keep the offset images. More...
 
cudaImageListf calib_gain
 List in which to keep the gain images. More...
 
device_vec< float > zcompareWindow
 Vector in which to keep the radial weights for error curve calculation. More...
 
QI::DeviceInstance qi_instance
 Instance of global values used by the QI submodule. More...
 
QI::DeviceInstance qalign_instance
 Instance of global values used by the QI submodule used to perform QI alignment. More...
 
device_vec< float2 > zlut_trigtable
 Vector of pre-calculated 2D sampling points. More...
 
int index
 Device index of the device this instance is located on. More...
 

Detailed Description

Structure to maintain data for each GPU.

Holds global, once-calculated values required by the algorithms.

Todo:
Explicitly put this in global memory?

Definition at line 207 of file QueuedCUDATracker.h.

Constructor & Destructor Documentation

§ Device()

QueuedCUDATracker::Device::Device ( int  index)
inline

Initialize a GPU/CUDA Device.

Parameters
[in]indexIndex of the device pertaining to this instance.

Definition at line 212 of file QueuedCUDATracker.h.

213  {
214  this->index=index;
216  }
cudaImageListf calib_gain
List in which to keep the gain images.
cudaImageListf calib_offset
List in which to keep the offset images.
int index
Device index of the device this instance is located on.
cudaImageListf radial_zlut
List in which to keep the lookup table images.
static cudaImageList< float > emptyList()
Definition: cudaImageList.h:24

§ ~Device()

QueuedCUDATracker::Device::~Device ( )

Definition at line 204 of file QueuedCUDATracker.cu.

205 {
206  cudaSetDevice(index);
207  radial_zlut.free();
208  calib_gain.free();
209  calib_offset.free();
210 }
cudaImageListf calib_gain
List in which to keep the gain images.
cudaImageListf calib_offset
List in which to keep the offset images.
int index
Device index of the device this instance is located on.
cudaImageListf radial_zlut
List in which to keep the lookup table images.

Member Function Documentation

§ SetPixelCalibrationImages()

void QueuedCUDATracker::Device::SetPixelCalibrationImages ( float *  offset,
float *  gain,
int  img_width,
int  img_height 
)

Set pixel calibration images.

See QueuedTracker::SetPixelCalibrationImages for more info.

Parameters
[in]offset(2D) Array with the per-pixel offsets to use.
[in]gain(2D) Array with the per-pixel gain to use.
[in]img_widthWidth of the full image.
[in]img_heightHeight of the full image.

Definition at line 761 of file QueuedCUDATracker.cu.

762 {
763  cudaSetDevice(index);
764 
765  if (offset == 0)
766  calib_offset.free();
767 
768  if (gain == 0)
769  calib_gain.free();
770 
771  if (radial_zlut.count > 0) {
772 
773  if (gain)
774  calib_gain = cudaImageListf::alloc(img_width,img_height,radial_zlut.count);
775 
776  if (offset)
777  calib_offset = cudaImageListf::alloc(img_width,img_height,radial_zlut.count);
778 
779  for (int j=0;j<radial_zlut.count;j++) {
780  if (gain) calib_gain.copyImageToDevice(j, &gain[img_width*img_height*j]);
781  if (offset) calib_offset.copyImageToDevice(j, &offset[img_width*img_height*j]);
782  }
783  }
784 }
cudaImageListf calib_gain
List in which to keep the gain images.
cudaImageListf calib_offset
List in which to keep the offset images.
int index
Device index of the device this instance is located on.
static cudaImageList< float > alloc(int w, int h, int amount)
Definition: cudaImageList.h:35
void copyImageToDevice(int img, T *src, bool async=false, cudaStream_t s=0)
cudaImageListf radial_zlut
List in which to keep the lookup table images.

§ SetRadialWeights()

void QueuedCUDATracker::Device::SetRadialWeights ( float *  zcmp)

Set the radial weights used to calculate ZLUT plane match scores.

The radial weights are used by ZLUT_ComputeProfileMatchScores, if set.

Parameters
[in]zcmpArray with the weights to be used. Size has to equal QtrkComputedConfig::radialsteps.

Definition at line 825 of file QueuedCUDATracker.cu.

826 {
827  cudaSetDevice(index);
828  if (zcmp)
830  else
832 }
device_vec< float > zcompareWindow
Vector in which to keep the radial weights for error curve calculation.
void free()
Definition: gpu_utils.h:104
int index
Device index of the device this instance is located on.
void copyToDevice(const std::vector< T > &src, bool async=false, cudaStream_t s=0)
Definition: gpu_utils.h:137
cudaImageListf radial_zlut
List in which to keep the lookup table images.

§ SetRadialZLUT()

void QueuedCUDATracker::Device::SetRadialZLUT ( float *  data,
int  radialsteps,
int  planes,
int  numLUTs 
)

Copy the ZLUT data to device memory.

Parameters
[in]dataPointer to the start of the ZLUT data.
[in]radialstepsNumber of radialsteps per LUT plane
[in]planesNumber of planes per ZLUT.
[in]numLUTsNumber of ZLUTs in the dataset.
Bug:
Why is this copied per-image rather than one big copy?

Definition at line 812 of file QueuedCUDATracker.cu.

813 {
814  cudaSetDevice(index);
815 
816  radial_zlut.free();
817  radial_zlut = cudaImageListf::alloc(radialsteps, planes, numLUTs);
818  if (data) {
819  for (int i=0;i<numLUTs;i++)
820  radial_zlut.copyImageToDevice(i, &data[planes*radialsteps*i]);
821  }
822  else radial_zlut.clear();
823 }
int index
Device index of the device this instance is located on.
static cudaImageList< float > alloc(int w, int h, int amount)
Definition: cudaImageList.h:35
void copyImageToDevice(int img, T *src, bool async=false, cudaStream_t s=0)
cudaImageListf radial_zlut
List in which to keep the lookup table images.

Member Data Documentation

§ calib_gain

cudaImageListf QueuedCUDATracker::Device::calib_gain

List in which to keep the gain images.

Definition at line 249 of file QueuedCUDATracker.h.

§ calib_offset

cudaImageListf QueuedCUDATracker::Device::calib_offset

List in which to keep the offset images.

Definition at line 248 of file QueuedCUDATracker.h.

§ index

int QueuedCUDATracker::Device::index

Device index of the device this instance is located on.

Definition at line 254 of file QueuedCUDATracker.h.

§ qalign_instance

QI::DeviceInstance QueuedCUDATracker::Device::qalign_instance

Instance of global values used by the QI submodule used to perform QI alignment.

Definition at line 252 of file QueuedCUDATracker.h.

§ qi_instance

QI::DeviceInstance QueuedCUDATracker::Device::qi_instance

Instance of global values used by the QI submodule.

Definition at line 251 of file QueuedCUDATracker.h.

§ radial_zlut

cudaImageListf QueuedCUDATracker::Device::radial_zlut

List in which to keep the lookup table images.

Definition at line 247 of file QueuedCUDATracker.h.

§ zcompareWindow

device_vec<float> QueuedCUDATracker::Device::zcompareWindow

Vector in which to keep the radial weights for error curve calculation.

Definition at line 250 of file QueuedCUDATracker.h.

§ zlut_trigtable

device_vec<float2> QueuedCUDATracker::Device::zlut_trigtable

Vector of pre-calculated 2D sampling points.

Definition at line 253 of file QueuedCUDATracker.h.


The documentation for this struct was generated from the following files: