COMPASS  5.4.4
End-to-end AO simulation tool using GPU acceleration
sutra_controller_generic.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_CONTROLLER_GENERIC_H_
18 #define _SUTRA_CONTROLLER_GENERIC_H_
19 
20 #include <sutra_acquisim.h>
21 #include <sutra_controller.h>
22 
23 template <typename Tcomp, typename Tout>
24 class sutra_controller_generic : public SutraController<Tcomp, Tout> {
25  public:
31  CarmaObj<Tcomp> *d_compbuff; // Buffer for computations
33  CarmaObj<Tcomp> *d_olmeas; // Open-loop measurements for POLC
35  std::vector<CarmaObj<Tcomp> *> d_err_ngpu;
36  std::vector<CarmaObj<Tcomp> *> d_centroids_ngpu;
37  std::vector<CarmaObj<Tcomp> *> d_cmat_ngpu;
38  std::vector<int> P2Pdevices;
39  std::vector<cudaEvent_t> events;
40  cudaEvent_t start_mvm_event;
41  std::vector<cudaStream_t> streams;
42  bool polc;
43  int nstates;
44  Tcomp leaky_factor;
45  string command_law;
46 
47  public:
49  long nactu, float delay, SutraDms *dms,
50  int *idx_dms, int ndm, int *idx_centro, int ncentro, int nstates);
53 
54  string get_type();
55  string get_commandlaw();
56  int set_decayFactor(float *decayFactor);
57  int set_modal_gains(float *gain);
58  int set_cmat(float *cmat);
59  int set_matE(float *matE);
60  int set_commandlaw(string law);
61  int set_polc(bool p);
62  int set_imat(float *imat);
63  int set_leaky_factor(Tcomp factor);
65  int comp_polc();
66  int comp_com();
69 
70  private:
71  template <typename Q = Tcomp>
72  typename std::enable_if<!std::is_same<Q, half>::value, int>::type
73  fill_cmatPadded_impl() {
74  return EXIT_SUCCESS;
75  };
76  template <typename Q = Tcomp>
77  typename std::enable_if<std::is_same<Q, half>::value, int>::type
78  fill_cmatPadded_impl();
79 };
80 
81 template <typename T>
82 void pad_cmat(T *idata, int m, int n, T *odata, int m2, int n2,
83  CarmaDevice *device);
84 #endif // _SUTRA_CONTROLLER_GENERIC_H_
this class provides the context in which CarmaObj are created
Definition: carma_context.h:79
this class provides the controller features to COMPASS
this class provides the controller_generic features to COMPASS
std::vector< CarmaObj< Tcomp > * > d_cmat_ngpu
int set_leaky_factor(Tcomp factor)
std::vector< cudaStream_t > streams
sutra_controller_generic(CarmaContext *context, long nslope, long nactu, float delay, SutraDms *dms, int *idx_dms, int ndm, int *idx_centro, int ncentro, int nstates)
int comp_com()
!!! YOU MUST set d_centroids before calling it!!!!
std::vector< CarmaObj< Tcomp > * > d_centroids_ngpu
sutra_controller_generic(const sutra_controller_generic &controller)
int set_modal_gains(float *gain)
int set_cmat(float *cmat)
std::vector< cudaEvent_t > events
int set_decayFactor(float *decayFactor)
int set_commandlaw(string law)
int set_imat(float *imat)
std::vector< CarmaObj< Tcomp > * > d_err_ngpu
int set_matE(float *matE)
void pad_cmat(T *idata, int m, int n, T *odata, int m2, int n2, CarmaDevice *device)