COMPASS  5.0.0
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-2019 COMPASS Team <https://github.com/ANR-COMPASS>
5 // All rights reserved.
6 // Distributed under GNU - LGPL
7 //
8 // COMPASS is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser
9 // General Public License as published by the Free Software Foundation, either version 3 of the License,
10 // or any later version.
11 //
12 // COMPASS: End-to-end AO simulation tool using GPU acceleration
13 // The COMPASS platform was designed to meet the need of high-performance for the simulation of AO systems.
14 //
15 // The final product includes a software package for simulating all the critical subcomponents of AO,
16 // particularly in the context of the ELT and a real-time core based on several control approaches,
17 // with performances consistent with its integration into an instrument. Taking advantage of the specific
18 // hardware architecture of the GPU, the COMPASS tool allows to achieve adequate execution speeds to
19 // conduct large simulation campaigns called to the ELT.
20 //
21 // The COMPASS platform can be used to carry a wide variety of simulations to both testspecific components
22 // of AO of the E-ELT (such as wavefront analysis device with a pyramid or elongated Laser star), and
23 // various systems configurations such as multi-conjugate AO.
24 //
25 // COMPASS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
26 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
27 // See the GNU Lesser General Public License for more details.
28 //
29 // You should have received a copy of the GNU Lesser General Public License along with COMPASS.
30 // If not, see <https://www.gnu.org/licenses/lgpl-3.0.txt>.
31 // -----------------------------------------------------------------------------
32 
41 
42 #ifndef _SUTRA_UTILS_H_
43 #define _SUTRA_UTILS_H_
44 #include <carma.h>
45 #include <carma_obj.h>
46 #include <carma_sparse_obj.h>
47 
48 int compute_nmaxhr(long nvalid);
49 int cfillrealp(cuFloatComplex *d_odata, float *d_idata, int N,
50  CarmaDevice *device);
51 int cgetrealp(float *d_odata, cuFloatComplex *d_idata, int N,
52  CarmaDevice *device);
53 int abs2(float *d_odata, cuFloatComplex *d_idata, int N, CarmaDevice *device);
54 int abs2(float *d_odata, cuFloatComplex *d_idata, int N, float fact,
55  CarmaDevice *device);
56 int abs2c(cuFloatComplex *d_odata, cuFloatComplex *d_idata, int N,
57  CarmaDevice *device);
58 int convolve(cuFloatComplex *d_odata, cuFloatComplex *d_idata, int N,
59  CarmaDevice *device);
60 int convolve_modulate(cuFloatComplex *d_odata, cuFloatComplex *d_idata, int mod,
61  int N, CarmaDevice *device);
62 int subap_norm(float *d_odata, float *d_idata, float *fact, float *norm,
63  float nphot, int n, int N, CarmaDevice *device);
64 int fillindx(float *d_odata, float *d_idata, int *indx, float alpha, float beta,
65  int N, CarmaDevice *device);
66 int fillindx(float *d_odata, float *d_idata, int *indx, float alpha, int N,
67  CarmaDevice *device);
68 int fillindx(float *d_odata, float *d_idata, int *indx, int N,
69  CarmaDevice *device);
70 int fillarr2d(float *d_odata, float *d_idata, int x0, int Ncol, int NC, int N,
71  CarmaDevice *device);
72 int fillarr2d(float *d_odata, float *d_idata, int x0, int Ncol, int NC, int N,
73  int dir, CarmaDevice *device);
74 int getarr2d(float *d_odata, float *d_idata, int x0, int Ncol, int NC, int N,
75  CarmaDevice *device);
76 template <class T>
77 int addai(T *d_odata, T *i_data, int i, int sgn, int N, CarmaDevice *device);
78 int subap_norm_async(float *d_odata, float *d_idata, float *fact, float *norm,
79  float nphot, int n, int N, CarmaStreams *streams,
80  CarmaDevice *device);
81 // templates
82 template <class T>
83 int roll(T *idata, int N, int M, int nim, CarmaDevice *device);
84 template <class T>
85 int roll(T *idata, int N, int M, CarmaDevice *device);
86 template <class T>
87 int roll_mult(T *odata, T *idata, int N, int M, T alpha, CarmaDevice *device);
88 template <class T>
90  CarmaObj<T> *eigenvals, CarmaObj<T> *mod2act,
91  CarmaObj<T> *mes2mod, int nfilt);
92 template <class T>
93 int remove_avg(T *data, int N, CarmaDevice *device);
94 template <class T>
95 int mult_vect(T *d_data, T *scale, int N, CarmaDevice *device);
96 template <class T>
97 int mult_vect(T *d_data, T *scale, T gain, int N, CarmaDevice *device);
98 template <class T>
99 int mult_vect(T *d_data, T gain, int N, CarmaDevice *device);
100 
101 int mult_int(float *o_data, float *i_data, float *scale, float gain, int N,
102  CarmaDevice *device);
103 int mult_int(float *o_data, float *i_data, float *scale, float gain, int N,
104  CarmaDevice *device, CarmaStreams *streams);
105 int mult_int(float *o_data, float *i_data, float gain, int N,
106  CarmaDevice *device);
107 int add_md(float *o_matrix, float *i_matrix, float *i_vector, int N,
108  CarmaDevice *device);
109 
110 #endif // _SUTRA_UTILS_H_
CarmaDevice
Definition: carma_context.h:57
convolve_modulate
int convolve_modulate(cuFloatComplex *d_odata, cuFloatComplex *d_idata, int mod, int N, CarmaDevice *device)
subap_norm
int subap_norm(float *d_odata, float *d_idata, float *fact, float *norm, float nphot, int n, int N, CarmaDevice *device)
mult_int
int mult_int(float *o_data, float *i_data, float *scale, float gain, int N, CarmaDevice *device)
compute_nmaxhr
int compute_nmaxhr(long nvalid)
mult_vect
int mult_vect(T *d_data, T *scale, int N, CarmaDevice *device)
CarmaStreams
this class provides the stream features to CarmaObj
Definition: carma_streams.h:49
add_md
int add_md(float *o_matrix, float *i_matrix, float *i_vector, int N, CarmaDevice *device)
cfillrealp
int cfillrealp(cuFloatComplex *d_odata, float *d_idata, int N, CarmaDevice *device)
addai
int addai(T *d_odata, T *i_data, int i, int sgn, int N, CarmaDevice *device)
fillarr2d
int fillarr2d(float *d_odata, float *d_idata, int x0, int Ncol, int NC, int N, CarmaDevice *device)
CarmaObj< T >
cgetrealp
int cgetrealp(float *d_odata, cuFloatComplex *d_idata, int N, CarmaDevice *device)
carma_obj.h
sutra_invgene
int sutra_invgene(CarmaObj< T > *imat, CarmaObj< T > *cmat, CarmaObj< T > *eigenvals, CarmaObj< T > *mod2act, CarmaObj< T > *mes2mod, int nfilt)
getarr2d
int getarr2d(float *d_odata, float *d_idata, int x0, int Ncol, int NC, int N, CarmaDevice *device)
abs2c
int abs2c(cuFloatComplex *d_odata, cuFloatComplex *d_idata, int N, CarmaDevice *device)
subap_norm_async
int subap_norm_async(float *d_odata, float *d_idata, float *fact, float *norm, float nphot, int n, int N, CarmaStreams *streams, CarmaDevice *device)
convolve
int convolve(cuFloatComplex *d_odata, cuFloatComplex *d_idata, int N, CarmaDevice *device)
fillindx
int fillindx(float *d_odata, float *d_idata, int *indx, float alpha, float beta, int N, CarmaDevice *device)
roll_mult
int roll_mult(T *odata, T *idata, int N, int M, T alpha, CarmaDevice *device)
remove_avg
int remove_avg(T *data, int N, CarmaDevice *device)
roll
int roll(T *idata, int N, int M, int nim, CarmaDevice *device)
carma_sparse_obj.h
abs2
int abs2(float *d_odata, cuFloatComplex *d_idata, int N, CarmaDevice *device)