COMPASS  5.0.0
End-to-end AO simulation tool using GPU acceleration
carma_obj.h File Reference
#include <carma_context.h>
#include <carma_streams.h>
#include <carma_utils.h>
#include <curand.h>
#include <curand_kernel.h>
#include <iostream>
#include <type_traits>
#include <typeinfo>
Include dependency graph for carma_obj.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CarmaData< T_data >
 
class  CarmaHostObj< T_data >
 this class provides wrappers to the generic carma host object More...
 
class  CarmaObj
 this class provides wrappers to the generic carma object More...
 

Macros

#define BLOCK_SZ   16
 

Typedefs

typedef CarmaObj< int > CarmaObjI
 
typedef CarmaObj< unsigned int > CarmaObjUI
 
typedef CarmaObj< uint16_t > CarmaObjUSI
 
typedef CarmaObj< float > CarmaObjS
 
typedef CarmaObj< double > CarmaObjD
 
typedef CarmaObj< float2 > CarmaObjS2
 
typedef CarmaObj< double2 > CarmaObjD2
 
typedef CarmaObj< cuFloatComplex > CarmaObjC
 
typedef CarmaObj< cuDoubleComplex > CarmaObjZ
 

Enumerations

enum  MemType {
  MT_DEVICE, MT_DARRAY, MT_HOST, MT_PAGELOCK,
  MT_ZEROCPY, MT_PORTABLE, MT_WRICOMB, MT_GENEPIN
}
 

Functions

template<class T_data >
std::ostream & operator<< (std::ostream &os, CarmaObj< T_data > &obj)
 
template<class T_data >
void clip_array (T_data *d_data, T_data min, T_data max, int N, CarmaDevice *device)
 
template<class T_data >
void reduce (int size, int threads, int blocks, T_data *d_idata, T_data *d_odata)
 
template<class T_data >
T_data reduce (T_data *data, int N)
 
template<class T_data >
void init_reduceCubCU (T_data *&cub_data, size_t &cub_data_size, T_data *data, T_data *&o_data, int N)
 
template<class T_data >
void reduceCubCU (T_data *cub_data, size_t cub_data_size, T_data *data, T_data *o_data, int N)
 
template<class T_data >
int transposeCU (T_data *d_idata, T_data *d_odata, long N1, long N2)
 
template<class T_data >
int launch_generic1d (T_data *d_idata, T_data *d_odata, int N, CarmaDevice *device)
 
template<class T_data >
int launch_generic2d (T_data *d_odata, T_data *d_idata, int N1, int N2)
 
int carma_prng_init (int *seed, const int nb_threads, const int nb_blocks, curandState *state)
 
template<class T >
int carma_prng_cu (T *results, const int nb_threads, const int nb_blocks, curandState *state, char gtype, int n, float alpha, float beta)
 
template<class T >
int carma_curand_montagn (curandState *state, T *d_odata, int N, CarmaDevice *device)
 
template<class T_in , class T_out >
cufftType carma_select_plan ()
 
template<class T_in , class T_out >
void carma_initfft (const long *dims_data, cufftHandle *plan, cufftType type_plan)
 
template<class T_in , class T_out >
int CarmaFFT (T_in *input, T_out *output, int dir, cufftHandle plan)
 
template<class T_data >
int fillindex (T_data *d_odata, T_data *d_idata, int *indx, int N, CarmaDevice *device)
 
template<class T_data >
int fillvalues (T_data *d_odata, T_data *val, int N, CarmaDevice *device)
 
template<class T >
int getarray2d (T *d_odata, T *d_idata, int x0, int Ncol, int NC, int N, CarmaDevice *device)
 
template<class T >
int fillarray2d (T *d_odata, T *d_idata, int x0, int Ncol, int NC, int N, CarmaDevice *device)
 
template<class T >
int fillarray2d2 (T *d_odata, T *d_idata, int x0, int Ncol, int NC, int N, CarmaDevice *device)
 
template<class T >
int fill_sym_matrix (char src_uplo, T *d_data, int Ncol, int N, CarmaDevice *device)
 
template<class T >
int carma_plus (T *d_odata, T elpha, int N, CarmaDevice *device)
 
template<class T >
int carma_plusai (T *d_odata, T *i_data, int i, int sgn, int N, CarmaDevice *device)
 
int fftconv_unpad (float *d_odata, float *d_idata, int fftW, int dataH, int dataW, int N, int n, int nim)
 
int carma_initfftconv (CarmaObjS *data_in, CarmaObjS *kernel_in, CarmaObjS *padded_data, CarmaObjC *padded_spectrum, int kernelY, int kernelX)
 
