46 #define crystal_init PREFIXED_NAME(crystal_init )
47 #define crystal_free PREFIXED_NAME(crystal_free )
48 #define crystal_router PREFIXED_NAME(crystal_router)
71 if(dst+n<=src) memcpy (dst,src,n*
sizeof(
uint));
72 else if(dst!=src) memmove(dst,src,n*
sizeof(
uint));
82 for(src=keep,end=keep+n; src<end; src+=len) {
84 if(src[0]>=cutoff) memcpy (send,src,len*
sizeof(
uint)), send+=len;
85 else uintcpy(keep,src,len), keep+=len;
88 for(src=keep,end=keep+n; src<end; src+=len) {
90 if(src[0]< cutoff) memcpy (send,src,len*
sizeof(
uint)), send+=len;
91 else uintcpy(keep,src,len), keep+=len;
102 uint count[2] = {0,0},
sum, *recv[2];
111 sum = p->
data.
n + count[0] + count[1];
117 recv[0],count[0]*
sizeof(
uint), targ ,tag+1);
119 recv[1],count[1]*
sizeof(
uint), p->
comm.
id-1,tag+1);
128 uint send_n, targ, tag = 0;
131 nl = (
n+1)/2, bh = bl+nl;
134 recvn = 1, targ =
n-1-(
id-bl)+bl;
135 if(
id==targ) targ=bh, recvn=0;
136 if(
n&1 &&
id==bh) recvn=2;
138 if(
id<bh)
n=nl;
else n-=nl,bl=bh;
static double sum(struct xxt *data, double v, uint n, uint tag)
static void comm_wait(comm_req *req, int n)
static void comm_free(struct comm *c)
#define buffer_reserve(b, max)
static uint crystal_move(struct crystal *p, uint cutoff, int send_hi)
static void crystal_exchange(struct crystal *p, uint send_n, uint targ, int recvn, int tag)
static void comm_irecv(comm_req *req, const struct comm *c, void *p, size_t n, uint src, int tag)
#define buffer_init(b, max)
static void uintcpy(uint *dst, const uint *src, uint n)
establishes some macros to establish naming conventions
static void comm_isend(comm_req *req, const struct comm *c, void *p, size_t n, uint dst, int tag)