COMPASS  5.0.0
End-to-end AO simulation tool using GPU acceleration
sutra_lgs.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_LGS_H_
43 #define _SUTRA_LGS_H_
44 
45 #include <carma.h>
46 #include <carma_obj.h>
47 #include <sutra_utils.h>
48 
49 using std::map;
50 using std::pair;
51 using std::vector;
52 
53 class SutraLGS {
54  public:
55  int device;
56  long nvalid;
57  long npix;
58  long nmaxhr;
59  float hg;
60  float h0;
61  float deltah;
62  float pixsize;
63  long nprof;
64 
65  cufftHandle *ftlgskern_plan;
75 
77  /*
78  cudaArray *d_spotarray;
79  cudaChannelFormatDesc channel_desc;
80  cudaMemcpy3DParms copyParams;
81  */
82 
83  public:
86  map<vector<int>, cufftHandle *> ftlgskern_plans, long nvalid,
87  long npix, long nmaxhr);
89 
90  int lgs_init(int nprof, float hg, float h0, float deltah, float pixsie,
91  float *doffaxis, float *prof1d, float *profcum, float *beam,
92  cuFloatComplex *ftbeam, float *azimuth);
93  int load_prof(float *prof1d, float *profcum, float hg, float h0,
94  float deltah);
97  int load_kernels(float *h_lgskern, CarmaDevice *device);
98 };
99 
100 // General utilities
101 int interp_prof(cuFloatComplex *profout, float *prof1d, float *profcum,
102  int npix, float *doffaxis, float hg, float pixsize, float h0,
103  float deltah, int hmax, int Ntot, CarmaDevice *device);
104 int times_ftbeam(cuFloatComplex *profout, cuFloatComplex *fbeam, int N,
105  int Ntot, CarmaDevice *device);
106 int roll_beam_exp(float *imout, cuFloatComplex *iprof, float *beam, int N,
107  int Ntot, CarmaDevice *device);
108 int lgs_rotate(cuFloatComplex *odata, float *idata, int width, int height,
109  float *theta, float center, int Ntot, CarmaDevice *device);
110 int rotate3d(cuFloatComplex *d_odata, cudaMemcpy3DParms copyParams,
111  cudaArray *d_array, cudaChannelFormatDesc channel_desc, int width,
112  int height, float *theta, float center, int Ntot,
113  CarmaDevice *device);
114 
115 #endif // _SUTRA_LGS_H_
SutraLGS::d_beam
CarmaObj< float > * d_beam
Definition: sutra_lgs.h:71
SutraLGS
this class provides the lgs features to COMPASS
Definition: sutra_lgs.h:53
SutraLGS::d_doffaxis
CarmaObj< float > * d_doffaxis
Definition: sutra_lgs.h:66
CarmaDevice
Definition: carma_context.h:57
SutraLGS::npix
long npix
Definition: sutra_lgs.h:57
roll_beam_exp
int roll_beam_exp(float *imout, cuFloatComplex *iprof, float *beam, int N, int Ntot, CarmaDevice *device)
SutraLGS::d_lgskern
CarmaObj< float > * d_lgskern
Definition: sutra_lgs.h:73
SutraLGS::deltah
float deltah
Definition: sutra_lgs.h:61
SutraLGS::h0
float h0
Definition: sutra_lgs.h:60
SutraLGS::d_profcum
CarmaObj< float > * d_profcum
Definition: sutra_lgs.h:69
SutraLGS::load_prof
int load_prof(float *prof1d, float *profcum, float hg, float h0, float deltah)
SutraLGS::lgs_makespot
int lgs_makespot(CarmaDevice *device, int nin)
SutraLGS::d_azimuth
CarmaObj< float > * d_azimuth
Definition: sutra_lgs.h:67
SutraLGS::hg
float hg
Definition: sutra_lgs.h:59
SutraLGS::d_ftlgskern
CarmaObj< cuFloatComplex > * d_ftlgskern
Definition: sutra_lgs.h:74
rotate3d
int rotate3d(cuFloatComplex *d_odata, cudaMemcpy3DParms copyParams, cudaArray *d_array, cudaChannelFormatDesc channel_desc, int width, int height, float *theta, float center, int Ntot, CarmaDevice *device)
SutraLGS::pixsize
float pixsize
Definition: sutra_lgs.h:62
SutraLGS::lgs_init
int lgs_init(int nprof, float hg, float h0, float deltah, float pixsie, float *doffaxis, float *prof1d, float *profcum, float *beam, cuFloatComplex *ftbeam, float *azimuth)
SutraLGS::nvalid
long nvalid
Definition: sutra_lgs.h:56
SutraLGS::lgs_update
int lgs_update(CarmaDevice *device)
SutraLGS::ftlgskern_plan
cufftHandle * ftlgskern_plan
Definition: sutra_lgs.h:65
CarmaObj< float >
carma_obj.h
CarmaContext
this class provides the context in which CarmaObj are created
Definition: carma_context.h:104
SutraLGS::nprof
long nprof
Definition: sutra_lgs.h:63
sutra_utils.h
SutraLGS::d_prof2d
CarmaObj< cuFloatComplex > * d_prof2d
Definition: sutra_lgs.h:70
SutraLGS::~SutraLGS
~SutraLGS()
SutraLGS::device
int device
Definition: sutra_lgs.h:55
SutraLGS::SutraLGS
SutraLGS(CarmaContext *context, CarmaObj< float > *d_lgskern, CarmaObj< cuFloatComplex > *d_ftlgskern, map< vector< int >, cufftHandle * > ftlgskern_plans, long nvalid, long npix, long nmaxhr)
SutraLGS::d_ftbeam
CarmaObj< cuFloatComplex > * d_ftbeam
Definition: sutra_lgs.h:72
lgs_rotate
int lgs_rotate(cuFloatComplex *odata, float *idata, int width, int height, float *theta, float center, int Ntot, CarmaDevice *device)
SutraLGS::nmaxhr
long nmaxhr
Definition: sutra_lgs.h:58
SutraLGS::d_prof1d
CarmaObj< float > * d_prof1d
Definition: sutra_lgs.h:68
times_ftbeam
int times_ftbeam(cuFloatComplex *profout, cuFloatComplex *fbeam, int N, int Ntot, CarmaDevice *device)
SutraLGS::load_kernels
int load_kernels(float *h_lgskern, CarmaDevice *device)
SutraLGS::current_context
CarmaContext * current_context
Definition: sutra_lgs.h:76
interp_prof
int interp_prof(cuFloatComplex *profout, float *prof1d, float *profcum, int npix, float *doffaxis, float hg, float pixsize, float h0, float deltah, int hmax, int Ntot, CarmaDevice *device)