int carma_fftconv (CarmaObjS *data_out, CarmaObjS *padded_data, CarmaObjC *padded_spectrum, int kernelY, int kernelX)
 
template<class T >
int extract (T *d_smallimg, const T *d_fullimg, int fullimg_size, int center_pos, int extract_size, bool roll)
 Kernel to extract a part of the image centred on center_pos. More...
 

Macro Definition Documentation

◆ BLOCK_SZ

#define BLOCK_SZ   16

Definition at line 79 of file carma_obj.h.

Typedef Documentation

◆ CarmaObjC

typedef CarmaObj<cuFloatComplex> CarmaObjC

Definition at line 381 of file carma_obj.h.

◆ CarmaObjD

typedef CarmaObj<double> CarmaObjD

Definition at line 378 of file carma_obj.h.

◆ CarmaObjD2

typedef CarmaObj<double2> CarmaObjD2

Definition at line 380 of file carma_obj.h.

◆ CarmaObjI

typedef CarmaObj<int> CarmaObjI

Definition at line 374 of file carma_obj.h.

◆ CarmaObjS

typedef CarmaObj<float> CarmaObjS

Definition at line 377 of file carma_obj.h.

◆ CarmaObjS2

typedef CarmaObj<float2> CarmaObjS2

Definition at line 379 of file carma_obj.h.

◆ CarmaObjUI

typedef CarmaObj<unsigned int> CarmaObjUI

Definition at line 375 of file carma_obj.h.

◆ CarmaObjUSI

typedef CarmaObj<uint16_t> CarmaObjUSI

Definition at line 376 of file carma_obj.h.

◆ CarmaObjZ

typedef CarmaObj<cuDoubleComplex> CarmaObjZ

Definition at line 382 of file carma_obj.h.

Enumeration Type Documentation

◆ MemType

enum MemType
Enumerator
MT_DEVICE 
MT_DARRAY 
MT_HOST 
MT_PAGELOCK 
MT_ZEROCPY 
MT_PORTABLE 
MT_WRICOMB 
MT_GENEPIN 

Definition at line 80 of file carma_obj.h.

80  {
81  MT_DEVICE,
82  MT_DARRAY,
83  MT_HOST,
85  MT_ZEROCPY,
87  MT_WRICOMB,
89 };

Function Documentation

◆ carma_curand_montagn()

template<class T >
int carma_curand_montagn ( curandState *  state,
T *  d_odata,
int  N,
CarmaDevice device 
)

◆ carma_fftconv()

int carma_fftconv ( CarmaObjS data_out,
CarmaObjS padded_data,
CarmaObjC padded_spectrum,
int  kernelY,
int  kernelX 
)

◆ carma_initfft()

template<class T_in , class T_out >
void carma_initfft ( const long *  dims_data,
cufftHandle *  plan,
cufftType  type_plan 
)

◆ carma_initfftconv()

int carma_initfftconv ( CarmaObjS data_in,
CarmaObjS kernel_in,
CarmaObjS padded_data,
CarmaObjC padded_spectrum,
int  kernelY,
int  kernelX 
)

◆ carma_plus()

template<class T >
int carma_plus ( T *  d_odata,
elpha,
int  N,
CarmaDevice device 
)

◆ carma_plusai()

template<class T >
int carma_plusai ( T *  d_odata,
T *  i_data,
int  i,
int  sgn,
int  N,
CarmaDevice device 
)

◆ carma_prng_cu()

template<class T >
int carma_prng_cu ( T *  results,
const int  nb_threads,
const int  nb_blocks,
curandState *  state,
char  gtype,
int  n,
float  alpha,
float  beta 
)

◆ carma_prng_init()

int carma_prng_init ( int *  seed,
const int  nb_threads,
const int  nb_blocks,
curandState *  state 
)

◆ carma_select_plan()

template<class T_in , class T_out >
cufftType carma_select_plan ( )

◆ CarmaFFT()

template<class T_in , class T_out >
int CarmaFFT ( T_in *  input,
T_out *  output,
int  dir,
cufftHandle  plan 
)

◆ clip_array()

template<class T_data >
void clip_array ( T_data *  d_data,
T_data  min,
T_data  max,
int  N,
CarmaDevice device 
)

◆ extract()

template<class T >
int extract ( T *  d_smallimg,
const T *  d_fullimg,
int  fullimg_size,
int  center_pos,
int  extract_size,
bool  roll 
)

Kernel to extract a part of the image centred on center_pos.

Template Parameters
Ttype of the image items
Parameters
d_smallimgextracted small image of size extract_size*extract_size
d_fullimgfull image of size fullimg_size*fullimg_size
fullimg_sizesize of the d_fullimg leading dimension
center_posposition of the center of d_smallimg in d_fullimg
extract_sizesize of the d_smallimg leading dimension
rollget pixels as if d_fullimg need to be roll

