Highly Efficient FFT for Exascale: HeFFTe v2.3
heffte_magma_helpers.h
1 /*
2  -- heFFTe --
3  Univ. of Tennessee, Knoxville
4  @date
5 */
6 
7 #ifndef HEFFTE_MAGMA_HELPERS_H
8 #define HEFFTE_MAGMA_HELPERS_H
9 
10 #include "heffte_pack3d.h"
11 
20 namespace heffte{
21 
22 namespace gpu {
30  template<typename> struct magma_handle{
32  magma_handle(void*){}
34  template<typename scalar_type> void scal(int, double, scalar_type*) const{}
35  };
42  template<>
43  struct magma_handle<tag::gpu>{
45  magma_handle(void* gpu_stream);
49  void scal(int num_entries, double scale_factor, float *data) const;
51  void scal(int num_entries, double scale_factor, double *data) const;
53  template<typename precision_type>
54  void scal(int num_entries, double scale_factor, std::complex<precision_type> *data) const{
55  scal(2*num_entries, scale_factor, reinterpret_cast<precision_type*>(data));
56  }
58  mutable void *handle;
59  };
60 }
61 
62 }
63 
64 #endif /* HEFFTE_MAGMA_HELPERS_H */
Namespace containing all HeFFTe methods and classes.
Definition: heffte_backend_cuda.h:38
magma_handle(void *gpu_stream)
Constructor, calls magma_init() and creates a new queue on the given stream.
void scal(int num_entries, double scale_factor, std::complex< precision_type > *data) const
Template for the complex case, uses reinterpret_cast().
Definition: heffte_magma_helpers.h:54
void scal(int num_entries, double scale_factor, float *data) const
Wrapper around magma_sscal()
~magma_handle()
Destructor, cleans the queue and calls magma_finalize().
void scal(int num_entries, double scale_factor, double *data) const
Wrapper around magma_dscal()
void * handle
Opaque pointer to a magma_queue.
Definition: heffte_magma_helpers.h:58
Wrapper around a MAGMA handle.
Definition: heffte_magma_helpers.h:30
void scal(int, double, scalar_type *) const
Wrapper around MAGMA sscal()/dscal(), but no-op in a CPU context.
Definition: heffte_magma_helpers.h:34
magma_handle(void *)
No-op constructor, see the GPU specialization.
Definition: heffte_magma_helpers.h:32