⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 send.h

📁 Parallel programming/Lou Baker, Bradley J.Smith .—New York:McGraw-Hill Book Co.
💻 H
字号:
/* static char sccs_id[] = "@(#) /home2/bsmith/src/psph/SCCS/s.send.h 1.10 94/03/17"; */

/* Our own message passing functions - based on mpi
 * Bradley Smith
 */

#define PRINTROOT	/* Only print from the root node */

/* Code to manage non-blocking sends */
#ifdef NB_SEND
#define NB_BUF_SIZE 128
typedef struct tagNBSend{
	char *buf;
	MPI_Comm_request request;
	struct tagNBSend *next;
	char smallbuf[NB_BUF_SIZE];
	} NBSend;

typedef NBSend *PNBSend;
extern PNBSend NBPending, NBFree;

void FlushAllPending();
PNBSend GetNBBuf(void *buf, int count, MPI_Datatype datatype);
#endif /* NB_SEND */
	

/* Global variables and functions - Communications */
extern int Rank, NProc;
extern MPI_Comm Comm;
extern int *AllDest;
extern int *AllDestButMe;

/* Define Our FLOAT type */
#ifdef DOUBLE_PRECISION
#define MPI_MYFLOAT MPI_DOUBLE
#else
#define MPI_MYFLOAT MPI_FLOAT
#endif

/* Initialize MPI */
void InitMPISystem(int argc, char **argv, char *logfile, int quiet);
void ExitMPISystem(void);


/* Extensions - used to parse -s spawn argument */
int ParseSpawnArg(int argc, char **argv);

#if !defined(MYMPI)
  int _MPI_SizeDataType(MPI_Datatype datatype);
#endif

/* Message buffers */
#define BUF_ALLOC 4096	/*BUFFER ALLOCATION INCREMENT */
typedef struct tagMsgBuffer
	{
	int count, nalloc;	/* Number of items, and number allocated */
	int nused;			/* Number used - on receive */
	char *buf;			/* Buffer */
	MPI_Datatype datatype;	/* Datatype */
	int datasize;		/* Datasize */
	BOOL is_send;		/* Send or receive buffer */
#define SEND_BUF 1
#define RECV_BUF 0

	int bufid;			/* Buf id for using direct PVM buffering of data */
	}MsgBuf;

typedef MsgBuf *PMsgBuf;

/* Global buffers */
extern PMsgBuf GSendBuf, GRecvBuf;

/* Buffer allocation/destruction */
PMsgBuf NewMsgBuf(BOOL is_send, int size);
void DeleteMsgBuf(PMsgBuf mbuf);
void SizeMsgBuf(PMsgBuf mbuf, int new_size);


/* Global (default) buffers! */

/* Buffered send and receive operations */
int PackBuf(PMsgBuf msgbuf, void *buf, int count, MPI_Datatype datatype); /* Returns actual count */
int PackString(PMsgBuf msgbuf, char *string);
int SendBuf(PMsgBuf mbuf, int *destarray, int destcount, int tag, MPI_Comm comm);
int BroadcastBuf(PMsgBuf mbuf, int tag, MPI_Comm comm);

/* Buffered receive operations */
int UnPackBuf(PMsgBuf msgbuf, void *buf, int count);	/* Returns actual count */
int UnPackString(PMsgBuf msgbuf, char *string, int max_len);
int RecvBuf(PMsgBuf msg_buf, int count, MPI_Datatype datatype,
	int source, int tag, MPI_Comm comm, MPI_Status *status);

/* Simple defines */
#define PackIVector(mbuf,pivec) PackBuf(mbuf,pivec, DIM, MPI_INT)
#define PackVector(mbuf,pvec) PackBuf(mbuf,pvec, DIM, MPI_MYFLOAT)
#define UnPackIVector(mbuf,pivec) UnPackBuf(mbuf,pivec, DIM)
#define UnPackVector(mbuf,pvec) UnPackBuf(mbuf,pvec, DIM)
#define PackTensor(mbuf, ptens) PackBuf(mbuf, ptens, 2*DIM, MPI_MYFLOAT)
#define UnPackTensor(mbuf, ptens) UnPackBuf(mbuf, ptens, 2*DIM)


/* Single print */
void OnePrintString(char *str);
void PrintToLog(char *s, int rank);
void GetCurDirectory(char *s);



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -