The VisAO Camera
gpurecon.h
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "cublas_v2.h"
4 
5 #ifdef __cplusplus
6 extern "C"
7 {
8 #endif
9 
10 ///Initialize the GPU reconstructor.
11 /** Sets the globals n_modes and n_slopes, and allocates rec_gpu, slopes_gpu, and amps_gpu.
12  * \param nm sets n_modes
13  * \param ns sets n_slopes
14  * \param rec_host is the reconstructor matrix, in row major format. Converted to column major for passing to GPU.
15  * \retval EXIT_FAILURE if an error occurs.
16  * \retval EXIT_SUCCESS if it applies.
17  */
18 int init_gpurecon(int nm, int ns, float *rec_host);
19 
20 ///Free GPU memory and shutdown the cublas library.
21 /** \retval 0 always
22  */
23 int free_gpurecon();
24 
25 ///Performs the matrix-vector multiply on the GPU.
26 /**Uses the Cuda BLAS routine sgemv (see the blas standard for description).
27  * \param slopes_host pointer to the slopes vector of length n_slopes (as set in init_gpurecon)
28  * \param amps_host pointer to the amplitudes vector of length n_modes (as set in init_gpurecon)
29  * \retval EXIT_FAILURE if something goes wrong
30  * \retval EXIT_SUCCESS if everything works.
31  */
32 int gpurecon(float *slopes_host, float *amps_host);
33 
34 #ifdef __cplusplus
35 }//extern "C"
36 #endif