Skip to content
Snippets Groups Projects
Commit ff34d153 authored by schaaf's avatar schaaf
Browse files

This commit was generated by cvs2svn to compensate for changes in r3205,

which included commits to RCS files with non-trunk default branches.
parent e8cd80a1
Branches
Tags
No related merge requests found
// DFTServer.cc: DFT server application for use in combination with
// BBS2 application.
//
// Copyright (C) 2000-2002
// ASTRON (Netherlands Foundation for Research in Astronomy)
// P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
//
// 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// $Id$
//
/////////////////////////////////////////////////////////////////////////
#include <lofar_config.h>
#include <DFTServer.h>
#include <ACC/ParameterSet.h>
#include <Common/KeyValueMap.h>
#include <Common/lofar_iostream.h>
#include <Transport/TH_Mem.h>
#include <CEPFrame/Step.h>
#include <CEPFrame/Composite.h>
#include <CEPFrame/WH_Example.h>
#include <CEPFrame/Profiler.h>
#include <WH_DFTServer.h>
using namespace LOFAR;
DFTServer::~DFTServer()
{}
void DFTServer::define (const KeyValueMap& params)
{
// create and initialise the parameter object.
const ParameterSet myPS("params.ps");
// WH_SimStation* myWHStations[myPS.getInt("general.nstations")];
// define the top-level composite object;
// this is the holder for the actual DFTServer Step.
WH_Empty myWHEmpty("DFTServer");
Composite toplevelcomp(myWHEmpty);
setComposite (toplevelcomp);
toplevelcomp.runOnNode(0,0); // tell the Composite where to run
LOG_TRACE_FLOW_STR("Now start filling the simulation.toplevel composite");
WH_DFTServer whserver("DFTServer");
Step Serverstep(whserver);
comp.addStep(composite2); // Add the step to the toplevel composite
LOG_TRACE_FLOW_STR("Connect the DFTServer to the external application");
/// The DFTServer_ClientStub.cc file is used to connect to
/// the DataHolders in the Client application.
DFTServer_ClientStub myClientStub;
ServerStep->getOutData(0).connectTo(myClientStub.itsInDH, myClientStub->itsTHProtoOut);
myClientStub.itsOutDH->connectTo(ServerStep->getInData(0), myClientStub->itsTHProtoIn);
//////////////////////////////////////////////////////////////////////
//
// Finished configuration definition
//
//////////////////////////////////////////////////////////////////////
}
void DFTServer::run (int nsteps)
{
if (nsteps < 0) {
nsteps = 10;
}
TRACER2("Ready with definition of configuration");
Profiler::init();
cout << endl << "Start Process" << endl;
for (int i=0; i<nsteps; i++) {
if (i==2) Profiler::activate();
getComposite().process();
if (i==5) Profiler::deActivate();
}
}
void DFTServer::dump() const
{
cout << endl << "DUMP Data from last Processing step: " << endl;
getComposite().dump();
}
void DFTServer::quit()
{
}
}
// DFTServer.h: DFT server application for use in combination with
// BBS2 application.
//
// Copyright (C) 2000, 2001
// ASTRON (Netherlands Foundation for Research in Astronomy)
// P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
//
// 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// $Id$
//
//
//////////////////////////////////////////////////////////////////////////
#ifndef CEPFRAME_SIMULATOR_EXAMPLE_H
#define CEPFRAME_SIMULATOR_EXAMPLE_H
#include <lofar_config.h>
#include <CEPFrame/ApplicationHolder.h>
/***
The DFTServer application is used in combination with the BBS2
application. The DFT calculation formerly being integrated in the
MNS object tree is now calculated uin the separate application. The
main reasons to do so are to
- allow for low-level MPI commands within this application
(independent of the application containing the MNS objects)
- allow for independent control of the DFT calculation tasks. This
feature is especially interesting for deployment of thuis task on an
external fast computer or GPU.
***/
class DFTServer: public LOFAR::ApplicationHolder
{
public:
virtual ~DFTServer();
virtual void define (const LOFAR::KeyValueMap&);
virtual void run (int nsteps);
virtual void dump() const;
virtual void quit();
};
#endif
#include <PSS3/DH_InDFT.h>
#include <PSS3/DH_OutDFT.h>
#include <Transport/TH_Socket.h>
class DFTServer_ClientStub()
{
DFTServer() {};
~DFTServer() {};
private:
DH_InDFT itsInDH(); //todo: need to set ID...
DH_OutDFT itsOutDH(); //todo: need to set ID...
TH_Socket itsTHProto();
bool itsSynchronisity;
}
// MainProgram.cc: Main loop for the DFTServer ApplicationHolder
//
// Copyright (C) 2000-2002
// ASTRON (Netherlands Foundation for Research in Astronomy)
// P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
//
// 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// $Id$
//
/////////////////////////////////////////////////////////////////////////
#include <DFTServer/DFTServer.h>
#include <Common/lofar_iostream.h>
#include <Common/Debug.h>
#include <Common/LofarLogger.h>
using namespace LOFAR;
#ifdef HAVE_CORBA
int atexit(void (*function)(void))
{
return 1;
}
#endif
int main (int argc, const char** argv)
{
#ifdef HAVE_MPI
MPI_Init(&argc,(char***)&argv);
#endif
// Set trace level.
Debug::initLevels (argc, argv);
// Initialize the LOFAR logger
INIT_LOGGER("DFTServer.log_prop");
try {
DFTServer theApp;
theApp.setarg (argc, argv);
theApp.baseDefine();
theApp.baseRun(1);
theApp.baseDump();
theApp.baseQuit();
} catch (...) {
cout << "Unexpected exception" << endl;
}
}
#include <ACC/ParameterSet.h>
#include <PSS3/DH_InDFT.h>
#include <PSS3/DH_OutDFT.h>
#include <Transport/TH_Socket.h>
class DFTServer_ClientStub()
{
public:
DFTServer() {
const ParameterSet myPS("params.ps");
itsTHProtoIn = new TH_Socket(myPS.getString("DFTConnection.ServerHost"), // sendhost
myPS.getString("DFTConnection.ServerHost"), // recvhost
myPS.getString("DFTConnection.ServerPort") // port
);
itsTHProtoOut = new TH_Socket(myPS.getString("DFTConnection.ServerHost"), // sendhost
myPS.getString("DFTConnection.ServerHost"), // recvhost
myPS.getString("DFTConnection.ServerPort") // port
);
};
~DFTServer() {};
DH_InDFT itsInDH();
DH_OutDFT itsOutDH();
TH_Socket *itsTHProtoIn;
TH_Socket *itsTHProtoOut;
bool itsSynchronisity;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment