1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-11-22 23:49:31 +00:00

Compare commits

...

5 Commits

Author SHA1 Message Date
6e40e22004 aarch64 libunwind compatibility fix 2025-10-30 16:45:43 +01:00
Peter Boyle
6165931afa Update GridStd.h 2025-10-03 14:35:37 -04:00
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
5 changed files with 20 additions and 9 deletions

View File

@@ -42,6 +42,7 @@ void GridAbort(void);
#define ASSLOG(A) ::write(STDERR_FILENO,A,::strlen(A)); #define ASSLOG(A) ::write(STDERR_FILENO,A,::strlen(A));
#ifdef HAVE_EXECINFO_H #ifdef HAVE_EXECINFO_H
#define GRID_ASSERT(b) if(!(b)) { \ #define GRID_ASSERT(b) if(!(b)) { \
fflush(stdout); \
ASSLOG(" GRID_ASSERT failure: "); \ ASSLOG(" GRID_ASSERT failure: "); \
ASSLOG(__FILE__); \ ASSLOG(__FILE__); \
ASSLOG(" : "); \ ASSLOG(" : "); \

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

@@ -755,7 +755,7 @@ void Grid_generic_handler(int sig,siginfo_t *si,void * ptr)
sig_print_uint(si->si_code); sig_print_uint(si->si_code);
SIGLOG("\n"); SIGLOG("\n");
ucontext_t *uc= (ucontext_t *)ptr; unw_context_t *uc= (unw_context_t *)ptr;
SIGLOG("Backtrace:\n"); SIGLOG("Backtrace:\n");
#ifdef HAVE_UNWIND #ifdef HAVE_UNWIND

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 ;;
@@ -408,10 +409,16 @@ AC_SEARCH_LIBS([unw_backtrace], [unwind],
[have_unwind=true], [have_unwind=true],
[AC_MSG_WARN(libunwind library was not found in your system.)]) [AC_MSG_WARN(libunwind library was not found in your system.)])
AC_SEARCH_LIBS([_Ux86_64_step], [unwind-x86_64], AS_CASE([$host_cpu], [x86_64],
[AC_DEFINE([HAVE_UNWIND_X86_64], [1], [Define to 1 if you have the `libunwind-x86_64' library])] [AC_SEARCH_LIBS([_Ux86_64_step], [unwind-x86_64],
[have_unwind_x86_64=true], [AC_DEFINE([HAVE_UNWIND_X86_64], [1], [Define to 1 if you have the `libunwind-x86_64' library])]
[AC_MSG_WARN(libunwind library was not found in your system.)]) [have_unwind_x86_64=true],
[AC_MSG_WARN(libunwind library was not found in your system.)])],
[aarch64],
[AC_SEARCH_LIBS([_Uaarch64_step], [unwind-aarch64],
[AC_DEFINE([HAVE_UNWIND_AARCH64], [1], [Define to 1 if you have the `libunwind-aarch64' library])]
[have_unwind_aarch64=true],
[AC_MSG_WARN(libunwind library was not found in your system.)])])
AC_SEARCH_LIBS([SHA256_Init], [crypto], AC_SEARCH_LIBS([SHA256_Init], [crypto],
[AC_DEFINE([HAVE_CRYPTO], [1], [Define to 1 if you have the `OpenSSL' library])] [AC_DEFINE([HAVE_CRYPTO], [1], [Define to 1 if you have the `OpenSSL' library])]