From b082a6b9acb82de9a0b9ebd76bb501f49cca6a96 Mon Sep 17 00:00:00 2001 From: John Romein <romein@astron.nl> Date: Thu, 18 Dec 2008 16:20:32 +0000 Subject: [PATCH] bug 225: Other way of determining PSet dimensions. --- RTCP/CNProc/src/CN_Processing_main.cc | 8 +------ RTCP/FCNP/src/fcnp_cn.cc | 34 ++++++++++++++++++++------- RTCP/FCNP/src/fcnp_cn.h | 3 +-- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/RTCP/CNProc/src/CN_Processing_main.cc b/RTCP/CNProc/src/CN_Processing_main.cc index e1ab943f9d0..592234a78df 100644 --- a/RTCP/CNProc/src/CN_Processing_main.cc +++ b/RTCP/CNProc/src/CN_Processing_main.cc @@ -102,13 +102,7 @@ int main(int argc, char **argv) #if defined HAVE_ZOID && defined HAVE_BGL ionStream = new ZoidClientStream; #elif 1 && defined HAVE_FCNP && defined HAVE_BGP - std::vector<unsigned> psetDimensions(3); - - psetDimensions[0] = 4; - psetDimensions[1] = 2; - psetDimensions[2] = 2; - - FCNP_CN::init(psetDimensions); + FCNP_CN::init(); ionStream = new FCNP_ClientStream; #elif 0 ionStream = new NullStream; diff --git a/RTCP/FCNP/src/fcnp_cn.cc b/RTCP/FCNP/src/fcnp_cn.cc index ef2040c5a3c..42cf92c5e80 100644 --- a/RTCP/FCNP/src/fcnp_cn.cc +++ b/RTCP/FCNP/src/fcnp_cn.cc @@ -402,21 +402,37 @@ static void initHeaders() } -static void getConfiguration(const std::vector<unsigned> &psetDimensions) +static void getConfiguration() { unsigned xPos = personality.Network_Config.Xcoord; unsigned yPos = personality.Network_Config.Ycoord; unsigned zPos = personality.Network_Config.Zcoord; - assert(psetDimensions.size() == 3); - + unsigned xPsetSize, yPsetSize, zPsetSize; unsigned psetSize = personality.Network_Config.PSetSize; - unsigned xPsetSize = psetDimensions[0]; - unsigned yPsetSize = psetDimensions[1]; - unsigned zPsetSize = psetDimensions[2]; + switch (psetSize) { + case 16 : xPsetSize = 4, yPsetSize = 2, zPsetSize = 2; + break; + + case 32 : xPsetSize = 4, yPsetSize = 4, zPsetSize = 2; + break; + + case 64 : xPsetSize = 4, yPsetSize = 4, zPsetSize = 4; + break; + + case 128 : xPsetSize = 4, yPsetSize = 4, zPsetSize = 8; + break; - assert(xPsetSize * yPsetSize * zPsetSize == psetSize); + case 256 : xPsetSize = 8, yPsetSize = 4, zPsetSize = 8; + break; + + case 512 : xPsetSize = 8, yPsetSize = 8, zPsetSize = 8; + break; + + default : std::cerr << "FCNP: cannot determine PSet dimensions" << std::endl; + exit(1); + } unsigned xPsetPos = xPos % xPsetSize; unsigned yPsetPos = yPos % yPsetSize; @@ -487,11 +503,11 @@ static void drainFIFO() } -void init(const std::vector<unsigned> &psetDimensions) +void init() { getPersonality(); openShm(); - getConfiguration(psetDimensions); + getConfiguration(); initHeaders(); allocateMutexes(); drainFIFO(); diff --git a/RTCP/FCNP/src/fcnp_cn.h b/RTCP/FCNP/src/fcnp_cn.h index c564911e4ad..01cb2ae5dd0 100644 --- a/RTCP/FCNP/src/fcnp_cn.h +++ b/RTCP/FCNP/src/fcnp_cn.h @@ -7,8 +7,7 @@ namespace FCNP_CN { - // /proc/personality.sh gives wrong BG_PSETSIZE; provide dimensions manually - void init(const std::vector<unsigned> &psetDimensions); + void init(); // ptr and size must be a multiple of 16! void CNtoION_ZeroCopy(const void *ptr, size_t size); -- GitLab