1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-11-18 12:29:31 +00:00

Compare commits

..

3 Commits

Author SHA1 Message Date
23581333e6 link cufft 2025-08-21 22:25:55 +01:00
e5fa3d887f Compile on CUDA 2025-08-21 22:10:27 +01:00
583fa7bb0a FFTW guarded after CUDA adn HIP 2025-08-21 22:00:12 +01:00
3 changed files with 8 additions and 4 deletions

View File

@@ -36,6 +36,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
#include <hipfft/hipfft.h> #include <hipfft/hipfft.h>
#endif #endif
#if !defined(GRID_CUDA) && !defined(GRID_HIP)
#ifdef HAVE_FFTW #ifdef HAVE_FFTW
#if defined(USE_MKL) || defined(GRID_SYCL) #if defined(USE_MKL) || defined(GRID_SYCL)
#include <fftw/fftw3.h> #include <fftw/fftw3.h>
@@ -43,6 +44,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
#include <fftw3.h> #include <fftw3.h>
#endif #endif
#endif #endif
#endif
NAMESPACE_BEGIN(Grid); NAMESPACE_BEGIN(Grid);
@@ -138,7 +140,7 @@ public:
inline static void fftw_execute_dft(const FFTW_plan p,FFTW_scalar *in,FFTW_scalar *out, int sign) { inline static void fftw_execute_dft(const FFTW_plan p,FFTW_scalar *in,FFTW_scalar *out, int sign) {
if ( sign == forward ) cufftExecZ2Z(p,in,out,CUFFT_FORWARD); if ( sign == forward ) cufftExecZ2Z(p,in,out,CUFFT_FORWARD);
else cufftExecZ2Z(p,in,out,CUFFT_BACKWARD); else cufftExecZ2Z(p,in,out,CUFFT_INVERSE);
accelerator_barrier(); accelerator_barrier();
} }
inline static void fftw_destroy_plan(const FFTW_plan p) { inline static void fftw_destroy_plan(const FFTW_plan p) {
@@ -165,7 +167,7 @@ public:
inline static void fftw_execute_dft(const FFTW_plan p,FFTW_scalar *in,FFTW_scalar *out, int sign) { inline static void fftw_execute_dft(const FFTW_plan p,FFTW_scalar *in,FFTW_scalar *out, int sign) {
if ( sign == forward ) cufftExecC2C(p,in,out,CUFFT_FORWARD); if ( sign == forward ) cufftExecC2C(p,in,out,CUFFT_FORWARD);
else cufftExecC2C(p,in,out,CUFFT_BACKWARD); else cufftExecC2C(p,in,out,CUFFT_INVERSE);
accelerator_barrier(); accelerator_barrier();
} }
inline static void fftw_destroy_plan(const FFTW_plan p) { inline static void fftw_destroy_plan(const FFTW_plan p) {
@@ -174,6 +176,7 @@ public:
}; };
#endif #endif
#if !defined(GRID_CUDA) && !defined(GRID_HIP)
#ifdef HAVE_FFTW #ifdef HAVE_FFTW
template<> struct FFTW<ComplexD> { template<> struct FFTW<ComplexD> {
public: public:
@@ -216,6 +219,7 @@ public:
} }
}; };
#endif #endif
#endif
class FFT { class FFT {
private: private:

View File

@@ -349,7 +349,6 @@ void CartesianCommunicator::SendToRecvFromBegin(std::vector<MpiCommsRequest_t> &
GRID_ASSERT(dest != _processor); GRID_ASSERT(dest != _processor);
GRID_ASSERT(from != _processor); GRID_ASSERT(from != _processor);
GRID_ASSERT(bytes/(sizeof(int32_t))<= 2*1024*1024*1024);
int tag; int tag;
tag= dir+from*32; tag= dir+from*32;

View File

@@ -292,13 +292,14 @@ AC_ARG_ENABLE([accelerator],
case ${ac_ACCELERATOR} in case ${ac_ACCELERATOR} in
cuda) cuda)
echo CUDA acceleration echo CUDA acceleration
LIBS="${LIBS} -lcuda -lcublas" LIBS="${LIBS} -lcuda -lcublas -lcufft"
AC_DEFINE([GRID_CUDA],[1],[Use CUDA offload]);; AC_DEFINE([GRID_CUDA],[1],[Use CUDA offload]);;
sycl) sycl)
echo SYCL acceleration echo SYCL acceleration
AC_DEFINE([GRID_SYCL],[1],[Use SYCL offload]);; AC_DEFINE([GRID_SYCL],[1],[Use SYCL offload]);;
hip) hip)
echo HIP acceleration echo HIP acceleration
LIBS="${LIBS} -lhipblas -lrocblas -lhipfft"
AC_DEFINE([GRID_HIP],[1],[Use HIP offload]);; AC_DEFINE([GRID_HIP],[1],[Use HIP offload]);;
none) none)
echo NO acceleration ;; echo NO acceleration ;;