@@ -55,6 +55,18 @@ struct set_memory_op<FPTYPE, base_device::DEVICE_CPU>
5555 }
5656};
5757
58+ template <typename FPTYPE>
59+ struct set_memory_2d_op <FPTYPE, base_device::DEVICE_CPU>
60+ {
61+ void operator ()(FPTYPE* arr, const size_t pitch, const int var, const size_t width, const size_t height)
62+ {
63+ for (size_t i = 0 ; i < height; i++){
64+ set_memory_op<FPTYPE, base_device::DEVICE_CPU>()(arr + i * pitch, var, width);
65+ }
66+ }
67+ };
68+
69+
5870template <typename FPTYPE>
5971struct synchronize_memory_op <FPTYPE, base_device::DEVICE_CPU, base_device::DEVICE_CPU>
6072{
@@ -70,6 +82,23 @@ struct synchronize_memory_op<FPTYPE, base_device::DEVICE_CPU, base_device::DEVIC
7082 }
7183};
7284
85+ template <typename FPTYPE>
86+ struct synchronize_memory_2d_op <FPTYPE, base_device::DEVICE_CPU, base_device::DEVICE_CPU>
87+ {
88+ void operator ()(FPTYPE* arr_out,
89+ const size_t dpitch,
90+ const FPTYPE* arr_in,
91+ const size_t spitch,
92+ const size_t width,
93+ const size_t height)
94+ {
95+ for (int i = 0 ; i < height; i++){
96+ synchronize_memory_op<FPTYPE, base_device::DEVICE_CPU, base_device::DEVICE_CPU>()(
97+ arr_out + i * dpitch, arr_in + i * spitch, width);
98+ }
99+ }
100+ };
101+
73102template <typename FPTYPE_out, typename FPTYPE_in>
74103struct cast_memory_op <FPTYPE_out, FPTYPE_in, base_device::DEVICE_CPU, base_device::DEVICE_CPU>
75104{
@@ -108,12 +137,24 @@ template struct set_memory_op<double, base_device::DEVICE_CPU>;
108137template struct set_memory_op <std::complex <float >, base_device::DEVICE_CPU>;
109138template struct set_memory_op <std::complex <double >, base_device::DEVICE_CPU>;
110139
140+ template struct set_memory_2d_op <int , base_device::DEVICE_CPU>;
141+ template struct set_memory_2d_op <float , base_device::DEVICE_CPU>;
142+ template struct set_memory_2d_op <double , base_device::DEVICE_CPU>;
143+ template struct set_memory_2d_op <std::complex <float >, base_device::DEVICE_CPU>;
144+ template struct set_memory_2d_op <std::complex <double >, base_device::DEVICE_CPU>;
145+
111146template struct synchronize_memory_op <int , base_device::DEVICE_CPU, base_device::DEVICE_CPU>;
112147template struct synchronize_memory_op <float , base_device::DEVICE_CPU, base_device::DEVICE_CPU>;
113148template struct synchronize_memory_op <double , base_device::DEVICE_CPU, base_device::DEVICE_CPU>;
114149template struct synchronize_memory_op <std::complex <float >, base_device::DEVICE_CPU, base_device::DEVICE_CPU>;
115150template struct synchronize_memory_op <std::complex <double >, base_device::DEVICE_CPU, base_device::DEVICE_CPU>;
116151
152+ template struct synchronize_memory_2d_op <int , base_device::DEVICE_CPU, base_device::DEVICE_CPU>;
153+ template struct synchronize_memory_2d_op <float , base_device::DEVICE_CPU, base_device::DEVICE_CPU>;
154+ template struct synchronize_memory_2d_op <double , base_device::DEVICE_CPU, base_device::DEVICE_CPU>;
155+ template struct synchronize_memory_2d_op <std::complex <float >, base_device::DEVICE_CPU, base_device::DEVICE_CPU>;
156+ template struct synchronize_memory_2d_op <std::complex <double >, base_device::DEVICE_CPU, base_device::DEVICE_CPU>;
157+
117158template struct cast_memory_op <float , float , base_device::DEVICE_CPU, base_device::DEVICE_CPU>;
118159template struct cast_memory_op <double , double , base_device::DEVICE_CPU, base_device::DEVICE_CPU>;
119160template struct cast_memory_op <float , double , base_device::DEVICE_CPU, base_device::DEVICE_CPU>;
@@ -167,6 +208,14 @@ struct set_memory_op<FPTYPE, base_device::DEVICE_GPU>
167208 }
168209};
169210
211+ template <typename FPTYPE>
212+ struct set_memory_2d_op <FPTYPE, base_device::DEVICE_GPU>
213+ {
214+ void operator ()(FPTYPE* arr, const size_t pitch, const int var, const size_t width, const size_t height)
215+ {
216+ }
217+ };
218+
170219template <typename FPTYPE>
171220struct synchronize_memory_op <FPTYPE, base_device::DEVICE_GPU, base_device::DEVICE_GPU>
172221{
@@ -197,6 +246,48 @@ struct synchronize_memory_op<FPTYPE, base_device::DEVICE_CPU, base_device::DEVIC
197246 }
198247};
199248
249+ template <typename FPTYPE>
250+ struct synchronize_memory_2d_op <FPTYPE, base_device::DEVICE_GPU, base_device::DEVICE_GPU>
251+ {
252+ void operator ()(const Device_in* dev_in,
253+ FPTYPE* arr_out,
254+ const size_t dpitch,
255+ const FPTYPE* arr_in,
256+ const size_t spitch,
257+ const size_t width,
258+ const size_t height)
259+ {
260+ }
261+ };
262+
263+ template <typename FPTYPE>
264+ struct synchronize_memory_2d_op <FPTYPE, base_device::DEVICE_GPU, base_device::DEVICE_CPU>
265+ {
266+ void operator ()(const Device_in* dev_in,
267+ FPTYPE* arr_out,
268+ const size_t dpitch,
269+ const FPTYPE* arr_in,
270+ const size_t spitch,
271+ const size_t width,
272+ const size_t height)
273+ {
274+ }
275+ };
276+
277+ template <typename FPTYPE>
278+ struct synchronize_memory_2d_op <FPTYPE, base_device::DEVICE_CPU, base_device::DEVICE_GPU>
279+ {
280+ void operator ()(const Device_in* dev_in,
281+ FPTYPE* arr_out,
282+ const size_t dpitch,
283+ const FPTYPE* arr_in,
284+ const size_t spitch,
285+ const size_t width,
286+ const size_t height)
287+ {
288+ }
289+ };
290+
200291template <typename FPTYPE_out, typename FPTYPE_in>
201292struct cast_memory_op <FPTYPE_out, FPTYPE_in, base_device::DEVICE_GPU, base_device::DEVICE_GPU>
202293{
@@ -247,6 +338,12 @@ template struct set_memory_op<double, base_device::DEVICE_GPU>;
247338template struct set_memory_op <std::complex <float >, base_device::DEVICE_GPU>;
248339template struct set_memory_op <std::complex <double >, base_device::DEVICE_GPU>;
249340
341+ template struct set_memory_2d_op <int , base_device::DEVICE_GPU>;
342+ template struct set_memory_2d_op <float , base_device::DEVICE_GPU>;
343+ template struct set_memory_2d_op <double , base_device::DEVICE_GPU>;
344+ template struct set_memory_2d_op <std::complex <float >, base_device::DEVICE_GPU>;
345+ template struct set_memory_2d_op <std::complex <double >, base_device::DEVICE_GPU>;
346+
250347template struct synchronize_memory_op <int , base_device::DEVICE_CPU, base_device::DEVICE_GPU>;
251348template struct synchronize_memory_op <int , base_device::DEVICE_GPU, base_device::DEVICE_CPU>;
252349template struct synchronize_memory_op <int , base_device::DEVICE_GPU, base_device::DEVICE_GPU>;
@@ -263,6 +360,22 @@ template struct synchronize_memory_op<std::complex<double>, base_device::DEVICE_
263360template struct synchronize_memory_op <std::complex <double >, base_device::DEVICE_GPU, base_device::DEVICE_CPU>;
264361template struct synchronize_memory_op <std::complex <double >, base_device::DEVICE_GPU, base_device::DEVICE_GPU>;
265362
363+ template struct synchronize_memory_2d_op <int , base_device::DEVICE_CPU, base_device::DEVICE_GPU>;
364+ template struct synchronize_memory_2d_op <int , base_device::DEVICE_GPU, base_device::DEVICE_CPU>;
365+ template struct synchronize_memory_2d_op <int , base_device::DEVICE_GPU, base_device::DEVICE_GPU>;
366+ template struct synchronize_memory_2d_op <float , base_device::DEVICE_CPU, base_device::DEVICE_GPU>;
367+ template struct synchronize_memory_2d_op <float , base_device::DEVICE_GPU, base_device::DEVICE_CPU>;
368+ template struct synchronize_memory_2d_op <float , base_device::DEVICE_GPU, base_device::DEVICE_GPU>;
369+ template struct synchronize_memory_2d_op <double , base_device::DEVICE_CPU, base_device::DEVICE_GPU>;
370+ template struct synchronize_memory_2d_op <double , base_device::DEVICE_GPU, base_device::DEVICE_CPU>;
371+ template struct synchronize_memory_2d_op <double , base_device::DEVICE_GPU, base_device::DEVICE_GPU>;
372+ template struct synchronize_memory_2d_op <std::complex <float >, base_device::DEVICE_CPU, base_device::DEVICE_GPU>;
373+ template struct synchronize_memory_2d_op <std::complex <float >, base_device::DEVICE_GPU, base_device::DEVICE_CPU>;
374+ template struct synchronize_memory_2d_op <std::complex <float >, base_device::DEVICE_GPU, base_device::DEVICE_GPU>;
375+ template struct synchronize_memory_2d_op <std::complex <double >, base_device::DEVICE_CPU, base_device::DEVICE_GPU>;
376+ template struct synchronize_memory_2d_op <std::complex <double >, base_device::DEVICE_GPU, base_device::DEVICE_CPU>;
377+ template struct synchronize_memory_2d_op <std::complex <double >, base_device::DEVICE_GPU, base_device::DEVICE_GPU>;
378+
266379template struct cast_memory_op <float , float , base_device::DEVICE_GPU, base_device::DEVICE_GPU>;
267380template struct cast_memory_op <double , double , base_device::DEVICE_GPU, base_device::DEVICE_GPU>;
268381template struct cast_memory_op <float , double , base_device::DEVICE_GPU, base_device::DEVICE_GPU>;
0 commit comments