"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/netpipe.h" between
NetPIPE_4.x.tar.gz and NetPIPE-3.7.2.tar.gz

About: NetPIPE - a Network Protocol Independent Performance Evaluator

netpipe.h  (NetPIPE_4.x):netpipe.h  (NetPIPE-3.7.2)
#define FINAL
#undef FINAL
/*****************************************************************************/ /*****************************************************************************/
/* "NetPIPE" -- Network Protocol Independent Performance Evaluator. */ /* "NetPIPE" -- Network Protocol Independent Performance Evaluator. */
/* Copyright 1997, 1998 Iowa State University Research Foundation, Inc. */ /* Copyright 1997, 1998 Iowa State University Research Foundation, Inc. */
/* */ /* */
/* This program is free software; you can redistribute it and/or modify */ /* 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 */ /* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation. You should have received a copy of the */ /* the Free Software Foundation. You should have received a copy of the */
/* GNU General Public License along with this program; if not, write to the */ /* GNU General Public License along with this program; if not, write to the */
/* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* */ /* */
skipping to change at line 23 skipping to change at line 25
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/time.h> /* struct timeval */ #include <sys/time.h> /* struct timeval */
#include <sys/resource.h> /* getrusage() */ #include <sys/resource.h> /* getrusage() */
#include <stdlib.h> /* malloc(3) */ #include <stdlib.h> /* malloc(3) */
#include <unistd.h> /* getopt, read, write, ... */ #include <unistd.h> /* getopt, read, write, ... */
#include <inttypes.h> /* uint64_t */
#include <fcntl.h> /* Handle the case of building on MacOS X */
#if defined(__APPLE__)
#include <stdint.h>
#endif
#ifdef INFINIBAND #ifdef INFINIBAND
#include <ib_defs.h> /* ib_mtu_t */ #include <ib_defs.h> /* ib_mtu_t */
#endif #endif
#define MEMSIZE 40000000 #ifdef OPENIB
/* MEMSIZE should be more than twice the #include <infiniband/verbs.h> /* enum ibv_mtu */
* largest message size because we need to have room for at least two #endif
* distinct buffers in no-cache bi-directional mode.
* Otherwise we can run into race condition problems. #ifdef FINAL
* It should also be larger than the cache size (or the amount of #define TRIALS 7
* memory that an InfiniBand card can register). #define RUNTM 0.25
*/ #else
#define TRIALS 3
#define RUNTM 0.10
#endif
#define MEMSIZE 10000000
#define DEFPORT 5002 #define DEFPORT 5002
#define MAXPORT 5102
#define NSAMP 8000 #define NSAMP 8000
#define DEFPERT 3 #define DEFPERT 3
#define LONGTIME 1e99 #define LONGTIME 1e99
#define CHARSIZE 8 #define CHARSIZE 8
#define STOPTM 1.0 #define STOPTM 1.0
#define MAXINT 10000000 #define MAXINT 10000000
#define MAXNSMP 16 /* Max of 16 SMP procs */ /*#define MAXINT 1048576*/
/* Workspace size for CPU load measurement */
#define WORKSIZE 131072 /* 132 kB will fit into any cache */
#define NELEMENTS (WORKSIZE/16)
#define ABS(x) (((x) < 0)?(-(x)):(x)) #define ABS(x) (((x) < 0)?(-(x)):(x))
#define MIN(x,y) (((x) < (y))?(x):(y)) #define MIN(x,y) (((x) < (y))?(x):(y))
#define MAX(x,y) (((x) > (y))?(x):(y)) #define MAX(x,y) (((x) > (y))?(x):(y))
/* Need to include the protocol structure header file. */ /* Need to include the protocol structure header file. */
/* Change this to reflect the protocol */ /* Change this to reflect the protocol */
typedef struct protocolstruct ProtocolStruct;
#if defined(TCP) #if defined(TCP)
#include <netdb.h> #include <netdb.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/tcp.h> #include <netinet/tcp.h>
#include <arpa/inet.h> #include <arpa/inet.h>
typedef struct protocolstruct ProtocolStruct;
struct protocolstruct struct protocolstruct
{ {
struct sockaddr_in sdin, /* socket structure #1 */ struct sockaddr_in sin1, /* socket structure #1 */
sdout; /* socket structure #2 */ sin2; /* socket structure #2 */
int nodelay; /* Flag for TCP nodelay */ int nodelay; /* Flag for TCP nodelay */
struct hostent *addr; /* Address of host */ struct hostent *addr; /* Address of host */
int sndbufsz, /* Size of TCP send buffer */ int sndbufsz, /* Size of TCP send buffer */
rcvbufsz; /* Size of TCP send buffer */ rcvbufsz; /* Size of TCP receive buffer */
}; #if defined(INFINIBAND)
IB_mtu_t ib_mtu; /* MTU Size for Infiniband HCA */
#elif defined(INFINIBAND)
/* Header files needed for InfiniBand */
#include "vapi.h" /* Mellanox Verbs API */
#include "evapi.h" /* Mellanox Verbs API extension */
#include "vapi_common.h" /* Mellanox VIP layer of HCA Verbs */
struct protocolstruct
{
int commtype; /* Communications type */ int commtype; /* Communications type */
int comptype; /* Completion type */ int comptype; /* Completion type */
IB_lid_t *lid; /* Array of lids for each proc */ #endif
VAPI_qp_num_t *qp_num, /* Array of qp_nums for each proc */ #if defined(OPENIB)
*dest_qp_num; /* Array of dest qp_nums */ enum ibv_mtu ib_mtu; /* MTU Size for Infiniband HCA */
VAPI_pd_hndl_t pd_hndl; /* Protection domain handle */ int commtype; /* Communications type */
VAPI_cq_hndl_t *s_cq_hndl, /* send completion queues */ int comptype; /* Completion type */
*r_cq_hndl; /* recv completion queues */ char *device_and_port; /* Local port specification */
VAPI_qp_hndl_t *qp_hndl; /* Q pair handles */ #endif
VAPI_lkey_t l_key_sbuf; /* Local send buf access key */ #if defined(DAT)
VAPI_lkey_t l_key_rbuf; /* Local recv buf access key */ int commtype; /* Communications type */
VAPI_rkey_t r_key_sbuf; /* Remote send buf access key */ int comptype; /* Completion type */
VAPI_rkey_t r_key_rbuf; /* Remote recv buf access key */ #endif
void* r_addr_sbuf; /* Remote send buf address */
void* r_addr_rbuf; /* Remote recv buf address */
VAPI_rkey_t *r_key; /* Remote RDMA access keys */
void* *r_addr; /* Remote RDMA addresses */
IB_mtu_t ib_mtu; /* MTU Size for Infiniband HCA */
}; };
#if defined(INFINIBAND) || defined(OPENIB)
enum completion_types { enum completion_types {
NP_COMP_LOCALPOLL, /* Poll locally on last byte of data */ NP_COMP_LOCALPOLL, /* Poll locally on last byte of data */
NP_COMP_VAPIPOLL, /* Poll using vapi function */ NP_COMP_VAPIPOLL, /* Poll using vapi function */
NP_COMP_EVENT /* Don't poll, use vapi event completion */ NP_COMP_EVENT /* Don't poll, use vapi event completion */
}; };
enum communication_types { enum communication_types {
NP_COMM_SENDRECV, /* Communication with send/receive */ NP_COMM_SENDRECV, /* Communication with send/receive */
NP_COMM_SENDRECV_WITH_IMM, /* Communication with send/receive & imm data */ NP_COMM_SENDRECV_WITH_IMM, /* Communication with send/receive & imm data */
NP_COMM_RDMAWRITE, /* Communication with rdma write */ NP_COMM_RDMAWRITE, /* Communication with rdma write */
NP_COMM_RDMAWRITE_WITH_IMM, /* Communication with rdma write & imm data */ NP_COMM_RDMAWRITE_WITH_IMM, /* Communication with rdma write & imm data */
}; };
#endif
#elif defined(MPI) #if defined(DAT)
enum completion_types {
NP_COMP_LOCALPOLL, /* Poll locally on last byte of data */
NP_COMP_DQPOLL, /* Poll using uDAPL dequeue function */
NP_COMP_EVD, /* Don't poll, use uDAPL EVD wait */
NP_COMP_CNO /* Don't poll, use uDAPL CNO wait */
};
enum communication_types {
NP_COMM_SENDRECV, /* Communication with send/receive */
NP_COMM_RDMAWRITE, /* Communication with rdma write */
};
#endif
#elif defined(SCTP6)
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/sctp.h>
#include <arpa/inet.h>
typedef struct protocolstruct ProtocolStruct;
struct protocolstruct struct protocolstruct
{ {
int nbor, iproc; /* still used for MPI2? */ struct sockaddr_in6 sin1; /* socket structure #1 */
int use_get; struct sockaddr_in6 sin2; /* socket structure #2 */
int no_fence; int nodelay; /* Flag for TCP nodelay */
struct hostent *addr; /* Address of host */
int sndbufsz; /* Size of TCP send buffer */
int rcvbufsz; /* Size of TCP receive buffer */
};
#elif defined(SCTP)
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/sctp.h>
#include <arpa/inet.h>
typedef struct protocolstruct ProtocolStruct;
struct protocolstruct
{
struct sockaddr_in sin1, /* socket structure #1 */
sin2; /* socket structure #2 */
int nodelay; /* Flag for TCP nodelay */
struct hostent *addr; /* Address of host */
int sndbufsz, /* Size of TCP send buffer */
rcvbufsz; /* Size of TCP receive buffer */
};
#elif defined(TCP6)
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
typedef struct protocolstruct ProtocolStruct;
struct protocolstruct
{
struct sockaddr_in6 sin1; /* socket structure #1 */
struct sockaddr_in6 sin2; /* socket structure #2 */
int nodelay; /* Flag for TCP nodelay */
struct hostent *addr; /* Address of host */
int sndbufsz; /* Size of TCP send buffer */
int rcvbufsz; /* Size of TCP receive buffer */
}; };
#elif defined(KCOPY) #elif defined(IPX)
#include <netdb.h>
#include <sys/socket.h>
#include <netipx/ipx.h>
typedef struct protocolstruct ProtocolStruct;
struct protocolstruct struct protocolstruct
{ {
volatile int nbytes, source, tag, nleft; /* nleft --> 0 on completion */ struct sockaddr_ipx sipx1; /* socket structure #1 */
int posted; struct sockaddr_ipx sipx2; /* socket structure #2 */
int sndbufsz; /* Size of send buffer */
int rcvbufsz; /* Size of receive buffer */
};
#elif defined(MPI)
typedef struct protocolstruct ProtocolStruct;
struct protocolstruct
{
int nbor, iproc;
int use_get;
int no_fence;
}; };
#elif defined(PVM) #elif defined(PVM)
typedef struct protocolstruct ProtocolStruct;
struct protocolstruct struct protocolstruct
{ {
int mytid; /* Keep track of our task id */ int mytid; /* Keep track of our task id */
int othertid; /* Keep track of the other's task id */ int othertid; /* Keep track of the other's task id */
}; };
/* /*
Choose one of the following to determine the type of data Choose one of the following to determine the type of data
encoding for the PVM message passing. encoding for the PVM message passing.
skipping to change at line 164 skipping to change at line 229
DataInPlace means that the data is not copied at pack time, but is DataInPlace means that the data is not copied at pack time, but is
copied directly from memory at send time (DDT - this helps a lot). copied directly from memory at send time (DDT - this helps a lot).
#define PVMDATA PvmDataDefault #define PVMDATA PvmDataDefault
#define PVMDATA PvmDataRaw #define PVMDATA PvmDataRaw
#define PVMDATA PvmDataInPlace #define PVMDATA PvmDataInPlace
*/ */
#define PVMDATA PvmDataInPlace #define PVMDATA PvmDataInPlace
#elif defined(TCGMSG)
typedef struct protocolstruct ProtocolStruct;
struct protocolstruct { long nbor, nid; };
#elif defined(LAPI) #elif defined(LAPI)
typedef struct protocolstruct ProtocolStruct;
struct protocolstruct { int nbor; }; struct protocolstruct { int nbor; };
#elif defined(SHMEM) #elif defined(SHMEM)
#if defined(GPSHMEM) #if defined(GPSHMEM)
#include "gpshmem.h" #include "gpshmem.h"
#else #else
#include <mpp/shmem.h> #include <mpp/shmem.h>
#endif #endif
typedef struct protocolstruct ProtocolStruct;
struct protocolstruct struct protocolstruct
{ {
int nbor,ipe; int nbor,ipe;
int *flag; volatile int *flag;
}; };
#elif defined(ARMCI) #elif defined(ARMCI)
/* basically same as for GPSHMEM */ /* basically same as for GPSHMEM */
double *pTime;
int *pNrepeat;
typedef struct protocolstruct ProtocolStruct;
struct protocolstruct struct protocolstruct
{ {
int nbor,ipe; int nbor,ipe;
volatile int *flag;
};
#elif defined(MX)
#include "myriexpress.h"
typedef struct protocolstruct ProtocolStruct;
struct protocolstruct
{
mx_endpoint_t ep;
mx_endpoint_addr_t addr;
mx_request_t rreq;
}; };
#elif defined(GM) #elif defined(GM)
#include "gm.h" #include "gm.h"
typedef struct protocolstruct ProtocolStruct;
struct protocolstruct struct protocolstruct
{ {
int num_stokens; /* The number of send tokens */ int nbor, iproc, num_stokens;
short int *host_id; /* Array of host id's */ unsigned short host_id; /* Host id in routing info of myrinet card */
}; };
struct gm_port *gm_p;
unsigned long *ltime, *lrpt;
char *sync, *sync1;
#elif defined(ATOLL) #elif defined(ATOLL)
#include <atoll.h> #include <atoll.h>
typedef struct protocolstruct ProtocolStruct;
struct protocolstruct struct protocolstruct
{ {
port_id id_self, /* My port id */ port_id id_self, /* My port id */
id_nbor; /* My neighbor's port id */ id_nbor; /* My neighbor's port id */
} }
#elif defined(SISCI) #elif defined(MEMCPY) || defined(VMSPLICE)
typedef struct protocolstruct ProtocolStruct;
struct protocolstruct { int nothing; };
#include "sisci_error.h" #elif defined(KNEM)
#include "sisci_api.h" #include "knem_io.h"
#include "sisci_demolib.h"
#include "scilib.h"
typedef struct protocolstruct ProtocolStruct;
struct protocolstruct { struct protocolstruct {
int nodeid; int flags;
int* nodeids; char *shared_filename;
}; };
#elif defined(DISK) #elif defined(DISK)
typedef struct protocolstruct ProtocolStruct;
struct protocolstruct { struct protocolstruct {
char *dfile_name; char *dfile_name;
int read; int read;
char read_type; /* c-char d-double s-stream */ char read_type; /* c-char d-double s-stream */
}; };
#elif defined(MEMCPY)
struct protocolstruct {
int fd[2]; /* File descriptors for pipe measurements */
};
#elif defined(THEO)
struct protocolstruct
{
/* The 3 required inputs */
double Rmax, Rmed, Tlat;
/* Optional inputs */
int Sp, Sh, Rndv;
};
#else #else
struct protocolstruct { int nothing; }; #error "One of TCP, TCP6, SCTP, SCTP6, IPX, MPI, PVM, TCGMSG, LAPI, SHMEM, MX, GM, ATOLL, MEMCPY, DISK, VMSPLICE, or KNEM must be defined during compilation"
#endif #endif
typedef struct argstruct ArgStruct; typedef struct argstruct ArgStruct;
struct argstruct struct argstruct
{ {
/* This is the common information that is needed for all tests */ /* This is the common information that is needed for all tests */
int nprocs, /* The number of processes */ int cache; /* Cache flag, 0 => limit cache, 1=> use cache */
myproc, /* My process number (0..nprocs-1) */ char *host; /* Name of receiving host */
source, /* Set to -1 (MPI_ANY_SOURCE) if -z specified */
dest; /* The destination node number */
int cache, /* Cache flag, 0 => limit cache, 1=> use cache */
bidir, /* Bi-directional flag */
stream, /* Streaming mode */
workload, /* Measure the CPU workload of the comm system */
preburst, /* Prepost burst mode */
reset_conn, /* Reset connection flag */
syncflag; /* flag for using sync sends in MPI mode */
char **host, *hostfile; /* Name of other hosts, and the hostfile */
int serv_sd, /* File descriptor of the network socket */
*comm_sd; /* Communication socket descriptors */
int *port, /* Array of ports used for connection */
*pid; /* Array of PID numbers */
char *r_buff, /* Aligned receive buffer */
*r_buff_orig, /* Original unaligned receive buffer */
*r_ptr, /* Pointer to current location in recv buffer */
*r_ptr_saved, /* Pointer for saving value of r_ptr */
*ds_buff, /* Send pointer base on dest proc for kernel_copy.c
*/
*dr_buff, /* Recv pointer base on dest proc for kernel_copy.c
*/
*ds_ptr, /* Send pointer on dest proc for kernel_copy.c */
*dr_ptr, /* Recv pointer on dest proc for kernel_copy.c */
*s_buff, /* Aligned send buffer */
*s_buff_orig, /* Original unaligned send buffer */
*s_ptr; /* Pointer to current location in send buffer */
int soffset, /* Send and recv buffer offsets */
roffset;
unsigned char expected; /* Expected value of first and last bytes */ int servicefd, /* File descriptor of the network socket */
commfd; /* Communication file descriptor */
short port; /* Port used for connection */
char *r_buff; /* Aligned receive buffer */
char *r_buff_orig; /* Original unaligned receive buffer */
#if defined(USE_VOLATILE_RPTR)
volatile /* use volatile if polling on buffer in module */
#endif
char *r_ptr; /* Pointer to current location in send buffer */
char *r_ptr_saved; /* Pointer for saving value of r_ptr */
char *s_buff; /* Aligned send buffer */
char *s_buff_orig; /* Original unaligned send buffer */
char *s_ptr; /* Pointer to current location in send buffer */
int bufflen, /* Length of transmitted buffer */ int bufflen, /* Length of transmitted buffer */
bytesLeft, /* Number of bytes left to xmit/recv */
upper, /* Upper limit to bufflen */ upper, /* Upper limit to bufflen */
tr,rcv, /* Transmit and Recv flags, or maybe neither */ tr,rcv, /* Transmit and Recv flags, or maybe neither */
master, /* Proc 0 is the master */ bidir, /* Bi-directional flag */
min_trials; /* Min number of trials to make per data point */ nbuff; /* Number of buffers to transmit */
double runtime; /* Runtime for each data point */
int source_node; /* Set to -1 (MPI_ANY_SOURCE) if -z specified */
int preburst; /* Burst preposted receives before timed runs */
int reset_conn; /* Reset connection flag */
int soffset,roffset;
int syncflag; /* flag for using sync sends vs. normal sends in MPI mod*
/
int use_sdp; /* Use AF_INET_SDP instead of AF_INET */
/* Now we work with a union of information for protocol dependent stuff */ /* Now we work with a union of information for protocol dependent stuff */
ProtocolStruct prot; ProtocolStruct prot;
}; };
#if defined( _NETPIPE_C_ ) typedef struct data Data;
/* Initial parameters for the args structure */ struct data
{
struct argstruct args_init = { double t;
2, -1, 0, 0, double bps;
1, 0, 0, 0, 0, 0, 0, double variance;
NULL, NULL, int bits;
0, NULL, int repeat;
NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
0, 0,
0,
0, 0, MAXINT, 0, 0, 0, 7,
0.25,
0
}; };
#endif
double When(); double When();
#if defined (THEO)
double Theo_Time( ArgStruct *p );
#endif
void Init(ArgStruct *p, int* argc, char*** argv); void Init(ArgStruct *p, int* argc, char*** argv);
void Setup(ArgStruct *p); void Setup(ArgStruct *p);
void establish(ArgStruct *p); void establish(ArgStruct *p);
void Sync(ArgStruct *p); void Sync(ArgStruct *p);
void PrepareToReceive(ArgStruct *p); void PrepareToReceive(ArgStruct *p);
void SendData(ArgStruct *p); void SendData(ArgStruct *p);
int TestForCompletion( ArgStruct *p ); void RecvData(ArgStruct *p);
void DoWork( int requested_flops, double *mflops ); void SendTime(ArgStruct *p, double *t);
void RecvData(ArgStruct *p); void RecvTime(ArgStruct *p, double *t);
void Gather(ArgStruct *p, double *t); void SendRepeat(ArgStruct *p, int rpt);
void Broadcast(ArgStruct *p, unsigned int *nrepeat); void RecvRepeat(ArgStruct *p, int *rpt);
void FreeBuff(char *buff1, char *buff2); void FreeBuff(char *buff1, char *buff2);
void CleanUp(ArgStruct *p); void CleanUp(ArgStruct *p);
void InitBufferData(ArgStruct *p, int nbytes); void InitBufferData(ArgStruct *p, int nbytes, int soffset, int roffset);
void SetExpected(ArgStruct *p);
void CheckBufferData(ArgStruct *p, int i, int j);
void UpdateExpected(ArgStruct *p);
void SwapSendRecvPtrs(ArgStruct *p); void MyMalloc(ArgStruct *p, int bufflen, int soffset, int roffset);
void MyMalloc(ArgStruct *p, int bufflen);
void Reset(ArgStruct *p); void Reset(ArgStruct *p);
void mymemset(int *ptr, int c, int n); void mymemset(int *ptr, int c, int n);
void flushcache(int *ptr, int n); void flushcache(int *ptr, int n);
void SetIntegrityData(ArgStruct *p); void SetIntegrityData(ArgStruct *p);
void VerifyIntegrity(ArgStruct *p); void VerifyIntegrity(ArgStruct *p);
skipping to change at line 387 skipping to change at line 424
void AdvanceRecvPtr(ArgStruct* p, int blocksize); void AdvanceRecvPtr(ArgStruct* p, int blocksize);
void SaveRecvPtr(ArgStruct* p); void SaveRecvPtr(ArgStruct* p);
void ResetRecvPtr(ArgStruct* p); void ResetRecvPtr(ArgStruct* p);
void PrintUsage(); void PrintUsage();
int getopt( int argc, char * const argv[], const char *optstring); int getopt( int argc, char * const argv[], const char *optstring);
void AfterAlignmentInit(ArgStruct *p); void AfterAlignmentInit( ArgStruct *p );
/* If the module does not need the following functions, then use
* these empty definitions */
#if defined (_NETPIPE_C_)
#if ! defined (INFINIBAND) && ! defined (MPI2) && ! defined (ARMCI) && ! defined
(LAPI)
void AfterAlignmentInit(ArgStruct *p) { }
#endif
#if ! defined (INFINIBAND) && ! defined (ARMCI) && ! defined (MPI2) && ! defined
(LAPI) && ! defined(KCOPY)
void ModuleSwapPtrs( ArgStruct *p ) { }
#endif
#if ! defined (MPI2)
void Fence( ArgStruct *p ) { }
#endif
#endif
 End of changes. 52 change blocks. 
164 lines changed or deleted 200 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS