mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
Format
This commit is contained in:
parent
b45bd8e097
commit
8cb7a1a887
@ -1,4 +1,4 @@
|
|||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
@ -23,8 +23,8 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
|||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
See the full license in the file "LICENSE" in the top level distribution directory
|
See the full license in the file "LICENSE" in the top level distribution directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
#ifndef GRID_COMMUNICATOR_H
|
#ifndef GRID_COMMUNICATOR_H
|
||||||
#define GRID_COMMUNICATOR_H
|
#define GRID_COMMUNICATOR_H
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
@ -23,8 +23,8 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
|||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
See the full license in the file "LICENSE" in the top level distribution directory
|
See the full license in the file "LICENSE" in the top level distribution directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
#include <Grid/GridCore.h>
|
#include <Grid/GridCore.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
@ -24,8 +24,8 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
|||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
See the full license in the file "LICENSE" in the top level distribution directory
|
See the full license in the file "LICENSE" in the top level distribution directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
#ifndef GRID_COMMUNICATOR_BASE_H
|
#ifndef GRID_COMMUNICATOR_BASE_H
|
||||||
#define GRID_COMMUNICATOR_BASE_H
|
#define GRID_COMMUNICATOR_BASE_H
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ public:
|
|||||||
CartesianCommunicator(const std::vector<int> &pdimensions_in);
|
CartesianCommunicator(const std::vector<int> &pdimensions_in);
|
||||||
virtual ~CartesianCommunicator();
|
virtual ~CartesianCommunicator();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
// Private initialise from an MPI communicator
|
// Private initialise from an MPI communicator
|
||||||
@ -81,7 +81,7 @@ public:
|
|||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
void InitFromMPICommunicator(const std::vector<int> &processors, Grid_MPI_Comm communicator_base);
|
void InitFromMPICommunicator(const std::vector<int> &processors, Grid_MPI_Comm communicator_base);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Wraps MPI_Cart routines, or implements equivalent on other impls
|
// Wraps MPI_Cart routines, or implements equivalent on other impls
|
||||||
|
@ -23,8 +23,8 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
|||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
See the full license in the file "LICENSE" in the top level distribution directory
|
See the full license in the file "LICENSE" in the top level distribution directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
#include <Grid/GridCore.h>
|
#include <Grid/GridCore.h>
|
||||||
#include <Grid/communicator/SharedMemory.h>
|
#include <Grid/communicator/SharedMemory.h>
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
@ -23,8 +23,8 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
|||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
See the full license in the file "LICENSE" in the top level distribution directory
|
See the full license in the file "LICENSE" in the top level distribution directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
#include <Grid/GridCore.h>
|
#include <Grid/GridCore.h>
|
||||||
|
|
||||||
NAMESPACE_BEGIN(Grid);
|
NAMESPACE_BEGIN(Grid);
|
||||||
|
@ -48,15 +48,15 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
|||||||
NAMESPACE_BEGIN(Grid);
|
NAMESPACE_BEGIN(Grid);
|
||||||
|
|
||||||
#if defined (GRID_COMMS_MPI3)
|
#if defined (GRID_COMMS_MPI3)
|
||||||
typedef MPI_Comm Grid_MPI_Comm;
|
typedef MPI_Comm Grid_MPI_Comm;
|
||||||
typedef MPI_Request CommsRequest_t;
|
typedef MPI_Request CommsRequest_t;
|
||||||
#else
|
#else
|
||||||
typedef int CommsRequest_t;
|
typedef int CommsRequest_t;
|
||||||
typedef int Grid_MPI_Comm;
|
typedef int Grid_MPI_Comm;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class GlobalSharedMemory {
|
class GlobalSharedMemory {
|
||||||
private:
|
private:
|
||||||
static const int MAXLOG2RANKSPERNODE = 16;
|
static const int MAXLOG2RANKSPERNODE = 16;
|
||||||
|
|
||||||
// Init once lock on the buffer allocation
|
// Init once lock on the buffer allocation
|
||||||
@ -64,7 +64,7 @@ class GlobalSharedMemory {
|
|||||||
static int _ShmAlloc;
|
static int _ShmAlloc;
|
||||||
static uint64_t _ShmAllocBytes;
|
static uint64_t _ShmAllocBytes;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static int ShmSetup(void) { return _ShmSetup; }
|
static int ShmSetup(void) { return _ShmSetup; }
|
||||||
static int ShmAlloc(void) { return _ShmAlloc; }
|
static int ShmAlloc(void) { return _ShmAlloc; }
|
||||||
static uint64_t ShmAllocBytes(void) { return _ShmAllocBytes; }
|
static uint64_t ShmAllocBytes(void) { return _ShmAllocBytes; }
|
||||||
@ -104,14 +104,14 @@ class GlobalSharedMemory {
|
|||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
class SharedMemory
|
class SharedMemory
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static const int MAXLOG2RANKSPERNODE = 16;
|
static const int MAXLOG2RANKSPERNODE = 16;
|
||||||
|
|
||||||
size_t heap_top;
|
size_t heap_top;
|
||||||
size_t heap_bytes;
|
size_t heap_bytes;
|
||||||
size_t heap_size;
|
size_t heap_size;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Grid_MPI_Comm ShmComm; // for barriers
|
Grid_MPI_Comm ShmComm; // for barriers
|
||||||
int ShmRank;
|
int ShmRank;
|
||||||
@ -119,7 +119,7 @@ class SharedMemory
|
|||||||
std::vector<void *> ShmCommBufs;
|
std::vector<void *> ShmCommBufs;
|
||||||
std::vector<int> ShmRanks;// Mapping comm ranks to Shm ranks
|
std::vector<int> ShmRanks;// Mapping comm ranks to Shm ranks
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SharedMemory() {};
|
SharedMemory() {};
|
||||||
///////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////
|
||||||
// set the buffers & sizes
|
// set the buffers & sizes
|
||||||
|
@ -292,10 +292,10 @@ void GlobalSharedMemory::SharedMemoryAllocate(uint64_t bytes, int flags)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
// Global shared functionality finished
|
// Global shared functionality finished
|
||||||
// Now move to per communicator functionality
|
// Now move to per communicator functionality
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
void SharedMemory::SetCommunicator(Grid_MPI_Comm comm)
|
void SharedMemory::SetCommunicator(Grid_MPI_Comm comm)
|
||||||
{
|
{
|
||||||
int rank, size;
|
int rank, size;
|
||||||
|
@ -84,10 +84,10 @@ void GlobalSharedMemory::SharedMemoryAllocate(uint64_t bytes, int flags)
|
|||||||
_ShmAlloc=1;
|
_ShmAlloc=1;
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
// Global shared functionality finished
|
// Global shared functionality finished
|
||||||
// Now move to per communicator functionality
|
// Now move to per communicator functionality
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
void SharedMemory::SetCommunicator(Grid_MPI_Comm comm)
|
void SharedMemory::SetCommunicator(Grid_MPI_Comm comm)
|
||||||
{
|
{
|
||||||
assert(GlobalSharedMemory::ShmAlloc()==1);
|
assert(GlobalSharedMemory::ShmAlloc()==1);
|
||||||
|
Loading…
Reference in New Issue
Block a user