2018-01-13 00:17:16 +00:00
|
|
|
/*************************************************************************************
|
2016-10-24 17:30:43 +01:00
|
|
|
|
|
|
|
Grid physics library, www.github.com/paboyle/Grid
|
|
|
|
|
|
|
|
Source file: ./lib/communicator/Communicator_none.cc
|
|
|
|
|
|
|
|
Copyright (C) 2015
|
|
|
|
|
|
|
|
Author: Peter Boyle <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
|
2018-01-13 00:17:16 +00:00
|
|
|
*************************************************************************************/
|
|
|
|
/* END LEGAL */
|
2017-02-22 18:09:33 +00:00
|
|
|
#include <Grid/GridCore.h>
|
2017-08-19 17:53:18 +01:00
|
|
|
#include <fcntl.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <limits.h>
|
|
|
|
#include <sys/mman.h>
|
2017-02-22 18:09:33 +00:00
|
|
|
|
2018-01-13 00:16:34 +00:00
|
|
|
NAMESPACE_BEGIN(Grid);
|
2016-10-24 17:30:43 +01:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////
|
|
|
|
// Info that is setup once and indept of cartesian layout
|
|
|
|
///////////////////////////////////////////////////////////////
|
2017-07-29 18:06:53 +01:00
|
|
|
CartesianCommunicator::CommunicatorPolicy_t
|
|
|
|
CartesianCommunicator::CommunicatorPolicy= CartesianCommunicator::CommunicatorPolicyConcurrent;
|
|
|
|
int CartesianCommunicator::nCommThreads = -1;
|
2016-10-24 17:30:43 +01:00
|
|
|
|
|
|
|
/////////////////////////////////
|
|
|
|
// Grid information queries
|
|
|
|
/////////////////////////////////
|
2017-06-22 08:14:34 +01:00
|
|
|
int CartesianCommunicator::Dimensions(void) { return _ndimension; };
|
2016-10-24 17:30:43 +01:00
|
|
|
int CartesianCommunicator::IsBoss(void) { return _processor==0; };
|
|
|
|
int CartesianCommunicator::BossRank(void) { return 0; };
|
|
|
|
int CartesianCommunicator::ThisRank(void) { return _processor; };
|
2018-02-24 22:23:18 +00:00
|
|
|
const Coordinate & CartesianCommunicator::ThisProcessorCoor(void) { return _processor_coor; };
|
|
|
|
const Coordinate & CartesianCommunicator::ProcessorGrid(void) { return _processors; };
|
2016-10-24 17:30:43 +01:00
|
|
|
int CartesianCommunicator::ProcessorCount(void) { return _Nprocessors; };
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// very VERY rarely (Log, serial RNG) we need world without a grid
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
void CartesianCommunicator::GlobalSum(ComplexF &c)
|
|
|
|
{
|
|
|
|
GlobalSumVector((float *)&c,2);
|
|
|
|
}
|
|
|
|
void CartesianCommunicator::GlobalSumVector(ComplexF *c,int N)
|
|
|
|
{
|
|
|
|
GlobalSumVector((float *)c,2*N);
|
|
|
|
}
|
|
|
|
void CartesianCommunicator::GlobalSum(ComplexD &c)
|
|
|
|
{
|
|
|
|
GlobalSumVector((double *)&c,2);
|
|
|
|
}
|
|
|
|
void CartesianCommunicator::GlobalSumVector(ComplexD *c,int N)
|
|
|
|
{
|
|
|
|
GlobalSumVector((double *)c,2*N);
|
|
|
|
}
|
|
|
|
|
2018-01-13 00:16:34 +00:00
|
|
|
NAMESPACE_END(Grid);
|
|
|
|
|
2016-10-24 17:30:43 +01:00
|
|
|
|