RISA
risa::cuda::Template Class Reference

This stage transfer a data element from device to host. More...

#include <Template.h>

Collaboration diagram for risa::cuda::Template:

Public Types

using hostManagerType = glados::cuda::HostMemoryManager< float, glados::cuda::async_copy_policy >
 The input data type that needs to fit the output type of the previous stage. More...
 
using input_type = glados::Image< glados::cuda::DeviceMemoryManager< float, glados::cuda::async_copy_policy >>
 The output data type that needs to fit the input type of the following stage. More...
 
using output_type = glados::Image< glados::cuda::HostMemoryManager< float, glados::cuda::async_copy_policy >>
 

Public Member Functions

 Template (const std::string &configFile)
 Initializes everything, that needs to be done only once. More...
 
 ~Template ()
 Destroys everything that is not destroyed automatically. More...
 
auto process (input_type &&img) -> void
 Pushes the sinogram to the processor-threads. More...
 
auto wait () -> output_type
 Takes one sinogram from the output queue results_ and transfers it to the neighbored stage. More...
 

Private Member Functions

auto processor (const int deviceID) -> void
 main data processing routine executed in its own thread for each CUDA device, that performs the data processing of this stage More...
 
auto readConfig (const std::string &configFile) -> bool
 Read configuration values from configuration file. More...
 

Private Attributes

std::map< int, glados::Queue< input_type > > imgs_
 one separate input queue for each available CUDA device More...
 
glados::Queue< output_typeresults_
 the output queue in which the processed sinograms are stored More...
 
std::map< int, std::thread > processorThreads_
 stores the processor()-threads More...
 
std::map< int, cudaStream_t > streams_
 stores the cudaStreams that are created once More...
 
unsigned int memoryPoolIdx_
 stores the indeces received when regisitering in MemoryPool More...
 
int memPoolSize_
 specifies, how many elements are allocated by memory pool More...
 
int numberOfDevices_
 the number of available CUDA devices in the system More...
 
int numberOfPixels_
 the number of pixels in one direction in the reconstructed image More...
 

Detailed Description

This stage transfer a data element from device to host.

Definition at line 39 of file Template.h.

Member Typedef Documentation

The input data type that needs to fit the output type of the previous stage.

Definition at line 42 of file Template.h.

The output data type that needs to fit the input type of the following stage.

Definition at line 44 of file Template.h.

Constructor & Destructor Documentation

risa::cuda::Template::Template ( const std::string &  configFile)

Initializes everything, that needs to be done only once.

Runs as many processor-thread as CUDA devices are available in the system. Allocates memory using the MemoryPool.

Parameters
[in]configFilepath to configuration file

Definition at line 39 of file Template.cu.

risa::cuda::Template::~Template ( )

Destroys everything that is not destroyed automatically.

Tells MemoryPool to free the allocated memory. Destroys the cudaStreams.

Definition at line 70 of file Template.cu.

Member Function Documentation

auto risa::cuda::Template::process ( input_type &&  img) -> void

Pushes the sinogram to the processor-threads.

The scheduling for multi-GPU usage is done in this function.

Parameters
[in]sinograminput data that arrived from previous stage

Definition at line 80 of file Template.cu.

auto risa::cuda::Template::processor ( const int  deviceID) -> void
private

main data processing routine executed in its own thread for each CUDA device, that performs the data processing of this stage

This method takes one image from the input queue imgs_. The image is transfered from device to host using the asynchronous cudaMemcpyAsync()-operation. The resulting host structure is pushed back into the output queue results_.

Parameters
[in]deviceIDspecifies on which CUDA device to execute the device functions

Definition at line 106 of file Template.cu.

auto risa::cuda::Template::readConfig ( const std::string &  configFile) -> bool
private

Read configuration values from configuration file.

All values needed for setting up the class are read from the config file in this function.

Parameters
[in]configFilepath to config file
Return values
trueconfiguration options were read successfully
falseconfiguration options could not be read successfully

Definition at line 134 of file Template.cu.

auto risa::cuda::Template::wait ( ) -> output_type

Takes one sinogram from the output queue results_ and transfers it to the neighbored stage.

Returns
the oldest sinogram in the output queue results_

Definition at line 102 of file Template.cu.

Member Data Documentation

std::map<int, glados::Queue<input_type> > risa::cuda::Template::imgs_
private

one separate input queue for each available CUDA device

Definition at line 81 of file Template.h.

unsigned int risa::cuda::Template::memoryPoolIdx_
private

stores the indeces received when regisitering in MemoryPool

Definition at line 87 of file Template.h.

int risa::cuda::Template::memPoolSize_
private

specifies, how many elements are allocated by memory pool

Definition at line 89 of file Template.h.

int risa::cuda::Template::numberOfDevices_
private

the number of available CUDA devices in the system

Definition at line 91 of file Template.h.

int risa::cuda::Template::numberOfPixels_
private

the number of pixels in one direction in the reconstructed image

Definition at line 92 of file Template.h.

std::map<int, std::thread> risa::cuda::Template::processorThreads_
private

stores the processor()-threads

Definition at line 84 of file Template.h.

glados::Queue<output_type> risa::cuda::Template::results_
private

the output queue in which the processed sinograms are stored

Definition at line 82 of file Template.h.

std::map<int, cudaStream_t> risa::cuda::Template::streams_
private

stores the cudaStreams that are created once

Definition at line 85 of file Template.h.


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