1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-09-20 01:05:38 +01:00

Merge branch 'master' into hadrons

This commit is contained in:
Antonin Portelli 2016-02-23 16:13:39 +00:00
commit 02f8b84ac9
8 changed files with 315 additions and 2504 deletions

2714
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -71,7 +71,7 @@ AC_CHECK_FUNCS([gettimeofday])
AC_ARG_ENABLE([simd],[AC_HELP_STRING([--enable-simd=SSE4|AVX|AVXFMA4|AVX2|AVX512|IMCI],\
[Select instructions to be SSE4.0, AVX 1.0, AVX 2.0+FMA, AVX 512, IMCI])],\
[ac_SIMD=${enable_simd}],[ac_SIMD=AVX2])
[ac_SIMD=${enable_simd}],[ac_SIMD=DEBUG])
supported=no

View File

@ -36,7 +36,6 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
#include <malloc.h>
#endif
#include <immintrin.h>
#ifdef HAVE_MM_MALLOC_H
#include <mm_malloc.h>
#endif

View File

@ -30,15 +30,6 @@
/* GRID_DEFAULT_PRECISION is SINGLE */
#undef GRID_DEFAULT_PRECISION_SINGLE
/* Support Altivec instructions */
#undef HAVE_ALTIVEC
/* Support AVX (Advanced Vector Extensions) instructions */
#undef HAVE_AVX
/* Support AVX2 (Advanced Vector Extensions 2) instructions */
#undef HAVE_AVX2
/* Define to 1 if you have the declaration of `be64toh', and to 0 if you
don't. */
#undef HAVE_DECL_BE64TOH
@ -53,9 +44,6 @@
/* Define to 1 if you have the <execinfo.h> header file. */
#undef HAVE_EXECINFO_H
/* Support FMA3 (Fused Multiply-Add) instructions */
#undef HAVE_FMA
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
@ -74,30 +62,9 @@
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Support mmx instructions */
#undef HAVE_MMX
/* Define to 1 if you have the <mm_malloc.h> header file. */
#undef HAVE_MM_MALLOC_H
/* Support SSE (Streaming SIMD Extensions) instructions */
#undef HAVE_SSE
/* Support SSE2 (Streaming SIMD Extensions 2) instructions */
#undef HAVE_SSE2
/* Support SSE3 (Streaming SIMD Extensions 3) instructions */
#undef HAVE_SSE3
/* Support SSSE4.1 (Streaming SIMD Extensions 4.1) instructions */
#undef HAVE_SSE4_1
/* Support SSSE4.2 (Streaming SIMD Extensions 4.2) instructions */
#undef HAVE_SSE4_2
/* Support SSSE3 (Supplemental Streaming SIMD Extensions 3) instructions */
#undef HAVE_SSSE3
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H

View File

@ -289,14 +289,13 @@ void Grid_sa_signal_handler(int sig,siginfo_t *si,void * ptr)
printf(" code %d\n",si->si_code);
// Linux/Posix
#ifdef __linux__
#ifdef __linux__
// And x86 64bit
ucontext_t * uc= (ucontext_t *)ptr;
#ifdef __x86_64__
ucontext_t * uc= (ucontext_t *)ptr;
struct sigcontext *sc = (struct sigcontext *)&uc->uc_mcontext;
printf(" instruction %llx\n",(unsigned long long)sc->rip);
#define REG(A) printf(" %s %lx\n",#A,sc-> A);
REG(rdi);
REG(rsi);
REG(rbp);
@ -316,6 +315,7 @@ void Grid_sa_signal_handler(int sig,siginfo_t *si,void * ptr)
REG(r13);
REG(r14);
REG(r15);
#endif
#endif
BACKTRACE();
exit(0);

View File

@ -43,8 +43,8 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
#else
#include <sys/syscall.h>
#endif
namespace Grid {
namespace Grid {
#ifdef __linux__
static long perf_event_open(struct perf_event_attr *hw_event, pid_t pid,
@ -58,6 +58,23 @@ static long perf_event_open(struct perf_event_attr *hw_event, pid_t pid,
}
#endif
#ifdef __bgq__
inline uint64_t cyclecount(void){
uint64_t tmp;
asm volatile ("mfspr %0,0x10C" : "=&r" (tmp) );
return tmp;
}
#elif defined __x86_64__
#include <x86intrin.h>
inline uint64_t cyclecount(void){
return __rdtsc();
}
#else
#warning No cycle counter implemented for this architecture
inline uint64_t cyclecount(void){
return 0;
}
#endif
class PerformanceCounter {
private:
@ -149,7 +166,7 @@ public:
ioctl(fd, PERF_EVENT_IOC_RESET, 0);
ioctl(fd, PERF_EVENT_IOC_ENABLE, 0);
}
begin =__rdtsc();
begin =cyclecount();
#else
begin = 0;
#endif
@ -162,7 +179,7 @@ public:
ioctl(fd, PERF_EVENT_IOC_DISABLE, 0);
::read(fd, &count, sizeof(long long));
}
elapsed = __rdtsc() - begin;
elapsed = cyclecount() - begin;
#else
elapsed = 0;
#endif

View File

@ -118,12 +118,12 @@ void WilsonKernels<Impl >::DiracOptAsmDhopSite(StencilImpl &st,DoubledGaugeField
StencilEntry *SE;
//#define STAMP(i) timers[i] = __rdtsc() ;
#define STAMP(i) //timers[i] = __rdtsc() ;
//#define STAMP(i) timers[i] = cyclecount() ;
#define STAMP(i) //timers[i] = cyclecount() ;
MASK_REGS;
first = __rdtsc();
first = cyclecount();
SE=st.GetEntry(ptype,Xm,ss);

View File

@ -35,6 +35,7 @@ Author: neo <cossu@post.kek.jp>
// Time-stamp: <2015-06-09 14:28:02 neo>
//----------------------------------------------------------------------
namespace Grid {
namespace Optimization {
template<class vtype>
@ -243,6 +244,36 @@ namespace Optimization {
//////////////////////////////////////////////
// Some Template specialization
struct Permute{
static inline float Permute0(float in){
return in;
};
static inline float Permute1(float in){
return in;
};
static inline float Permute2(float in){
return in;
};
static inline float Permute3(float in){
return in;
};
static inline double Permute0(double in){
return in;
};
static inline double Permute1(double in){
return in;
};
static inline double Permute2(double in){
return in;
};
static inline double Permute3(double in){
return in;
};
};
template < typename vtype >
void permute(vtype &a, vtype b, int perm) {
};
@ -282,7 +313,6 @@ namespace Optimization {
//////////////////////////////////////////////////////////////////////////////////////
// Here assign types
namespace Grid {
typedef float SIMD_Ftype; // Single precision type
typedef double SIMD_Dtype; // Double precision type