mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-13 20:57:06 +01:00
Merge branch 'develop' into feature/scidac-wp1
This commit is contained in:
@ -29,7 +29,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||
#define _GRID_FFT_H_
|
||||
|
||||
#ifdef HAVE_FFTW
|
||||
#ifdef USE_MKL
|
||||
#if defined(USE_MKL) || defined(GRID_SYCL)
|
||||
#include <fftw/fftw3.h>
|
||||
#else
|
||||
#include <fftw3.h>
|
||||
|
@ -386,6 +386,7 @@ double CartesianCommunicator::StencilSendToRecvFrom( void *xmit,
|
||||
return offbytes;
|
||||
}
|
||||
|
||||
#undef NVLINK_GET // Define to use get instead of put DMA
|
||||
double CartesianCommunicator::StencilSendToRecvFromBegin(std::vector<CommsRequest_t> &list,
|
||||
void *xmit,
|
||||
int dest,int dox,
|
||||
@ -418,9 +419,15 @@ double CartesianCommunicator::StencilSendToRecvFromBegin(std::vector<CommsReques
|
||||
list.push_back(rrq);
|
||||
off_node_bytes+=rbytes;
|
||||
}
|
||||
#ifdef NVLINK_GET
|
||||
void *shm = (void *) this->ShmBufferTranslate(from,xmit);
|
||||
assert(shm!=NULL);
|
||||
acceleratorCopyDeviceToDeviceAsynch(shm,recv,rbytes);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (dox) {
|
||||
// rcrc = crc32(rcrc,(unsigned char *)recv,bytes);
|
||||
if ( (gdest == MPI_UNDEFINED) || Stencil_force_mpi ) {
|
||||
tag= dir+_processor*32;
|
||||
ierr =MPI_Isend(xmit, xbytes, MPI_CHAR,dest,tag,communicator_halo[commdir],&xrq);
|
||||
@ -428,9 +435,12 @@ double CartesianCommunicator::StencilSendToRecvFromBegin(std::vector<CommsReques
|
||||
list.push_back(xrq);
|
||||
off_node_bytes+=xbytes;
|
||||
} else {
|
||||
#ifndef NVLINK_GET
|
||||
void *shm = (void *) this->ShmBufferTranslate(dest,recv);
|
||||
assert(shm!=NULL);
|
||||
acceleratorCopyDeviceToDeviceAsynch(xmit,shm,xbytes);
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -440,6 +450,8 @@ void CartesianCommunicator::StencilSendToRecvFromComplete(std::vector<CommsReque
|
||||
{
|
||||
int nreq=list.size();
|
||||
|
||||
acceleratorCopySynchronise();
|
||||
|
||||
if (nreq==0) return;
|
||||
|
||||
std::vector<MPI_Status> status(nreq);
|
||||
|
@ -40,6 +40,9 @@ int GlobalSharedMemory::_ShmAlloc;
|
||||
uint64_t GlobalSharedMemory::_ShmAllocBytes;
|
||||
|
||||
std::vector<void *> GlobalSharedMemory::WorldShmCommBufs;
|
||||
#ifndef ACCELERATOR_AWARE_MPI
|
||||
void * GlobalSharedMemory::HostCommBuf;
|
||||
#endif
|
||||
|
||||
Grid_MPI_Comm GlobalSharedMemory::WorldShmComm;
|
||||
int GlobalSharedMemory::WorldShmRank;
|
||||
@ -66,6 +69,26 @@ void GlobalSharedMemory::SharedMemoryFree(void)
|
||||
/////////////////////////////////
|
||||
// Alloc, free shmem region
|
||||
/////////////////////////////////
|
||||
#ifndef ACCELERATOR_AWARE_MPI
|
||||
void *SharedMemory::HostBufferMalloc(size_t bytes){
|
||||
void *ptr = (void *)host_heap_top;
|
||||
host_heap_top += bytes;
|
||||
host_heap_bytes+= bytes;
|
||||
if (host_heap_bytes >= host_heap_size) {
|
||||
std::cout<< " HostBufferMalloc exceeded heap size -- try increasing with --shm <MB> flag" <<std::endl;
|
||||
std::cout<< " Parameter specified in units of MB (megabytes) " <<std::endl;
|
||||
std::cout<< " Current alloc is " << (bytes/(1024*1024)) <<"MB"<<std::endl;
|
||||
std::cout<< " Current bytes is " << (host_heap_bytes/(1024*1024)) <<"MB"<<std::endl;
|
||||
std::cout<< " Current heap is " << (host_heap_size/(1024*1024)) <<"MB"<<std::endl;
|
||||
assert(host_heap_bytes<host_heap_size);
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
void SharedMemory::HostBufferFreeAll(void) {
|
||||
host_heap_top =(size_t)HostCommBuf;
|
||||
host_heap_bytes=0;
|
||||
}
|
||||
#endif
|
||||
void *SharedMemory::ShmBufferMalloc(size_t bytes){
|
||||
// bytes = (bytes+sizeof(vRealD))&(~(sizeof(vRealD)-1));// align up bytes
|
||||
void *ptr = (void *)heap_top;
|
||||
|
@ -75,7 +75,9 @@ public:
|
||||
static int Hugepages;
|
||||
|
||||
static std::vector<void *> WorldShmCommBufs;
|
||||
|
||||
#ifndef ACCELERATOR_AWARE_MPI
|
||||
static void *HostCommBuf;
|
||||
#endif
|
||||
static Grid_MPI_Comm WorldComm;
|
||||
static int WorldRank;
|
||||
static int WorldSize;
|
||||
@ -120,6 +122,13 @@ private:
|
||||
size_t heap_bytes;
|
||||
size_t heap_size;
|
||||
|
||||
#ifndef ACCELERATOR_AWARE_MPI
|
||||
size_t host_heap_top; // set in free all
|
||||
size_t host_heap_bytes;// set in free all
|
||||
void *HostCommBuf; // set in SetCommunicator
|
||||
size_t host_heap_size; // set in SetCommunicator
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
Grid_MPI_Comm ShmComm; // for barriers
|
||||
@ -151,7 +160,10 @@ public:
|
||||
void *ShmBufferTranslate(int rank,void * local_p);
|
||||
void *ShmBufferMalloc(size_t bytes);
|
||||
void ShmBufferFreeAll(void) ;
|
||||
|
||||
#ifndef ACCELERATOR_AWARE_MPI
|
||||
void *HostBufferMalloc(size_t bytes);
|
||||
void HostBufferFreeAll(void);
|
||||
#endif
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Make info on Nodes & ranks and Shared memory available
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -39,9 +39,11 @@ Author: Christoph Lehner <christoph@lhnr.de>
|
||||
#include <hip/hip_runtime_api.h>
|
||||
#endif
|
||||
#ifdef GRID_SYCL
|
||||
#ifdef ACCELERATOR_AWARE_MPI
|
||||
#define GRID_SYCL_LEVEL_ZERO_IPC
|
||||
#define SHM_SOCKETS
|
||||
#endif
|
||||
#include <syscall.h>
|
||||
#define SHM_SOCKETS
|
||||
#endif
|
||||
|
||||
#include <sys/socket.h>
|
||||
@ -512,46 +514,6 @@ void GlobalSharedMemory::SharedMemoryAllocate(uint64_t bytes, int flags)
|
||||
// Hugetlbfs mapping intended
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if defined(GRID_CUDA) ||defined(GRID_HIP) || defined(GRID_SYCL)
|
||||
|
||||
//if defined(GRID_SYCL)
|
||||
#if 0
|
||||
void GlobalSharedMemory::SharedMemoryAllocate(uint64_t bytes, int flags)
|
||||
{
|
||||
void * ShmCommBuf ;
|
||||
assert(_ShmSetup==1);
|
||||
assert(_ShmAlloc==0);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// allocate the pointer array for shared windows for our group
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
MPI_Barrier(WorldShmComm);
|
||||
WorldShmCommBufs.resize(WorldShmSize);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Each MPI rank should allocate our own buffer
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
ShmCommBuf = acceleratorAllocDevice(bytes);
|
||||
|
||||
if (ShmCommBuf == (void *)NULL ) {
|
||||
std::cerr << " SharedMemoryMPI.cc acceleratorAllocDevice failed NULL pointer for " << bytes<<" bytes " << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
std::cout << WorldRank << Mheader " SharedMemoryMPI.cc acceleratorAllocDevice "<< bytes
|
||||
<< "bytes at "<< std::hex<< ShmCommBuf <<std::dec<<" for comms buffers " <<std::endl;
|
||||
|
||||
SharedMemoryZero(ShmCommBuf,bytes);
|
||||
|
||||
assert(WorldShmSize == 1);
|
||||
for(int r=0;r<WorldShmSize;r++){
|
||||
WorldShmCommBufs[r] = ShmCommBuf;
|
||||
}
|
||||
_ShmAllocBytes=bytes;
|
||||
_ShmAlloc=1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(GRID_CUDA) ||defined(GRID_HIP) ||defined(GRID_SYCL)
|
||||
void GlobalSharedMemory::SharedMemoryAllocate(uint64_t bytes, int flags)
|
||||
{
|
||||
void * ShmCommBuf ;
|
||||
@ -574,6 +536,9 @@ void GlobalSharedMemory::SharedMemoryAllocate(uint64_t bytes, int flags)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Each MPI rank should allocate our own buffer
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef ACCELERATOR_AWARE_MPI
|
||||
HostCommBuf= malloc(bytes);
|
||||
#endif
|
||||
ShmCommBuf = acceleratorAllocDevice(bytes);
|
||||
if (ShmCommBuf == (void *)NULL ) {
|
||||
std::cerr << " SharedMemoryMPI.cc acceleratorAllocDevice failed NULL pointer for " << bytes<<" bytes " << std::endl;
|
||||
@ -738,7 +703,6 @@ void GlobalSharedMemory::SharedMemoryAllocate(uint64_t bytes, int flags)
|
||||
_ShmAllocBytes=bytes;
|
||||
_ShmAlloc=1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
#ifdef GRID_MPI3_SHMMMAP
|
||||
@ -962,6 +926,12 @@ void SharedMemory::SetCommunicator(Grid_MPI_Comm comm)
|
||||
}
|
||||
ShmBufferFreeAll();
|
||||
|
||||
#ifndef ACCELERATOR_AWARE_MPI
|
||||
host_heap_size = heap_size;
|
||||
HostCommBuf= GlobalSharedMemory::HostCommBuf;
|
||||
HostBufferFreeAll();
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// find comm ranks in our SHM group (i.e. which ranks are on our node)
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
@ -302,12 +302,29 @@ inline ComplexD rankInnerProduct(const Lattice<vobj> &left,const Lattice<vobj> &
|
||||
return nrm;
|
||||
}
|
||||
|
||||
|
||||
template<class vobj>
|
||||
inline ComplexD innerProduct(const Lattice<vobj> &left,const Lattice<vobj> &right) {
|
||||
GridBase *grid = left.Grid();
|
||||
|
||||
#ifdef GRID_SYCL
|
||||
uint64_t csum=0;
|
||||
if ( FlightRecorder::LoggingMode != FlightRecorder::LoggingModeNone)
|
||||
{
|
||||
// Hack
|
||||
// Fast integer xor checksum. Can also be used in comms now.
|
||||
autoView(l_v,left,AcceleratorRead);
|
||||
Integer words = left.Grid()->oSites()*sizeof(vobj)/sizeof(uint64_t);
|
||||
uint64_t *base= (uint64_t *)&l_v[0];
|
||||
csum=svm_xor(base,words);
|
||||
}
|
||||
FlightRecorder::CsumLog(csum);
|
||||
#endif
|
||||
ComplexD nrm = rankInnerProduct(left,right);
|
||||
// std::cerr<<"flight log " << std::hexfloat << nrm <<" "<<crc(left)<<std::endl;
|
||||
RealD local = real(nrm);
|
||||
FlightRecorder::NormLog(real(nrm));
|
||||
grid->GlobalSum(nrm);
|
||||
FlightRecorder::ReductionLog(local,real(nrm));
|
||||
return nrm;
|
||||
}
|
||||
|
||||
|
@ -69,29 +69,30 @@ inline typename vobj::scalar_object sum_gpu_large(const vobj *lat, Integer osite
|
||||
return result;
|
||||
}
|
||||
|
||||
NAMESPACE_END(Grid);
|
||||
|
||||
/*
|
||||
template<class Double> Double svm_reduce(Double *vec,uint64_t L)
|
||||
template<class Word> Word svm_xor(Word *vec,uint64_t L)
|
||||
{
|
||||
Double sumResult; zeroit(sumResult);
|
||||
Double *d_sum =(Double *)cl::sycl::malloc_shared(sizeof(Double),*theGridAccelerator);
|
||||
Double identity; zeroit(identity);
|
||||
Word xorResult; xorResult = 0;
|
||||
Word *d_sum =(Word *)cl::sycl::malloc_shared(sizeof(Word),*theGridAccelerator);
|
||||
Word identity; identity=0;
|
||||
theGridAccelerator->submit([&](cl::sycl::handler &cgh) {
|
||||
auto Reduction = cl::sycl::reduction(d_sum,identity,std::plus<>());
|
||||
auto Reduction = cl::sycl::reduction(d_sum,identity,std::bit_xor<>());
|
||||
cgh.parallel_for(cl::sycl::range<1>{L},
|
||||
Reduction,
|
||||
[=] (cl::sycl::id<1> index, auto &sum) {
|
||||
sum +=vec[index];
|
||||
sum ^=vec[index];
|
||||
});
|
||||
});
|
||||
theGridAccelerator->wait();
|
||||
Double ret = d_sum[0];
|
||||
Word ret = d_sum[0];
|
||||
free(d_sum,*theGridAccelerator);
|
||||
std::cout << " svm_reduce finished "<<L<<" sites sum = " << ret <<std::endl;
|
||||
return ret;
|
||||
}
|
||||
|
||||
NAMESPACE_END(Grid);
|
||||
|
||||
/*
|
||||
|
||||
template <class vobj>
|
||||
inline typename vobj::scalar_objectD sumD_gpu_repack(const vobj *lat, Integer osites)
|
||||
{
|
||||
|
@ -416,7 +416,7 @@ public:
|
||||
std::cout << GridLogMessage << "Seed SHA256: " << GridChecksum::sha256_string(seeds) << std::endl;
|
||||
SeedFixedIntegers(seeds);
|
||||
}
|
||||
void SeedFixedIntegers(const std::vector<int> &seeds){
|
||||
void SeedFixedIntegers(const std::vector<int> &seeds, int britney=0){
|
||||
|
||||
// Everyone generates the same seed_seq based on input seeds
|
||||
CartesianCommunicator::BroadcastWorld(0,(void *)&seeds[0],sizeof(int)*seeds.size());
|
||||
@ -433,7 +433,6 @@ public:
|
||||
// MT implementation does not implement fast discard even though
|
||||
// in principle this is possible
|
||||
////////////////////////////////////////////////
|
||||
#if 1
|
||||
thread_for( lidx, _grid->lSites(), {
|
||||
|
||||
int64_t gidx;
|
||||
@ -454,29 +453,12 @@ public:
|
||||
|
||||
int l_idx=generator_idx(o_idx,i_idx);
|
||||
_generators[l_idx] = master_engine;
|
||||
Skip(_generators[l_idx],gidx); // Skip to next RNG sequence
|
||||
});
|
||||
#else
|
||||
// Everybody loops over global volume.
|
||||
thread_for( gidx, _grid->_gsites, {
|
||||
|
||||
// Where is it?
|
||||
int rank;
|
||||
int o_idx;
|
||||
int i_idx;
|
||||
|
||||
Coordinate gcoor;
|
||||
_grid->GlobalIndexToGlobalCoor(gidx,gcoor);
|
||||
_grid->GlobalCoorToRankIndex(rank,o_idx,i_idx,gcoor);
|
||||
|
||||
// If this is one of mine we take it
|
||||
if( rank == _grid->ThisRank() ){
|
||||
int l_idx=generator_idx(o_idx,i_idx);
|
||||
_generators[l_idx] = master_engine;
|
||||
if ( britney ) {
|
||||
Skip(_generators[l_idx],l_idx); // Skip to next RNG sequence
|
||||
} else {
|
||||
Skip(_generators[l_idx],gidx); // Skip to next RNG sequence
|
||||
}
|
||||
});
|
||||
#endif
|
||||
#else
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Machine and thread decomposition dependent seeding is efficient
|
||||
|
@ -462,6 +462,7 @@ void WilsonKernels<Impl>::DhopKernel(int Opt,StencilImpl &st, DoubledGaugeField
|
||||
autoView(st_v , st,AcceleratorRead);
|
||||
|
||||
if( interior && exterior ) {
|
||||
acceleratorFenceComputeStream();
|
||||
if (Opt == WilsonKernelsStatic::OptGeneric ) { KERNEL_CALL(GenericDhopSite); return;}
|
||||
if (Opt == WilsonKernelsStatic::OptHandUnroll ) { KERNEL_CALL(HandDhopSite); return;}
|
||||
#ifndef GRID_CUDA
|
||||
@ -495,6 +496,7 @@ void WilsonKernels<Impl>::DhopKernel(int Opt,StencilImpl &st, DoubledGaugeField
|
||||
autoView(st_v ,st,AcceleratorRead);
|
||||
|
||||
if( interior && exterior ) {
|
||||
acceleratorFenceComputeStream();
|
||||
if (Opt == WilsonKernelsStatic::OptGeneric ) { KERNEL_CALL(GenericDhopSiteDag); return;}
|
||||
if (Opt == WilsonKernelsStatic::OptHandUnroll ) { KERNEL_CALL(HandDhopSiteDag); return;}
|
||||
#ifndef GRID_CUDA
|
||||
|
@ -70,57 +70,6 @@ struct DefaultImplParams {
|
||||
void Gather_plane_table_compute (GridBase *grid,int dimension,int plane,int cbmask,
|
||||
int off,std::vector<std::pair<int,int> > & table);
|
||||
|
||||
/*
|
||||
template<class vobj,class cobj,class compressor>
|
||||
void Gather_plane_simple_table (commVector<std::pair<int,int> >& table,const Lattice<vobj> &rhs,cobj *buffer,compressor &compress, int off,int so) __attribute__((noinline));
|
||||
|
||||
template<class vobj,class cobj,class compressor>
|
||||
void Gather_plane_simple_table (commVector<std::pair<int,int> >& table,const Lattice<vobj> &rhs,cobj *buffer,compressor &compress, int off,int so)
|
||||
{
|
||||
int num=table.size();
|
||||
std::pair<int,int> *table_v = & table[0];
|
||||
|
||||
auto rhs_v = rhs.View(AcceleratorRead);
|
||||
accelerator_forNB( i,num, vobj::Nsimd(), {
|
||||
compress.Compress(buffer[off+table_v[i].first],rhs_v[so+table_v[i].second]);
|
||||
});
|
||||
rhs_v.ViewClose();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Gather for when there *is* need to SIMD split with compression
|
||||
///////////////////////////////////////////////////////////////////
|
||||
template<class cobj,class vobj,class compressor>
|
||||
void Gather_plane_exchange_table(const Lattice<vobj> &rhs,
|
||||
commVector<cobj *> pointers,
|
||||
int dimension,int plane,
|
||||
int cbmask,compressor &compress,int type) __attribute__((noinline));
|
||||
|
||||
template<class cobj,class vobj,class compressor>
|
||||
void Gather_plane_exchange_table(commVector<std::pair<int,int> >& table,
|
||||
const Lattice<vobj> &rhs,
|
||||
std::vector<cobj *> &pointers,int dimension,int plane,int cbmask,
|
||||
compressor &compress,int type)
|
||||
{
|
||||
assert( (table.size()&0x1)==0);
|
||||
int num=table.size()/2;
|
||||
int so = plane*rhs.Grid()->_ostride[dimension]; // base offset for start of plane
|
||||
|
||||
auto rhs_v = rhs.View(AcceleratorRead);
|
||||
auto rhs_p = &rhs_v[0];
|
||||
auto p0=&pointers[0][0];
|
||||
auto p1=&pointers[1][0];
|
||||
auto tp=&table[0];
|
||||
accelerator_forNB(j, num, vobj::Nsimd(), {
|
||||
compress.CompressExchange(p0,p1, rhs_p, j,
|
||||
so+tp[2*j ].second,
|
||||
so+tp[2*j+1].second,
|
||||
type);
|
||||
});
|
||||
rhs_v.ViewClose();
|
||||
}
|
||||
*/
|
||||
|
||||
void DslashResetCounts(void);
|
||||
void DslashGetCounts(uint64_t &dirichlet,uint64_t &partial,uint64_t &full);
|
||||
void DslashLogFull(void);
|
||||
@ -258,6 +207,10 @@ public:
|
||||
struct Packet {
|
||||
void * send_buf;
|
||||
void * recv_buf;
|
||||
#ifndef ACCELERATOR_AWARE_MPI
|
||||
void * host_send_buf; // Allocate this if not MPI_CUDA_AWARE
|
||||
void * host_recv_buf; // Allocate this if not MPI_CUDA_AWARE
|
||||
#endif
|
||||
Integer to_rank;
|
||||
Integer from_rank;
|
||||
Integer do_send;
|
||||
@ -324,7 +277,7 @@ public:
|
||||
Vector<int> surface_list;
|
||||
|
||||
stencilVector<StencilEntry> _entries; // Resident in managed memory
|
||||
commVector<StencilEntry> _entries_device; // Resident in managed memory
|
||||
commVector<StencilEntry> _entries_device; // Resident in device memory
|
||||
std::vector<Packet> Packets;
|
||||
std::vector<Merge> Mergers;
|
||||
std::vector<Merge> MergersSHM;
|
||||
@ -408,33 +361,16 @@ public:
|
||||
// Use OpenMP Tasks for cleaner ???
|
||||
// must be called *inside* parallel region
|
||||
//////////////////////////////////////////
|
||||
/*
|
||||
void CommunicateThreaded()
|
||||
{
|
||||
#ifdef GRID_OMP
|
||||
int mythread = omp_get_thread_num();
|
||||
int nthreads = CartesianCommunicator::nCommThreads;
|
||||
#else
|
||||
int mythread = 0;
|
||||
int nthreads = 1;
|
||||
#endif
|
||||
if (nthreads == -1) nthreads = 1;
|
||||
if (mythread < nthreads) {
|
||||
for (int i = mythread; i < Packets.size(); i += nthreads) {
|
||||
uint64_t bytes = _grid->StencilSendToRecvFrom(Packets[i].send_buf,
|
||||
Packets[i].to_rank,
|
||||
Packets[i].recv_buf,
|
||||
Packets[i].from_rank,
|
||||
Packets[i].bytes,i);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Non blocking send and receive. Necessarily parallel.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
void CommunicateBegin(std::vector<std::vector<CommsRequest_t> > &reqs)
|
||||
{
|
||||
// All GPU kernel tasks must complete
|
||||
// accelerator_barrier(); // All kernels should ALREADY be complete
|
||||
// _grid->StencilBarrier(); // Everyone is here, so noone running slow and still using receive buffer
|
||||
// But the HaloGather had a barrier too.
|
||||
#ifdef ACCELERATOR_AWARE_MPI
|
||||
for(int i=0;i<Packets.size();i++){
|
||||
_grid->StencilSendToRecvFromBegin(MpiReqs,
|
||||
Packets[i].send_buf,
|
||||
@ -443,16 +379,54 @@ public:
|
||||
Packets[i].from_rank,Packets[i].do_recv,
|
||||
Packets[i].xbytes,Packets[i].rbytes,i);
|
||||
}
|
||||
#else
|
||||
#warning "Using COPY VIA HOST BUFFERS IN STENCIL"
|
||||
for(int i=0;i<Packets.size();i++){
|
||||
// Introduce a host buffer with a cheap slab allocator and zero cost wipe all
|
||||
Packets[i].host_send_buf = _grid->HostBufferMalloc(Packets[i].xbytes);
|
||||
Packets[i].host_recv_buf = _grid->HostBufferMalloc(Packets[i].rbytes);
|
||||
if ( Packets[i].do_send ) {
|
||||
acceleratorCopyFromDevice(Packets[i].send_buf, Packets[i].host_send_buf,Packets[i].xbytes);
|
||||
}
|
||||
_grid->StencilSendToRecvFromBegin(MpiReqs,
|
||||
Packets[i].host_send_buf,
|
||||
Packets[i].to_rank,Packets[i].do_send,
|
||||
Packets[i].host_recv_buf,
|
||||
Packets[i].from_rank,Packets[i].do_recv,
|
||||
Packets[i].xbytes,Packets[i].rbytes,i);
|
||||
}
|
||||
#endif
|
||||
// Get comms started then run checksums
|
||||
// Having this PRIOR to the dslash seems to make Sunspot work... (!)
|
||||
for(int i=0;i<Packets.size();i++){
|
||||
if ( Packets[i].do_send )
|
||||
FlightRecorder::xmitLog(Packets[i].send_buf,Packets[i].xbytes);
|
||||
}
|
||||
}
|
||||
|
||||
void CommunicateComplete(std::vector<std::vector<CommsRequest_t> > &reqs)
|
||||
{
|
||||
_grid->StencilSendToRecvFromComplete(MpiReqs,0);
|
||||
_grid->StencilSendToRecvFromComplete(MpiReqs,0); // MPI is done
|
||||
if ( this->partialDirichlet ) DslashLogPartial();
|
||||
else if ( this->fullDirichlet ) DslashLogDirichlet();
|
||||
else DslashLogFull();
|
||||
acceleratorCopySynchronise();
|
||||
// acceleratorCopySynchronise() is in the StencilSendToRecvFromComplete
|
||||
// accelerator_barrier();
|
||||
_grid->StencilBarrier();
|
||||
#ifndef ACCELERATOR_AWARE_MPI
|
||||
#warning "Using COPY VIA HOST BUFFERS IN STENCIL"
|
||||
for(int i=0;i<Packets.size();i++){
|
||||
if ( Packets[i].do_recv ) {
|
||||
acceleratorCopyToDevice(Packets[i].host_recv_buf, Packets[i].recv_buf,Packets[i].rbytes);
|
||||
}
|
||||
}
|
||||
_grid->HostBufferFreeAll();
|
||||
#endif
|
||||
// run any checksums
|
||||
for(int i=0;i<Packets.size();i++){
|
||||
if ( Packets[i].do_recv )
|
||||
FlightRecorder::recvLog(Packets[i].recv_buf,Packets[i].rbytes,Packets[i].from_rank);
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Blocking send and receive. Either sequential or parallel.
|
||||
@ -528,6 +502,7 @@ public:
|
||||
template<class compressor>
|
||||
void HaloGather(const Lattice<vobj> &source,compressor &compress)
|
||||
{
|
||||
// accelerator_barrier();
|
||||
_grid->StencilBarrier();// Synch shared memory on a single nodes
|
||||
|
||||
assert(source.Grid()==_grid);
|
||||
@ -540,10 +515,9 @@ public:
|
||||
compress.Point(point);
|
||||
HaloGatherDir(source,compress,point,face_idx);
|
||||
}
|
||||
accelerator_barrier();
|
||||
accelerator_barrier(); // All my local gathers are complete
|
||||
face_table_computed=1;
|
||||
assert(u_comm_offset==_unified_buffer_size);
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////
|
||||
@ -579,6 +553,7 @@ public:
|
||||
accelerator_forNB(j, words, cobj::Nsimd(), {
|
||||
coalescedWrite(to[j] ,coalescedRead(from [j]));
|
||||
});
|
||||
acceleratorFenceComputeStream();
|
||||
}
|
||||
}
|
||||
|
||||
@ -669,6 +644,7 @@ public:
|
||||
for(int i=0;i<dd.size();i++){
|
||||
decompressor::DecompressFace(decompress,dd[i]);
|
||||
}
|
||||
acceleratorFenceComputeStream(); // dependent kernels
|
||||
}
|
||||
////////////////////////////////////////
|
||||
// Set up routines
|
||||
@ -1224,7 +1200,6 @@ public:
|
||||
///////////////////////////////////////////////////////////
|
||||
int do_send = (comms_send|comms_partial_send) && (!shm_send );
|
||||
int do_recv = (comms_send|comms_partial_send) && (!shm_recv );
|
||||
|
||||
AddPacket((void *)&send_buf[comm_off],
|
||||
(void *)&recv_buf[comm_off],
|
||||
xmit_to_rank, do_send,
|
||||
|
@ -405,11 +405,4 @@ NAMESPACE_BEGIN(Grid);
|
||||
NAMESPACE_END(Grid);
|
||||
|
||||
|
||||
#ifdef GRID_SYCL
|
||||
template<typename T> struct
|
||||
sycl::is_device_copyable<T, typename std::enable_if<
|
||||
Grid::isGridTensor<T>::value && (!std::is_trivially_copyable<T>::value),
|
||||
void>::type>
|
||||
: public std::true_type {};
|
||||
#endif
|
||||
|
||||
|
339
Grid/util/FlightRecorder.cc
Normal file
339
Grid/util/FlightRecorder.cc
Normal file
@ -0,0 +1,339 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./lib/Init.cc
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
|
||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||
Author: Peter Boyle <peterboyle@MacBook-Pro.local>
|
||||
Author: paboyle <paboyle@ph.ed.ac.uk>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
See the full license in the file "LICENSE" in the top level distribution directory
|
||||
*************************************************************************************/
|
||||
/* END LEGAL */
|
||||
#include <Grid/Grid.h>
|
||||
|
||||
NAMESPACE_BEGIN(Grid);
|
||||
///////////////////////////////////////////////////////
|
||||
// Grid Norm logging for repro testing
|
||||
///////////////////////////////////////////////////////
|
||||
int FlightRecorder::PrintEntireLog;
|
||||
int FlightRecorder::ContinueOnFail;
|
||||
int FlightRecorder::LoggingMode;
|
||||
int FlightRecorder::ChecksumComms;
|
||||
int FlightRecorder::ChecksumCommsSend;
|
||||
int32_t FlightRecorder::XmitLoggingCounter;
|
||||
int32_t FlightRecorder::RecvLoggingCounter;
|
||||
int32_t FlightRecorder::CsumLoggingCounter;
|
||||
int32_t FlightRecorder::NormLoggingCounter;
|
||||
int32_t FlightRecorder::ReductionLoggingCounter;
|
||||
uint64_t FlightRecorder::ErrorCounter;
|
||||
std::vector<double> FlightRecorder::NormLogVector;
|
||||
std::vector<double> FlightRecorder::ReductionLogVector;
|
||||
std::vector<uint64_t> FlightRecorder::CsumLogVector;
|
||||
std::vector<uint64_t> FlightRecorder::XmitLogVector;
|
||||
std::vector<uint64_t> FlightRecorder::RecvLogVector;
|
||||
|
||||
void FlightRecorder::ResetCounters(void)
|
||||
{
|
||||
XmitLoggingCounter=0;
|
||||
RecvLoggingCounter=0;
|
||||
CsumLoggingCounter=0;
|
||||
NormLoggingCounter=0;
|
||||
ReductionLoggingCounter=0;
|
||||
}
|
||||
void FlightRecorder::Truncate(void)
|
||||
{
|
||||
ResetCounters();
|
||||
XmitLogVector.resize(0);
|
||||
RecvLogVector.resize(0);
|
||||
NormLogVector.resize(0);
|
||||
CsumLogVector.resize(0);
|
||||
ReductionLogVector.resize(0);
|
||||
}
|
||||
void FlightRecorder::SetLoggingMode(FlightRecorder::LoggingMode_t mode)
|
||||
{
|
||||
switch ( mode ) {
|
||||
case LoggingModePrint:
|
||||
SetLoggingModePrint();
|
||||
break;
|
||||
case LoggingModeRecord:
|
||||
SetLoggingModeRecord();
|
||||
break;
|
||||
case LoggingModeVerify:
|
||||
SetLoggingModeVerify();
|
||||
break;
|
||||
case LoggingModeNone:
|
||||
LoggingMode = mode;
|
||||
Truncate();
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
void FlightRecorder::SetLoggingModePrint(void)
|
||||
{
|
||||
std::cout << " FlightRecorder: set to print output " <<std::endl;
|
||||
Truncate();
|
||||
LoggingMode = LoggingModePrint;
|
||||
}
|
||||
void FlightRecorder::SetLoggingModeRecord(void)
|
||||
{
|
||||
std::cout << " FlightRecorder: set to RECORD " <<std::endl;
|
||||
Truncate();
|
||||
LoggingMode = LoggingModeRecord;
|
||||
}
|
||||
void FlightRecorder::SetLoggingModeVerify(void)
|
||||
{
|
||||
std::cout << " FlightRecorder: set to VERIFY " << NormLogVector.size()<< " log entries "<<std::endl;
|
||||
ResetCounters();
|
||||
LoggingMode = LoggingModeVerify;
|
||||
}
|
||||
uint64_t FlightRecorder::ErrorCount(void)
|
||||
{
|
||||
return ErrorCounter;
|
||||
}
|
||||
void FlightRecorder::NormLog(double value)
|
||||
{
|
||||
uint64_t hex = * ( (uint64_t *)&value );
|
||||
if(LoggingMode == LoggingModePrint) {
|
||||
std::cerr<<"FlightRecorder::NormLog : "<< NormLoggingCounter <<" "<<std::hex<< hex<<std::dec <<std::endl;
|
||||
NormLoggingCounter++;
|
||||
}
|
||||
if(LoggingMode == LoggingModeRecord) {
|
||||
std::cerr<<"FlightRecorder::NormLog RECORDING : "<< NormLoggingCounter <<" "<<std::hex<< hex<<std::dec <<std::endl;
|
||||
NormLogVector.push_back(value);
|
||||
NormLoggingCounter++;
|
||||
}
|
||||
if(LoggingMode == LoggingModeVerify) {
|
||||
|
||||
if(NormLoggingCounter < NormLogVector.size()){
|
||||
uint64_t hexref = * ( (uint64_t *)&NormLogVector[NormLoggingCounter] );
|
||||
|
||||
if ( (value != NormLogVector[NormLoggingCounter]) || std::isnan(value) ) {
|
||||
|
||||
std::cerr<<"FlightRecorder::NormLog Oops, I did it again "<< NormLoggingCounter
|
||||
<<std::hex<<" "<<hex<<" "<<hexref<<std::dec<<" "
|
||||
<<std::hexfloat<<value<<" "<< NormLogVector[NormLoggingCounter]<<std::endl;
|
||||
|
||||
std::cerr << " Oops got norm "<< std::hexfloat<<value<<" expect "<<NormLogVector[NormLoggingCounter] <<std::endl;
|
||||
|
||||
fprintf(stderr,"%s:%d Oops, I did it again! Reproduce failure for norm %d/%zu %.16e expect %.16e\n",
|
||||
GridHostname(),
|
||||
GlobalSharedMemory::WorldShmRank,
|
||||
NormLoggingCounter,NormLogVector.size(),
|
||||
value, NormLogVector[NormLoggingCounter]); fflush(stderr);
|
||||
|
||||
if(!ContinueOnFail)assert(0); // Force takedown of job
|
||||
|
||||
ErrorCounter++;
|
||||
} else {
|
||||
if ( PrintEntireLog ) {
|
||||
std::cerr<<"FlightRecorder::NormLog VALID "<< NormLoggingCounter << std::hex
|
||||
<<" "<<hex<<" "<<hexref
|
||||
<<" "<<std::hexfloat<<value<<" "<< NormLogVector[NormLoggingCounter]<<std::dec<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if ( NormLogVector.size()==NormLoggingCounter ) {
|
||||
std::cout << "FlightRecorder:: Verified entire sequence of "<<NormLoggingCounter<<" norms "<<std::endl;
|
||||
}
|
||||
NormLoggingCounter++;
|
||||
}
|
||||
}
|
||||
void FlightRecorder::CsumLog(uint64_t hex)
|
||||
{
|
||||
if(LoggingMode == LoggingModePrint) {
|
||||
std::cerr<<"FlightRecorder::CsumLog : "<< CsumLoggingCounter <<" "<<std::hex<< hex<<std::dec <<std::endl;
|
||||
CsumLoggingCounter++;
|
||||
}
|
||||
|
||||
if(LoggingMode == LoggingModeRecord) {
|
||||
std::cerr<<"FlightRecorder::CsumLog RECORDING : "<< NormLoggingCounter <<" "<<std::hex<< hex<<std::dec <<std::endl;
|
||||
CsumLogVector.push_back(hex);
|
||||
CsumLoggingCounter++;
|
||||
}
|
||||
|
||||
if(LoggingMode == LoggingModeVerify) {
|
||||
|
||||
if(CsumLoggingCounter < CsumLogVector.size()) {
|
||||
|
||||
uint64_t hexref = CsumLogVector[CsumLoggingCounter] ;
|
||||
|
||||
if ( hex != hexref ) {
|
||||
|
||||
std::cerr<<"FlightRecorder::CsumLog Oops, I did it again "<< CsumLoggingCounter
|
||||
<<std::hex<<" "<<hex<<" "<<hexref<<std::dec<<std::endl;
|
||||
|
||||
fprintf(stderr,"%s:%d Oops, I did it again! Reproduce failure for csum %d %lx expect %lx\n",
|
||||
GridHostname(),
|
||||
GlobalSharedMemory::WorldShmRank,
|
||||
CsumLoggingCounter,hex, hexref);
|
||||
fflush(stderr);
|
||||
|
||||
if(!ContinueOnFail) assert(0); // Force takedown of job
|
||||
|
||||
ErrorCounter++;
|
||||
|
||||
} else {
|
||||
|
||||
if ( PrintEntireLog ) {
|
||||
std::cerr<<"FlightRecorder::CsumLog VALID "<< CsumLoggingCounter << std::hex
|
||||
<<" "<<hex<<" "<<hexref<<std::dec<<std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( CsumLogVector.size()==CsumLoggingCounter ) {
|
||||
std::cout << "FlightRecorder:: Verified entire sequence of "<<CsumLoggingCounter<<" checksums "<<std::endl;
|
||||
}
|
||||
CsumLoggingCounter++;
|
||||
}
|
||||
}
|
||||
void FlightRecorder::ReductionLog(double local,double global)
|
||||
{
|
||||
uint64_t hex_l = * ( (uint64_t *)&local );
|
||||
uint64_t hex_g = * ( (uint64_t *)&global );
|
||||
if(LoggingMode == LoggingModePrint) {
|
||||
std::cerr<<"FlightRecorder::ReductionLog : "<< ReductionLoggingCounter <<" "<< std::hex << hex_l << " -> " <<hex_g<<std::dec <<std::endl;
|
||||
ReductionLoggingCounter++;
|
||||
}
|
||||
if(LoggingMode == LoggingModeRecord) {
|
||||
std::cerr<<"FlightRecorder::ReductionLog RECORDING : "<< ReductionLoggingCounter <<" "<< std::hex << hex_l << " -> " <<hex_g<<std::dec <<std::endl;
|
||||
ReductionLogVector.push_back(global);
|
||||
ReductionLoggingCounter++;
|
||||
}
|
||||
if(LoggingMode == LoggingModeVerify) {
|
||||
if(ReductionLoggingCounter < ReductionLogVector.size()){
|
||||
if ( global != ReductionLogVector[ReductionLoggingCounter] ) {
|
||||
fprintf(stderr,"%s:%d Oops, MPI_Allreduce did it again! Reproduce failure for norm %d/%zu glb %.16e lcl %.16e expect glb %.16e\n",
|
||||
GridHostname(),
|
||||
GlobalSharedMemory::WorldShmRank,
|
||||
ReductionLoggingCounter,ReductionLogVector.size(),
|
||||
global, local, ReductionLogVector[ReductionLoggingCounter]); fflush(stderr);
|
||||
|
||||
if ( !ContinueOnFail ) assert(0);
|
||||
|
||||
ErrorCounter++;
|
||||
} else {
|
||||
if ( PrintEntireLog ) {
|
||||
std::cerr<<"FlightRecorder::ReductionLog : VALID "<< ReductionLoggingCounter <<" "<< std::hexfloat << local << "-> "<< global <<std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( ReductionLogVector.size()==ReductionLoggingCounter ) {
|
||||
std::cout << "FlightRecorder::ReductionLog : Verified entire sequence of "<<ReductionLoggingCounter<<" norms "<<std::endl;
|
||||
}
|
||||
ReductionLoggingCounter++;
|
||||
}
|
||||
}
|
||||
void FlightRecorder::xmitLog(void *buf,uint64_t bytes)
|
||||
{
|
||||
if ( ChecksumCommsSend ){
|
||||
uint64_t *ubuf = (uint64_t *)buf;
|
||||
if(LoggingMode == LoggingModeNone) return;
|
||||
#ifdef GRID_SYCL
|
||||
uint64_t _xor = svm_xor(ubuf,bytes/sizeof(uint64_t));
|
||||
if(LoggingMode == LoggingModePrint) {
|
||||
std::cerr<<"FlightRecorder::xmitLog : "<< XmitLoggingCounter <<" "<< std::hex << _xor <<std::dec <<std::endl;
|
||||
XmitLoggingCounter++;
|
||||
}
|
||||
if(LoggingMode == LoggingModeRecord) {
|
||||
std::cerr<<"FlightRecorder::xmitLog RECORD : "<< XmitLoggingCounter <<" "<< std::hex << _xor <<std::dec <<std::endl;
|
||||
XmitLogVector.push_back(_xor);
|
||||
XmitLoggingCounter++;
|
||||
}
|
||||
if(LoggingMode == LoggingModeVerify) {
|
||||
if(XmitLoggingCounter < XmitLogVector.size()){
|
||||
if ( _xor != XmitLogVector[XmitLoggingCounter] ) {
|
||||
fprintf(stderr,"%s:%d Oops, send buf difference! Reproduce failure for xmit %d/%zu %lx expect glb %lx\n",
|
||||
GridHostname(),
|
||||
GlobalSharedMemory::WorldShmRank,
|
||||
XmitLoggingCounter,XmitLogVector.size(),
|
||||
_xor, XmitLogVector[XmitLoggingCounter]); fflush(stderr);
|
||||
|
||||
if ( !ContinueOnFail ) assert(0);
|
||||
|
||||
ErrorCounter++;
|
||||
} else {
|
||||
if ( PrintEntireLog ) {
|
||||
std::cerr<<"FlightRecorder::XmitLog : VALID "<< XmitLoggingCounter <<" "<< std::hexfloat << _xor << " "<< XmitLogVector[XmitLoggingCounter] <<std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( XmitLogVector.size()==XmitLoggingCounter ) {
|
||||
std::cout << "FlightRecorder::ReductionLog : Verified entire sequence of "<<XmitLoggingCounter<<" sends "<<std::endl;
|
||||
}
|
||||
XmitLoggingCounter++;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
uint64_t word = 1;
|
||||
deviceVector<uint64_t> dev(1);
|
||||
acceleratorCopyToDevice(&word,&dev[0],sizeof(uint64_t));
|
||||
acceleratorCopySynchronise();
|
||||
MPI_Barrier(MPI_COMM_WORLD);
|
||||
}
|
||||
}
|
||||
void FlightRecorder::recvLog(void *buf,uint64_t bytes,int rank)
|
||||
{
|
||||
if ( ChecksumComms ){
|
||||
uint64_t *ubuf = (uint64_t *)buf;
|
||||
if(LoggingMode == LoggingModeNone) return;
|
||||
#ifdef GRID_SYCL
|
||||
uint64_t _xor = svm_xor(ubuf,bytes/sizeof(uint64_t));
|
||||
if(LoggingMode == LoggingModePrint) {
|
||||
std::cerr<<"FlightRecorder::recvLog : "<< RecvLoggingCounter <<" "<< std::hex << _xor <<std::dec <<std::endl;
|
||||
RecvLoggingCounter++;
|
||||
}
|
||||
if(LoggingMode == LoggingModeRecord) {
|
||||
std::cerr<<"FlightRecorder::recvLog RECORD : "<< RecvLoggingCounter <<" "<< std::hex << _xor <<std::dec <<std::endl;
|
||||
RecvLogVector.push_back(_xor);
|
||||
RecvLoggingCounter++;
|
||||
}
|
||||
if(LoggingMode == LoggingModeVerify) {
|
||||
if(RecvLoggingCounter < RecvLogVector.size()){
|
||||
if ( _xor != RecvLogVector[RecvLoggingCounter] ) {
|
||||
fprintf(stderr,"%s:%d Oops, recv buf difference! Reproduce failure for recv %d/%zu %lx expect glb %lx from MPI rank %d\n",
|
||||
GridHostname(),
|
||||
GlobalSharedMemory::WorldShmRank,
|
||||
RecvLoggingCounter,RecvLogVector.size(),
|
||||
_xor, RecvLogVector[RecvLoggingCounter],rank); fflush(stderr);
|
||||
|
||||
if ( !ContinueOnFail ) assert(0);
|
||||
|
||||
ErrorCounter++;
|
||||
} else {
|
||||
if ( PrintEntireLog ) {
|
||||
std::cerr<<"FlightRecorder::RecvLog : VALID "<< RecvLoggingCounter <<" "<< std::hexfloat << _xor << " "<< RecvLogVector[RecvLoggingCounter] <<std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( RecvLogVector.size()==RecvLoggingCounter ) {
|
||||
std::cout << "FlightRecorder::ReductionLog : Verified entire sequence of "<<RecvLoggingCounter<<" sends "<<std::endl;
|
||||
}
|
||||
RecvLoggingCounter++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
NAMESPACE_END(Grid);
|
43
Grid/util/FlightRecorder.h
Normal file
43
Grid/util/FlightRecorder.h
Normal file
@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
NAMESPACE_BEGIN(Grid);
|
||||
class FlightRecorder {
|
||||
public:
|
||||
enum LoggingMode_t {
|
||||
LoggingModeNone,
|
||||
LoggingModePrint,
|
||||
LoggingModeRecord,
|
||||
LoggingModeVerify
|
||||
};
|
||||
|
||||
static int LoggingMode;
|
||||
static uint64_t ErrorCounter;
|
||||
static int32_t XmitLoggingCounter;
|
||||
static int32_t RecvLoggingCounter;
|
||||
static int32_t CsumLoggingCounter;
|
||||
static int32_t NormLoggingCounter;
|
||||
static int32_t ReductionLoggingCounter;
|
||||
static std::vector<uint64_t> XmitLogVector;
|
||||
static std::vector<uint64_t> RecvLogVector;
|
||||
static std::vector<uint64_t> CsumLogVector;
|
||||
static std::vector<double> NormLogVector;
|
||||
static std::vector<double> ReductionLogVector;
|
||||
static int ContinueOnFail;
|
||||
static int PrintEntireLog;
|
||||
static int ChecksumComms;
|
||||
static int ChecksumCommsSend;
|
||||
static void SetLoggingModePrint(void);
|
||||
static void SetLoggingModeRecord(void);
|
||||
static void SetLoggingModeVerify(void);
|
||||
static void SetLoggingMode(LoggingMode_t mode);
|
||||
static void NormLog(double value);
|
||||
static void CsumLog(uint64_t csum);
|
||||
static void ReductionLog(double lcl, double glbl);
|
||||
static void Truncate(void);
|
||||
static void ResetCounters(void);
|
||||
static uint64_t ErrorCount(void);
|
||||
static void xmitLog(void *,uint64_t bytes);
|
||||
static void recvLog(void *,uint64_t bytes,int rank);
|
||||
};
|
||||
NAMESPACE_END(Grid);
|
||||
|
@ -77,6 +77,10 @@ feenableexcept (unsigned int excepts)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HOST_NAME_MAX
|
||||
#define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
|
||||
#endif
|
||||
|
||||
NAMESPACE_BEGIN(Grid);
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
@ -90,7 +94,12 @@ int GridThread::_threads =1;
|
||||
int GridThread::_hyperthreads=1;
|
||||
int GridThread::_cores=1;
|
||||
|
||||
char hostname[HOST_NAME_MAX+1];
|
||||
|
||||
char *GridHostname(void)
|
||||
{
|
||||
return hostname;
|
||||
}
|
||||
const Coordinate &GridDefaultLatt(void) {return Grid_default_latt;};
|
||||
const Coordinate &GridDefaultMpi(void) {return Grid_default_mpi;};
|
||||
const Coordinate GridDefaultSimd(int dims,int nsimd)
|
||||
@ -394,7 +403,6 @@ void Grid_init(int *argc,char ***argv)
|
||||
std::cout << GridLogMessage << "MPI is initialised and logging filters activated "<<std::endl;
|
||||
std::cout << GridLogMessage << "================================================ "<<std::endl;
|
||||
|
||||
char hostname[HOST_NAME_MAX+1];
|
||||
gethostname(hostname, HOST_NAME_MAX+1);
|
||||
std::cout << GridLogMessage << "This rank is running on host "<< hostname<<std::endl;
|
||||
|
||||
|
@ -34,6 +34,8 @@ NAMESPACE_BEGIN(Grid);
|
||||
void Grid_init(int *argc,char ***argv);
|
||||
void Grid_finalize(void);
|
||||
|
||||
char * GridHostname(void);
|
||||
|
||||
// internal, controled with --handle
|
||||
void Grid_sa_signal_handler(int sig,siginfo_t *si,void * ptr);
|
||||
void Grid_debug_handler_init(void);
|
||||
@ -68,5 +70,6 @@ void GridParseLayout(char **argv,int argc,
|
||||
void printHash(void);
|
||||
|
||||
|
||||
|
||||
NAMESPACE_END(Grid);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#ifndef GRID_UTIL_H
|
||||
#define GRID_UTIL_H
|
||||
#pragma once
|
||||
#include <Grid/util/Coordinate.h>
|
||||
#include <Grid/util/Lexicographic.h>
|
||||
#include <Grid/util/Init.h>
|
||||
#endif
|
||||
#include <Grid/util/FlightRecorder.h>
|
||||
|
||||
|
Reference in New Issue
Block a user