COMPASS  5.0.0
End-to-end AO simulation tool using GPU acceleration
sutra_groot.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_GROOT_H_
43 #define _SUTRA_GROOT_H_
44 
45 #include <carma.h>
46 #include <carma_cublas.h>
47 #include <carma_host_obj.h>
48 #include <carma_obj.h>
49 #include <carma_sparse_obj.h>
50 
51 class SutraGroot {
52  public:
54  int device;
55 
56  int nactus; // number of actuators
57  int nssp; // number of valid ssp
58  int nlayers; // number of atmos layers
59  int npts; // number of samples for aliasig computation
60  float gsangle; // Guide star angle [rad]
61  float fc; // DM cut-off frequency [m]
62  float scale;
63  float d;
64 
65  CarmaHostObj<float> *h_vdt; // v*dt/g [m/s]
66  CarmaHostObj<float> *h_Htheta; // H*theta (theta = GS radial distance) [m]
68  CarmaHostObj<float> *h_winddir; // wind directions [rad]
69  CarmaHostObj<float> *h_scale; // r0**(-5/3) * frac * (lambda/2pi)**2
70  CarmaHostObj<float> *h_weights; // Simpson method weights for integration
71  // Covariance matrix estimation
72  CarmaObj<float> *d_Cerr; // Residual error covariance matrix on DM actuators
74  *d_TT; // TT component of the residual error covariance matrix
75  CarmaObj<float> *d_CaXX; // XX aliasing covariance matrix
76  CarmaObj<float> *d_CaYY; // YY aliasing covariance matrix
77 
79  *d_TTPfilter; // Tip-tilt and piston filter matrix (= Btt.dot(P))
80  CarmaObj<float> *d_pzt2tt; // pzt to TT matrix
81  CarmaObj<float> *d_Nact; // Coupling matrix
82  CarmaObj<float> *d_xpos; // X-positions of DM actuators or ssp [m]
83  CarmaObj<float> *d_ypos; // Y-positions of DM actuators or ssp [m]
84 
85  // Dphi lowpass
86  CarmaObj<float> *d_tab_int_x; // Tabulated integral
88 
89  public:
90  SutraGroot(CarmaContext *context, int device, int nactus, int nlayers,
91  float gsangle, float *vdt, float *Htheta, float *L0,
92  float *winddir, float *scale, float *pzt2tt, float *TTPfilter,
93  float *Nact, float *xpos, float *ypos, float fc);
94 
95  SutraGroot(CarmaContext *context, int device, int nssp, float *weights,
96  float scale, float *xpos, float *ypos, float fc, float d,
97  int npts);
99 
100  cublasHandle_t cublas_handle() { return current_context->get_cublas_handle(); }
101  void init_common(CarmaContext *context, int device, float *xpos, float *ypos,
102  int N, float fc);
105 };
106 template <class T_data>
107 int compute_Cerr_layer(T_data *Cerr, int N, T_data *tab_int_x,
108  T_data *tab_int_y, T_data *xpos, T_data *ypos,
109  T_data vdt, T_data Htheta, T_data L0, T_data fc,
110  T_data winddir, T_data gsangle, T_data scale, int Ntab,
111  CarmaDevice *device);
112 template <class T_data>
113 int compute_Ca(T_data *CaXX, T_data *CaYY, int nssp, T_data *tab_int_x,
114  T_data *tab_int_y, T_data *xpos, T_data *ypos, T_data offset,
115  T_data d, T_data fc, T_data scale, T_data weight, int Ntab,
116  CarmaDevice *device);
117 template <class T_data>
118 int tab_u831J0(T_data *tab_int_x, T_data *tab_int_y, int N,
119  CarmaDevice *device);
120 template <class T_data>
121 void cumsum(T_data *odata, T_data *idata, int N);
122 template <class T_data>
123 int add_transpose(T_data *Cerr, int N, CarmaDevice *device);
124 
125 #endif
SutraGroot::SutraGroot
SutraGroot(CarmaContext *context, int device, int nssp, float *weights, float scale, float *xpos, float *ypos, float fc, float d, int npts)
SutraGroot::h_vdt
CarmaHostObj< float > * h_vdt
Definition: sutra_groot.h:65
compute_Ca
int compute_Ca(T_data *CaXX, T_data *CaYY, int nssp, T_data *tab_int_x, T_data *tab_int_y, T_data *xpos, T_data *ypos, T_data offset, T_data d, T_data fc, T_data scale, T_data weight, int Ntab, CarmaDevice *device)
cumsum
void cumsum(T_data *odata, T_data *idata, int N)
SutraGroot::h_Htheta
CarmaHostObj< float > * h_Htheta
Definition: sutra_groot.h:66
carma_cublas.h
this file provides the cublas features to CarmaObj
SutraGroot::d
float d
Definition: sutra_groot.h:63
SutraGroot::device
int device
Definition: sutra_groot.h:54
CarmaDevice
Definition: carma_context.h:57
SutraGroot::h_winddir
CarmaHostObj< float > * h_winddir
Definition: sutra_groot.h:68
SutraGroot::current_context
CarmaContext * current_context
Definition: sutra_groot.h:53
SutraGroot::d_ypos
CarmaObj< float > * d_ypos
Definition: sutra_groot.h:83
SutraGroot::d_xpos
CarmaObj< float > * d_xpos
Definition: sutra_groot.h:82
SutraGroot::cublas_handle
cublasHandle_t cublas_handle()
Definition: sutra_groot.h:100
SutraGroot::compute_Calias
int compute_Calias()
SutraGroot::h_L0
CarmaHostObj< float > * h_L0
Definition: sutra_groot.h:67
SutraGroot::d_tab_int_y
CarmaObj< float > * d_tab_int_y
Definition: sutra_groot.h:87
SutraGroot::nlayers
int nlayers
Definition: sutra_groot.h:58
SutraGroot::d_Cerr
CarmaObj< float > * d_Cerr
Definition: sutra_groot.h:72
SutraGroot::compute_Cerr
int compute_Cerr()
SutraGroot::~SutraGroot
~SutraGroot()
SutraGroot::init_common
void init_common(CarmaContext *context, int device, float *xpos, float *ypos, int N, float fc)
SutraGroot::d_TT
CarmaObj< float > * d_TT
Definition: sutra_groot.h:74
SutraGroot::nactus
int nactus
Definition: sutra_groot.h:56
SutraGroot::d_pzt2tt
CarmaObj< float > * d_pzt2tt
Definition: sutra_groot.h:80
CarmaObj< float >
carma_obj.h
CarmaContext
this class provides the context in which CarmaObj are created
Definition: carma_context.h:104
SutraGroot::gsangle
float gsangle
Definition: sutra_groot.h:60
CarmaContext::get_cublas_handle
cublasHandle_t get_cublas_handle()
Definition: carma_context.h:168
SutraGroot::d_tab_int_x
CarmaObj< float > * d_tab_int_x
Definition: sutra_groot.h:86
SutraGroot::h_weights
CarmaHostObj< float > * h_weights
Definition: sutra_groot.h:70
SutraGroot
this class provides the groot features to COMPASS
Definition: sutra_groot.h:51
SutraGroot::SutraGroot
SutraGroot(CarmaContext *context, int device, int nactus, int nlayers, float gsangle, float *vdt, float *Htheta, float *L0, float *winddir, float *scale, float *pzt2tt, float *TTPfilter, float *Nact, float *xpos, float *ypos, float fc)
compute_Cerr_layer
int compute_Cerr_layer(T_data *Cerr, int N, T_data *tab_int_x, T_data *tab_int_y, T_data *xpos, T_data *ypos, T_data vdt, T_data Htheta, T_data L0, T_data fc, T_data winddir, T_data gsangle, T_data scale, int Ntab, CarmaDevice *device)
CarmaHostObj< float >
SutraGroot::d_CaXX
CarmaObj< float > * d_CaXX
Definition: sutra_groot.h:75
add_transpose
int add_transpose(T_data *Cerr, int N, CarmaDevice *device)
SutraGroot::scale
float scale
Definition: sutra_groot.h:62
SutraGroot::d_TTPfilter
CarmaObj< float > * d_TTPfilter
Definition: sutra_groot.h:79
SutraGroot::d_Nact
CarmaObj< float > * d_Nact
Definition: sutra_groot.h:81
SutraGroot::nssp
int nssp
Definition: sutra_groot.h:57
carma_sparse_obj.h
SutraGroot::npts
int npts
Definition: sutra_groot.h:59
tab_u831J0
int tab_u831J0(T_data *tab_int_x, T_data *tab_int_y, int N, CarmaDevice *device)
SutraGroot::d_CaYY
CarmaObj< float > * d_CaYY
Definition: sutra_groot.h:76
SutraGroot::fc
float fc
Definition: sutra_groot.h:61
SutraGroot::h_scale
CarmaHostObj< float > * h_scale
Definition: sutra_groot.h:69
carma_host_obj.h