◆ fftconv_unpad()

int fftconv_unpad ( float *  d_odata,
float *  d_idata,
int  fftW,
int  dataH,
int  dataW,
int  N,
int  n,
int  nim 
)

◆ fill_sym_matrix()

template<class T >
int fill_sym_matrix ( char  src_uplo,
T *  d_data,
int  Ncol,
int  N,
CarmaDevice device 
)

◆ fillarray2d()

template<class T >
int fillarray2d ( T *  d_odata,
T *  d_idata,
int  x0,
int  Ncol,
int  NC,
int  N,
CarmaDevice device 
)

◆ fillarray2d2()

template<class T >
int fillarray2d2 ( T *  d_odata,
T *  d_idata,
int  x0,
int  Ncol,
int  NC,
int  N,
CarmaDevice device 
)

◆ fillindex()

template<class T_data >
int fillindex ( T_data *  d_odata,
T_data *  d_idata,
int *  indx,
int  N,
CarmaDevice device 
)

◆ fillvalues()

template<class T_data >
int fillvalues ( T_data *  d_odata,
T_data *  val,
int  N,
CarmaDevice device 
)

◆ getarray2d()

template<class T >
int getarray2d ( T *  d_odata,
T *  d_idata,
int  x0,
int  Ncol,
int  NC,
int  N,
CarmaDevice device 
)

◆ init_reduceCubCU()

template<class T_data >
void init_reduceCubCU ( T_data *&  cub_data,
size_t &  cub_data_size,
T_data *  data,
T_data *&  o_data,
int  N 
)

◆ launch_generic1d()

template<class T_data >
int launch_generic1d ( T_data *  d_idata,
T_data *  d_odata,
int  N,
CarmaDevice device 
)

◆ launch_generic2d()

template<class T_data >
int launch_generic2d ( T_data *  d_odata,
T_data *  d_idata,
int  N1,
int  N2 
)

◆ operator<<()

template<class T_data >
std::ostream& operator<< ( std::ostream &  os,
CarmaObj< T_data > &  obj 
)

Definition at line 390 of file carma_obj.h.

390  {
391  os << "-----------------------" << std::endl;
392  os << "CarmaObj<" << typeid(T_data).name() << "> object on GPU"
393  << obj.get_device() << std::endl;
394  long ndims = obj.get_dims(0);
395  os << "ndims = " << ndims << std::endl;
396  for (long dim = 0; dim < ndims; dim++) {
397  os << "dim[" << dim << "] = " << obj.get_dims(dim + 1) << std::endl;
398  }
399  os << "nbElem = " << obj.get_nb_elements() << std::endl;
400  os << "sizeof(" << typeid(T_data).name() << ") = " << sizeof(T_data)
401  << std::endl;
402  os << "-----------------------" << std::endl;
403  return os;
404 }
Here is the call graph for this function:

◆ reduce() [1/2]

template<class T_data >
void reduce ( int  size,
int  threads,
int  blocks,
T_data *  d_idata,
T_data *  d_odata 
)

◆ reduce() [2/2]

template<class T_data >
T_data reduce ( T_data *  data,
int  N 
)

◆ reduceCubCU()

template<class T_data >
void reduceCubCU ( T_data *  cub_data,
size_t  cub_data_size,
T_data *  data,
T_data *  o_data,
int  N 
)

◆ transposeCU()

template<class T_data >
int transposeCU ( T_data *  d_idata,
T_data *  d_odata,
long  N1,
long  N2 
)
CarmaObj::get_dims
const long * get_dims()
Definition: carma_obj.h:239
MT_WRICOMB
@ MT_WRICOMB
Definition: carma_obj.h:87
MT_GENEPIN
@ MT_GENEPIN
Definition: carma_obj.h:88
MT_DEVICE
@ MT_DEVICE
Definition: carma_obj.h:81
CarmaObj::get_nb_elements
int get_nb_elements()
Definition: carma_obj.h:241
MT_HOST
@ MT_HOST
Definition: carma_obj.h:83
MT_DARRAY
@ MT_DARRAY
Definition: carma_obj.h:82
MT_PORTABLE
@ MT_PORTABLE
Definition: carma_obj.h:86
layers_test.name
string name
Definition: layers_test.py:21
MT_ZEROCPY
@ MT_ZEROCPY
Definition: carma_obj.h:85
CarmaObj::get_device
int get_device()
Definition: carma_obj.h:244
MT_PAGELOCK
@ MT_PAGELOCK
Definition: carma_obj.h:84