COMPASS  5.4.4
End-to-end AO simulation tool using GPU acceleration
sutra_utils.h
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 // This file is part of COMPASS <https://anr-compass.github.io/compass/>
3 //
4 // Copyright (C) 2011-2023 COMPASS Team <https://github.com/ANR-COMPASS>
5 // All rights reserved.
6 
7 // -----------------------------------------------------------------------------
8 
16 
17 #ifndef _SUTRA_UTILS_H_
18 #define _SUTRA_UTILS_H_
19 #include <carma.h>
20 #include <carma_obj.h>
21 #include <carma_sparse_obj.h>
22 
23 int compute_nmaxhr(long nvalid);
24 int cfillrealp(cuFloatComplex *d_odata, float *d_idata, int N,
25  CarmaDevice *device);
26 int cgetrealp(float *d_odata, cuFloatComplex *d_idata, int N,
27  CarmaDevice *device);
28 int abs2(float *d_odata, cuFloatComplex *d_idata, int N, CarmaDevice *device);
29 int abs2(float *d_odata, cuFloatComplex *d_idata, int N, float fact,
30  CarmaDevice *device);
31 int abs2c(cuFloatComplex *d_odata, cuFloatComplex *d_idata, int N,
32  CarmaDevice *device);
33 int convolve(cuFloatComplex *d_odata, cuFloatComplex *d_idata, int N,
34  CarmaDevice *device);
35 int convolve_modulate(cuFloatComplex *d_odata, cuFloatComplex *d_idata, int mod,
36  int N, CarmaDevice *device);
37 int subap_norm(float *d_odata, float *d_idata, float *fact, float *norm,
38  float nphot, int n, int N, CarmaDevice *device);
39 int fillindx(float *d_odata, float *d_idata, int *indx, float alpha, float beta,
40  int N, CarmaDevice *device);
41 int fillindx(float *d_odata, float *d_idata, int *indx, float alpha, int N,
42  CarmaDevice *device);
43 int fillindx(float *d_odata, float *d_idata, int *indx, int N,
44  CarmaDevice *device);
45 int fillarr2d(float *d_odata, float *d_idata, int x0, int Ncol, int NC, int N,
46  CarmaDevice *device);
47 int fillarr2d(float *d_odata, float *d_idata, int x0, int Ncol, int NC, int N,
48  int dir, CarmaDevice *device);
49 int getarr2d(float *d_odata, float *d_idata, int x0, int Ncol, int NC, int N,
50  CarmaDevice *device);
51 template <class T>
52 int addai(T *d_odata, T *i_data, int i, int sgn, int N, CarmaDevice *device);
53 int subap_norm_async(float *d_odata, float *d_idata, float *fact, float *norm,
54  float nphot, int n, int N, CarmaStreams *streams,
55  CarmaDevice *device);
56 // templates
57 template <class T>
58 int roll(T *idata, int N, int M, int nim, CarmaDevice *device);
59 template <class T>
60 int roll(T *idata, int N, int M, CarmaDevice *device);
61 template <class T>
62 int roll_mult(T *odata, T *idata, int N, int M, T alpha, CarmaDevice *device);
63 template <class T>
65  CarmaObj<T> *eigenvals, CarmaObj<T> *mod2act,
66  CarmaObj<T> *mes2mod, int nfilt);
67 template <class T>
68 int remove_avg(T *data, int N, CarmaDevice *device);
69 template <class T>
70 int mult_vect(T *d_data, T *scale, int N, CarmaDevice *device);
71 template <class T>
72 int mult_vect(T *d_data, T *scale, T gain, int N, CarmaDevice *device);
73 template <class T>
74 int mult_vect(T *d_data, T gain, int N, CarmaDevice *device);
75 
76 int mult_int(float *o_data, float *i_data, float *scale, float gain, int N,
77  CarmaDevice *device);
78 int mult_int(float *o_data, float *i_data, float *scale, float gain, int N,
79  CarmaDevice *device, CarmaStreams *streams);
80 int mult_int(float *o_data, float *i_data, float gain, int N,
81  CarmaDevice *device);
82 int add_md(float *o_matrix, float *i_matrix, float *i_vector, int N,
83  CarmaDevice *device);
84 
85 #endif // _SUTRA_UTILS_H_
this class provides the stream features to CarmaObj
Definition: carma_streams.h:24
int roll_mult(T *odata, T *idata, int N, int M, T alpha, CarmaDevice *device)
int subap_norm(float *d_odata, float *d_idata, float *fact, float *norm, float nphot, int n, int N, CarmaDevice *device)
int sutra_invgene(CarmaObj< T > *imat, CarmaObj< T > *cmat, CarmaObj< T > *eigenvals, CarmaObj< T > *mod2act, CarmaObj< T > *mes2mod, int nfilt)
int convolve_modulate(cuFloatComplex *d_odata, cuFloatComplex *d_idata, int mod, int N, CarmaDevice *device)
int cfillrealp(cuFloatComplex *d_odata, float *d_idata, int N, CarmaDevice *device)
int abs2c(cuFloatComplex *d_odata, cuFloatComplex *d_idata, int N, CarmaDevice *device)
int abs2(float *d_odata, cuFloatComplex *d_idata, int N, CarmaDevice *device)
int compute_nmaxhr(long nvalid)
int addai(T *d_odata, T *i_data, int i, int sgn, int N, CarmaDevice *device)
int cgetrealp(float *d_odata, cuFloatComplex *d_idata, int N, CarmaDevice *device)
int fillarr2d(float *d_odata, float *d_idata, int x0, int Ncol, int NC, int N, CarmaDevice *device)
int convolve(cuFloatComplex *d_odata, cuFloatComplex *d_idata, int N, CarmaDevice *device)
int mult_vect(T *d_data, T *scale, int N, CarmaDevice *device)
int roll(T *idata, int N, int M, int nim, CarmaDevice *device)
int add_md(float *o_matrix, float *i_matrix, float *i_vector, int N, CarmaDevice *device)
int fillindx(float *d_odata, float *d_idata, int *indx, float alpha, float beta, int N, CarmaDevice *device)
int getarr2d(float *d_odata, float *d_idata, int x0, int Ncol, int NC, int N, CarmaDevice *device)
int remove_avg(T *data, int N, CarmaDevice *device)
int subap_norm_async(float *d_odata, float *d_idata, float *fact, float *norm, float nphot, int n, int N, CarmaStreams *streams, CarmaDevice *device)
int mult_int(float *o_data, float *i_data, float *scale, float gain, int N, CarmaDevice *device)