Xmipp  v3.23.11-Nereus
cuda_gpu_geo_shift_transformer.h
Go to the documentation of this file.
1 /***************************************************************************
2  *
3  * Authors: David Strelak (davidstrelak@gmail.com)
4  *
5  * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20  * 02111-1307 USA
21  *
22  * All comments concerning this program package may be sent to the
23  * e-mail address 'xmipp@cnb.csic.es'
24  ***************************************************************************/
25 
37 #ifndef CUDA_GEO_SHIFT_TRANSFORMER
38 #define CUDA_GEO_SHIFT_TRANSFORMER
39 
40 #include <assert.h>
41 #include <exception>
42 #include "core/multidim_array.h"
44 #include "cuda_xmipp_utils.h"
45 #include "gpu.h"
46 
50 template<typename T>
52 
53 public:
56  device(-1), imgs(NULL), ffts(NULL), stream(NULL), isReady(false) {
57  };
58 
60  release();
61  }
62 
74  void init(const GPU &gpu, size_t x, size_t y, size_t n, int device, myStreamHandle *stream);
75 
83  void initLazy(const GPU &gpu, size_t x, size_t y, size_t n, int device,
84  myStreamHandle *stream = NULL);
85 
89  void release();
90 
98  template<typename T_IN>
99  void applyShift(MultidimArray<T> &output, const MultidimArray<T_IN> &input,
100  T shiftX, T shiftY);
101 
102  void test();
103 
104 private:
110  template<typename T_IN>
111  void checkRestrictions(MultidimArray<T> &output,
112  const MultidimArray<T_IN> &input);
113 
114 private:
115  bool isReady;
116 
117  int device;
118  myStreamHandle* stream;
119 
120  const GPU *m_gpu;
121 
122  GpuMultidimArrayAtGpu<T> *imgs; // object for FFT
123  mycufftHandle fftHandle; // plan of the FFT
124  GpuMultidimArrayAtGpu<std::complex<T> > *ffts; // object for FFT
125  mycufftHandle ifftHandle; // plan of the FFT
126 };
128 #endif // CUDA_GEO_SHIFT_TRANSFORMER
void applyShift(MultidimArray< T > &output, const MultidimArray< T_IN > &input, T shiftX, T shiftY)
static double * y
doublereal * x
void init(const GPU &gpu, size_t x, size_t y, size_t n, int device, myStreamHandle *stream)
Definition: gpu.h:36
int * n
void initLazy(const GPU &gpu, size_t x, size_t y, size_t n, int device, myStreamHandle *stream=NULL)