COMPASS  5.0.0
End-to-end AO simulation tool using GPU acceleration
sutra_gamora.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_GAMORA_H_
43 #define _SUTRA_GAMORA_H_
44 
45 #include <carma.h>
46 #include <carma_host_obj.h>
47 #include <carma_obj.h>
48 #include <carma_sparse_obj.h>
49 #include <map>
50 #include <vector>
51 
52 class SutraGamora {
53  public:
55  int device;
56 
57  int nactus; // number of actuators
58  int niter; // number of iterations
59  int nmodes; // number of modes
60  // PSF reconstruction from roket data
68  float scale;
69  int size;
70  int Npts;
71  // PSF reconstruction with Vii functions
84 
85  public:
86  SutraGamora(CarmaContext *context, int device, char *type, int nactus,
87  int nmodes, int niter, float *IFvalue, int *IFrowind,
88  int *IFcolind, int IFnz, float *d_TT, float *pupil, int size,
89  int Npts, float scale, float *Btt, float *covmodes);
91 
92  int psf_rec_roket(float *err);
93  int psf_rec_Vii();
94 
96 
97  private:
98  std::vector<CarmaObj<cuFloatComplex> *> d_amplipup_ngpu;
99  std::vector<CarmaObj<cuFloatComplex> *> d_newmodek_ngpu;
100  std::vector<CarmaObj<float> *> d_Btt_ngpu;
101  std::vector<CarmaObj<float> *> d_covmodes_ngpu;
102  std::vector<CarmaObj<float> *> d_term1_ngpu;
103  std::vector<CarmaObj<float> *> d_term2_ngpu;
104  std::vector<CarmaSparseObj<float> *> d_IF_ngpu;
105  std::vector<CarmaObj<float> *> d_TT_ngpu;
106  std::vector<CarmaObj<float> *> d_phase_ngpu;
107  std::vector<CarmaObj<int> *> d_wherephase_ngpu;
108  std::vector<CarmaObj<cuFloatComplex> *> d_pupfft_ngpu;
109  std::vector<CarmaObj<cuFloatComplex> *> d_Dphi_ngpu;
110 };
111 
112 int fill_amplipup(cuFloatComplex *amplipup, float *phase, int *wherephase,
113  float scale, int Npts, int nx, int Nx, int puponly,
114  CarmaDevice *device);
115 int cumulpsf(float *d_odata, cuFloatComplex *d_idata, int N,
116  CarmaDevice *device);
117 int abs2complex(cuFloatComplex *d_odata, cuFloatComplex *d_idata, int N,
118  CarmaDevice *device);
119 int real(float *d_odata, cuFloatComplex *d_idata, int N, CarmaDevice *device);
120 int fill_mask(float *d_odata, float *d_idata, int N, int norm,
121  CarmaDevice *device);
122 int modulus2(float *d_odata, cuFloatComplex *d_idata, int N,
123  CarmaDevice *device);
124 int pow2(cuFloatComplex *d_odata, cuFloatComplex *d_idata, int N,
125  CarmaDevice *device);
126 int fill_term1(float *d_odata, cuFloatComplex *d_idata,
127  cuFloatComplex *d_pupfft, int N, CarmaDevice *device);
128 int add2Dphi(cuFloatComplex *d_odata, float *d_term1, float *d_term2, float e,
129  int N, CarmaDevice *device);
130 int computeOTFvii(float *d_otfVii, cuFloatComplex *d_Dphi, float *d_otftel,
131  float *d_mask, float scale, int N, CarmaDevice *device);
132 int ifftscale(cuFloatComplex *d_odata, float scale, int N,
133  CarmaDevice *device);
134 
135 #endif
pow2
int pow2(cuFloatComplex *d_odata, cuFloatComplex *d_idata, int N, CarmaDevice *device)
SutraGamora::psf_rec_Vii
int psf_rec_Vii()
CarmaDevice
Definition: carma_context.h:57
SutraGamora::d_IF
CarmaSparseObj< float > * d_IF
Definition: sutra_gamora.h:66
SutraGamora::d_Btt
CarmaObj< float > * d_Btt
Definition: sutra_gamora.h:78
add2Dphi
int add2Dphi(cuFloatComplex *d_odata, float *d_term1, float *d_term2, float e, int N, CarmaDevice *device)
abs2complex
int abs2complex(cuFloatComplex *d_odata, cuFloatComplex *d_idata, int N, CarmaDevice *device)
SutraGamora::niter
int niter
Definition: sutra_gamora.h:58
SutraGamora
this class provides the gamora features to COMPASS
Definition: sutra_gamora.h:52
SutraGamora::d_covmodes
CarmaObj< float > * d_covmodes
Definition: sutra_gamora.h:79
SutraGamora::d_psf
CarmaObj< float > * d_psf
Definition: sutra_gamora.h:63
SutraGamora::d_amplipup
CarmaObj< cuFloatComplex > * d_amplipup
Definition: sutra_gamora.h:62
SutraGamora::compute_Dphi_on_mode_k
void compute_Dphi_on_mode_k(int k)
SutraGamora::SutraGamora
SutraGamora(CarmaContext *context, int device, char *type, int nactus, int nmodes, int niter, float *IFvalue, int *IFrowind, int *IFcolind, int IFnz, float *d_TT, float *pupil, int size, int Npts, float scale, float *Btt, float *covmodes)
SutraGamora::d_term2
CarmaObj< float > * d_term2
Definition: sutra_gamora.h:73
SutraGamora::d_wherephase
CarmaObj< int > * d_wherephase
Definition: sutra_gamora.h:65
SutraGamora::nmodes
int nmodes
Definition: sutra_gamora.h:59
cumulpsf
int cumulpsf(float *d_odata, cuFloatComplex *d_idata, int N, CarmaDevice *device)
real
int real(float *d_odata, cuFloatComplex *d_idata, int N, CarmaDevice *device)
SutraGamora::psf_rec_roket
int psf_rec_roket(float *err)
fill_mask
int fill_mask(float *d_odata, float *d_idata, int N, int norm, CarmaDevice *device)
SutraGamora::current_context
CarmaContext * current_context
Definition: sutra_gamora.h:54
fill_term1
int fill_term1(float *d_odata, cuFloatComplex *d_idata, cuFloatComplex *d_pupfft, int N, CarmaDevice *device)
SutraGamora::d_err
CarmaObj< float > * d_err
Definition: sutra_gamora.h:61
SutraGamora::d_newmodek
CarmaObj< cuFloatComplex > * d_newmodek
Definition: sutra_gamora.h:81
SutraGamora::d_pupfft
CarmaObj< cuFloatComplex > * d_pupfft
Definition: sutra_gamora.h:83
CarmaObj< float >
carma_obj.h
CarmaContext
this class provides the context in which CarmaObj are created
Definition: carma_context.h:104
ifftscale
int ifftscale(cuFloatComplex *d_odata, float scale, int N, CarmaDevice *device)
CarmaSparseObj< float >
SutraGamora::d_otftel
CarmaObj< float > * d_otftel
Definition: sutra_gamora.h:74
SutraGamora::~SutraGamora
~SutraGamora()
SutraGamora::d_term1
CarmaObj< float > * d_term1
Definition: sutra_gamora.h:72
fill_amplipup
int fill_amplipup(cuFloatComplex *amplipup, float *phase, int *wherephase, float scale, int Npts, int nx, int Nx, int puponly, CarmaDevice *device)
SutraGamora::device
int device
Definition: sutra_gamora.h:55
SutraGamora::d_eigenvals
CarmaObj< float > * d_eigenvals
Definition: sutra_gamora.h:77
CarmaHostObj< float >
SutraGamora::size
int size
Definition: sutra_gamora.h:69
SutraGamora::h_eigenvals
CarmaHostObj< float > * h_eigenvals
Definition: sutra_gamora.h:80
SutraGamora::d_TT
CarmaObj< float > * d_TT
Definition: sutra_gamora.h:67
computeOTFvii
int computeOTFvii(float *d_otfVii, cuFloatComplex *d_Dphi, float *d_otftel, float *d_mask, float scale, int N, CarmaDevice *device)
SutraGamora::Npts
int Npts
Definition: sutra_gamora.h:70
SutraGamora::d_Dphi
CarmaObj< cuFloatComplex > * d_Dphi
Definition: sutra_gamora.h:82
SutraGamora::scale
float scale
Definition: sutra_gamora.h:68
carma_sparse_obj.h
SutraGamora::d_mask
CarmaObj< float > * d_mask
Definition: sutra_gamora.h:76
SutraGamora::nactus
int nactus
Definition: sutra_gamora.h:57
SutraGamora::d_otfVii
CarmaObj< float > * d_otfVii
Definition: sutra_gamora.h:75
SutraGamora::d_phase
CarmaObj< float > * d_phase
Definition: sutra_gamora.h:64
modulus2
int modulus2(float *d_odata, cuFloatComplex *d_idata, int N, CarmaDevice *device)
carma_host_obj.h