@@ -85,6 +85,16 @@ void set_memory_op<FPTYPE, base_device::DEVICE_GPU>::operator()(FPTYPE* arr,
8585 cudaErrcheck (cudaMemset (arr, var, sizeof (FPTYPE ) * size));
8686}
8787
88+ template <typename FPTYPE >
89+ void set_memory_2d_op<FPTYPE , base_device::DEVICE_GPU >::operator ()(FPTYPE * arr,
90+ const size_t pitch,
91+ const int var,
92+ const size_t width,
93+ const size_t height)
94+ {
95+ cudaErrcheck (cudaMemset2D (arr, sizeof (FPTYPE ) * pitch , var, sizeof (FPTYPE ) * width, height));
96+ }
97+
8898template <typename FPTYPE >
8999void synchronize_memory_op<FPTYPE , base_device::DEVICE_CPU , base_device::DEVICE_GPU >::operator ()(
90100 FPTYPE * arr_out,
@@ -112,6 +122,42 @@ void synchronize_memory_op<FPTYPE, base_device::DEVICE_GPU, base_device::DEVICE_
112122 cudaErrcheck (cudaMemcpy (arr_out, arr_in, sizeof (FPTYPE ) * size, cudaMemcpyDeviceToDevice));
113123}
114124
125+ template <typename FPTYPE >
126+ void synchronize_memory_2d_op<FPTYPE , base_device::DEVICE_CPU , base_device::DEVICE_GPU >::operator ()(
127+ FPTYPE * arr_out,
128+ const size_t dpitch,
129+ const FPTYPE * arr_in,
130+ const size_t spitch,
131+ const size_t width,
132+ const size_t height)
133+ {
134+ cudaErrcheck (cudaMemcpy2D (arr_out, dpitch * sizeof (FPTYPE ), arr_in, spitch * sizeof (FPTYPE ), width * sizeof (FPTYPE ), height, cudaMemcpyDeviceToHost));
135+ }
136+
137+ template <typename FPTYPE >
138+ void synchronize_memory_2d_op<FPTYPE , base_device::DEVICE_GPU , base_device::DEVICE_CPU >::operator ()(
139+ FPTYPE * arr_out,
140+ const size_t dpitch,
141+ const FPTYPE * arr_in,
142+ const size_t spitch,
143+ const size_t width,
144+ const size_t height)
145+ {
146+ cudaErrcheck (cudaMemcpy2D (arr_out, dpitch * sizeof (FPTYPE ), arr_in, spitch * sizeof (FPTYPE ), width * sizeof (FPTYPE ), height, cudaMemcpyHostToDevice));
147+ }
148+
149+ template <typename FPTYPE >
150+ void synchronize_memory_2d_op<FPTYPE , base_device::DEVICE_GPU , base_device::DEVICE_GPU >::operator ()(
151+ FPTYPE * arr_out,
152+ const size_t dpitch,
153+ const FPTYPE * arr_in,
154+ const size_t spitch,
155+ const size_t width,
156+ const size_t height)
157+ {
158+ cudaErrcheck (cudaMemcpy2D (arr_out, dpitch * sizeof (FPTYPE ), arr_in, spitch * sizeof (FPTYPE ), width * sizeof (FPTYPE ), height, cudaMemcpyDeviceToDevice));
159+ }
160+
115161template <typename FPTYPE_out, typename FPTYPE_in>
116162struct cast_memory_op <FPTYPE_out, FPTYPE_in, base_device::DEVICE_GPU , base_device::DEVICE_GPU >
117163{
@@ -196,6 +242,12 @@ template struct set_memory_op<double, base_device::DEVICE_GPU>;
196242template struct set_memory_op <std::complex <float >, base_device::DEVICE_GPU >;
197243template struct set_memory_op <std::complex <double >, base_device::DEVICE_GPU >;
198244
245+ template struct set_memory_2d_op <int , base_device::DEVICE_GPU >;
246+ template struct set_memory_2d_op <float , base_device::DEVICE_GPU >;
247+ template struct set_memory_2d_op <double , base_device::DEVICE_GPU >;
248+ template struct set_memory_2d_op <std::complex <float >, base_device::DEVICE_GPU >;
249+ template struct set_memory_2d_op <std::complex <double >, base_device::DEVICE_GPU >;
250+
199251template struct synchronize_memory_op <int , base_device::DEVICE_CPU , base_device::DEVICE_GPU >;
200252template struct synchronize_memory_op <int , base_device::DEVICE_GPU , base_device::DEVICE_CPU >;
201253template struct synchronize_memory_op <int , base_device::DEVICE_GPU , base_device::DEVICE_GPU >;
@@ -212,6 +264,22 @@ template struct synchronize_memory_op<std::complex<double>, base_device::DEVICE_
212264template struct synchronize_memory_op <std::complex <double >, base_device::DEVICE_GPU , base_device::DEVICE_CPU >;
213265template struct synchronize_memory_op <std::complex <double >, base_device::DEVICE_GPU , base_device::DEVICE_GPU >;
214266
267+ template struct synchronize_memory_2d_op <int , base_device::DEVICE_CPU , base_device::DEVICE_GPU >;
268+ template struct synchronize_memory_2d_op <int , base_device::DEVICE_GPU , base_device::DEVICE_CPU >;
269+ template struct synchronize_memory_2d_op <int , base_device::DEVICE_GPU , base_device::DEVICE_GPU >;
270+ template struct synchronize_memory_2d_op <float , base_device::DEVICE_CPU , base_device::DEVICE_GPU >;
271+ template struct synchronize_memory_2d_op <float , base_device::DEVICE_GPU , base_device::DEVICE_CPU >;
272+ template struct synchronize_memory_2d_op <float , base_device::DEVICE_GPU , base_device::DEVICE_GPU >;
273+ template struct synchronize_memory_2d_op <double , base_device::DEVICE_CPU , base_device::DEVICE_GPU >;
274+ template struct synchronize_memory_2d_op <double , base_device::DEVICE_GPU , base_device::DEVICE_CPU >;
275+ template struct synchronize_memory_2d_op <double , base_device::DEVICE_GPU , base_device::DEVICE_GPU >;
276+ template struct synchronize_memory_2d_op <std::complex <float >, base_device::DEVICE_CPU , base_device::DEVICE_GPU >;
277+ template struct synchronize_memory_2d_op <std::complex <float >, base_device::DEVICE_GPU , base_device::DEVICE_CPU >;
278+ template struct synchronize_memory_2d_op <std::complex <float >, base_device::DEVICE_GPU , base_device::DEVICE_GPU >;
279+ template struct synchronize_memory_2d_op <std::complex <double >, base_device::DEVICE_CPU , base_device::DEVICE_GPU >;
280+ template struct synchronize_memory_2d_op <std::complex <double >, base_device::DEVICE_GPU , base_device::DEVICE_CPU >;
281+ template struct synchronize_memory_2d_op <std::complex <double >, base_device::DEVICE_GPU , base_device::DEVICE_GPU >;
282+
215283template struct cast_memory_op <float , float , base_device::DEVICE_GPU , base_device::DEVICE_GPU >;
216284template struct cast_memory_op <double , double , base_device::DEVICE_GPU , base_device::DEVICE_GPU >;
217285template struct cast_memory_op <float , double , base_device::DEVICE_GPU , base_device::DEVICE_GPU >;
0 commit comments