📄 otherdaemoncomm.h
字号:
/** @file otherdaemoncomm.h defines the communication routine between daemons */#ifndef OTHERDAEMONCOMM_H#define OTHERDAEMONCOMM_H#include "config.h"#include "debug.h"#include "flitvec.h"#include "simple_list.h"#include "connect.h"/** list of message to send or being received for one peer */typedef struct Communication{ LinkedList_t tosend; /**< message to send */ flitvec *toreceive; /**< message being recieved */} Communication;/** get pending messages list * @return pending list */LinkedList_t * getpending();/** set pending tag to none */void clearpendingtag();/** local mpi process declare waiting message of tag 'tag' * @param tag : tag of the awaited message * @return 0 */void newpendingtag(int tag);/** find in pnd_msg, the message using the comparison function f, and * the key k * @param f: comparison function * @param k: key * @return the first message m such that f(m, k), NULL if not found */pkt_header *find_pending(int (*f)(void*, void *), void *k);/** * @param tag : tag of messages probed * @return * - 1 if message in pnd_mesgs * - 0 if message not in pnd_mesgs */int probing_pnd_mesgs(int tag);/** checks if we are waiting for a tag * @param tag: tag which I wonder if I'm waiting for * @return: 0 iff not waiting for any tag or waiting for another */int waiting_for_tag(int tag);/** adds a message (pkt_header followed by its data) to the list of pending messages * @param pkt: the message to add */void pending_add(pkt_header *pkt);/** show messages in pending */void debugpndpkt();/** initialize a Communication structure * @param nbproc : number of mpiprocess * @return void */void initCommunication(int nbproc);/** add peer socket to writeset if something to send to this peer * no need to compute the max socket desc for select mask here as all desc are already added to readset * @param writeset : fd_set of socket to write into * @param mpipeer : socket information for all peer * @return max fd includes in writeset */int inline getpeerfdsets(fd_set * writeset, SockInfo * mpipeer, int max);/** add a new flitvec to send. * @param fv: the flitvec * prerequisite: the flit0 of fv holds a pkt_header whose iDst is correct */void addtopeersend(flitvec *fv);/** prepends a new flitvec to send before the potential other flitvecs. * assumes that now actual sending of flitvec is currently going. * @param fv : the flitvec * prerequisite: the flit0 of fv holds a pkt_header whose iDst is correct */void prependtopeersend(flitvec *fv);/** send a (or part of a) mpi message to one mpi peer * @param rank : rank of the mpi peer to send to * @param mpipeer : sockets information for all processes * @return * - -1 if disconnected * - 0 if not ready * - 1 if a part but not the total has been sent * - 2 if the write is complete */int on_send (int rank, SockInfo * mpipeer);/** called when something is to send to other daemon * write connection information if peernot completly connected, * else call on_send() to send a mpi message * @param rank : rank of the other daemon to write to * @param mpipeer : socket information for all daemon peer * @return void */void writedaemon(int rank, SockInfo * mpipeer);/** called when something is coming from peer socket * @param rank : rank of the other daemon to write to * @param mpipeer : socket information for all daemon peer * @return void */void readdaemon(int rank, SockInfo * mpipeer);#endif /* OTHERDAEMONCOMM_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -