Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Mareframe
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[mareframe] Annotation of /trunk/paramin-beta/netcommunication.h
[mareframe] / trunk / paramin-beta / netcommunication.h Repository:
ViewVC logotype

Annotation of /trunk/paramin-beta/netcommunication.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : agomez 1 #ifndef netcommunication_h
2 :     #define netcommunication_h
3 :    
4 :     #include "paramin.h"
5 :     #include "mpi.h"
6 :    
7 :     #include "netdata.h"
8 :     #include "pvmconstants.h"
9 :     #include "doublevector.h"
10 :     #include "commandlineinfo.h"
11 :     #include "parametervector.h"
12 :    
13 :     // AJ, 26.02.99
14 :     /**
15 :     * \class NetCommunication
16 :     * \brief The class NetCommunication provides functions for a master process to handle netcommunication with its slave processes using Parallell Virtual Machine(PVM) for actual communication. To successfully start netcommunication with a group of processes, pvmd must have been started on all hosts participating in PVM.NetCommunication includes functions to enroll in PVM providing pvmd is running on all machines participating in PVM, spawning new processes and halting running processes. Maximum number of hosts which can participate in pvm is equal to MAXHOSTS. It also includes functions to send data of type NetDataVariables and CharPtrVector to a spawned process and receiving data of type NetDataResult from a spawned process. functions which return information about the status of netcommunication
17 :     */
18 :    
19 :     class NetCommunication {
20 :     private:
21 :     int convergedSA;
22 :     int convergedHJ;
23 :     int convergedBFGS;
24 :     double likelihoodSA;
25 :     double likelihoodHJ;
26 :     double likelihoodBFGS;
27 :     protected:
28 :     PVMConstants* pvmConst;
29 :     int nHostInn;
30 :     // pvm variables, used to start PVM and spawn processes on hosts
31 :     /**
32 :     * \brief tid of master process (me)
33 :     */
34 :     int mytid;
35 :     /**
36 :     * \brief number of different architectures taking part in VM.
37 :     */
38 :     int narch;
39 :     int nhost;
40 :     int numarg;
41 :     int* tids;
42 :     int* status;
43 :     /**
44 :     * \brief array that contains information about each host
45 :     */
46 :     struct pvmhostinfo *hostp;
47 :     /**
48 :     * \brief array that contains information about each task
49 :     */
50 :     struct pvmtaskinfo *taskp;
51 :     /**
52 :     * \brief number of variables in x in netDatavariables
53 :     */
54 :     int numVar;
55 :     /**
56 :     * \brief number of processes started
57 :     */
58 :     int numProcesses;
59 :     /**
60 :     * \brief number of running processes
61 :     */
62 :     int numGoodProcesses;
63 :     /**
64 :     * \brief name of program which will be started on slaves
65 :     */
66 :     char* slaveProgram;
67 :     /**
68 :     * \brief arguments for slaveProgram
69 :     */
70 :     char** slaveArguments;
71 :    
72 :     int NETSTARTED;
73 :     int ERROR;
74 :     int SUCCESS;
75 :    
76 :     int* hostTids;
77 :     int* dataIDs;
78 :    
79 :     public:
80 :     // this should be changed to use commandline...
81 :     MPI_Comm intercomm;
82 :     NetCommunication(const CharPtrVector& funcNameArgs, int nh);
83 :     virtual ~NetCommunication();
84 :     int maxNumHosts;
85 :     int startPVM();
86 :     int startProcesses();
87 :     int sendInitialMessage(int id);
88 :     int startNetCommunication();
89 :     void stopNetCommunication();
90 :     int checkProcess(int id);
91 :     void checkProcesses();
92 :     void getHealthOfProcesses(int* procTids);
93 :     int sendData(NetDataVariables* sendP, int processID);
94 :     virtual int receiveData(NetDataResult* rp);
95 :     void setNumInSendVar(int nVar);
96 :     int getNumHosts();
97 :     int getNumVar();
98 :     int getNumProcesses();
99 :     int getNumRunningProcesses();
100 :     void printErrorMsg(const char* errorMsg);
101 :     int netCommStarted();
102 :     int netError();
103 :     int netSuccess();
104 :     void setConvergedSA(int set) { convergedSA = set; };
105 :     int getConvergedSA() { return convergedSA; };
106 :     double getLikelihoodSA() const { return likelihoodSA; };
107 :     void setLikelihoodSA(double set) { likelihoodSA = set; };
108 :     void setConvergedBFGS(int set) { convergedBFGS = set; };
109 :     int getConvergedBFGS() { return convergedBFGS; };
110 :     double getLikelihoodBFGS() const { return likelihoodBFGS; };
111 :     void setLikelihoodBFGS(double set) { likelihoodBFGS = set; };
112 :     void setConvergedHJ(int set) { convergedHJ = set; };
113 :     int getConvergedHJ() { return convergedHJ; };
114 :     double getLikelihoodHJ() const { return likelihoodHJ; };
115 :     void setLikelihoodHJ(double set) { likelihoodHJ = set; };
116 :    
117 :     int sendData(const ParameterVector& sendP);
118 :     int sendData(const ParameterVector& sendP, int processID);
119 :     int sendBoundData(const DoubleVector& sendP);
120 :     int sendBoundData(const DoubleVector& sendP, int processID);
121 :    
122 :     };
123 :    
124 :     /**
125 :     * \class MasterCommunication
126 :     * \brief The class MasterCommunication is a derived class of NetCommunication. The only difference between NetCommunication and MasterCommunication is that when MasterCommunication receives messages it will wait for a message for a specified time but NetCommunication will wait forever
127 :     */
128 :    
129 :     class MasterCommunication : public NetCommunication {
130 :     private:
131 :     struct timeval* tmout;
132 :     public:
133 :     MasterCommunication(CommandLineInfo* info);
134 :     virtual ~MasterCommunication();
135 :     virtual int receiveData(NetDataResult* rp);
136 :     };
137 :    
138 :     #endif

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge