"Fossies" - the Fresh Open Source Software Archive  

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

About: NetPIPE - a Network Protocol Independent Performance Evaluator

shmem.c  (NetPIPE_4.x):shmem.c  (NetPIPE-3.7.2)
skipping to change at line 62 skipping to change at line 62
void PrepareToReceive(ArgStruct *p) { } void PrepareToReceive(ArgStruct *p) { }
void SendData(ArgStruct *p) void SendData(ArgStruct *p)
{ {
if(p->bufflen%8==0) if(p->bufflen%8==0)
shmem_put64(p->s_ptr,p->s_ptr,p->bufflen/8,p->prot.nbor); shmem_put64(p->s_ptr,p->s_ptr,p->bufflen/8,p->prot.nbor);
else else
shmem_putmem(p->s_ptr,p->s_ptr,p->bufflen,p->prot.nbor); shmem_putmem(p->s_ptr,p->s_ptr,p->bufflen,p->prot.nbor);
} }
int TestForCompletion(ArgStruct *p)
{
if( p->r_ptr[p->bufflen-1] == (p->tr ? p->expected+1 : p->expected-1) ) {
return 1;
} else return 0;
}
void RecvData(ArgStruct *p) void RecvData(ArgStruct *p)
{ {
while(p->r_ptr[p->bufflen-1] != (p->tr ? p->expected+1 : p->expected-1) ) { int i=0;
while(p->r_ptr[p->bufflen-1] != 'a' + (p->cache ? 1 - p->tr : 1) ) {
sched_yield(); sched_yield();
} }
/* p->r_ptr[p->bufflen-1] = 'a' + (p->cache ? p->tr : 0);*/ p->r_ptr[p->bufflen-1] = 'a' + (p->cache ? p->tr : 0);
} }
void SendTime(ArgStruct *p, double *t) void SendTime(ArgStruct *p, double *t)
{ {
*pTime=*t; *pTime=*t;
shmem_double_put(pTime,pTime,1,p->prot.nbor); shmem_double_put(pTime,pTime,1,p->prot.nbor);
shmem_int_put(p->prot.flag,p->prot.flag,1,p->prot.nbor); shmem_int_put(p->prot.flag,p->prot.flag,1,p->prot.nbor);
} }
skipping to change at line 128 skipping to change at line 123
void CleanUp(ArgStruct *p) void CleanUp(ArgStruct *p)
{ {
} }
void Reset(ArgStruct *p) void Reset(ArgStruct *p)
{ {
} }
void MyMalloc(ArgStruct *p, int bufflen) void AfterAlignmentInit(ArgStruct *p)
{
}
void MyMalloc(ArgStruct *p, int bufflen, int soffset, int roffset)
{ {
void* buff1; void* buff1;
void* buff2; void* buff2;
if((buff1=(char *)shmalloc(bufflen+MAX(p->soffset,p->roffset)))==(char *)NULL ) if((buff1=(char *)shmalloc(bufflen+MAX(soffset,roffset)))==(char *)NULL)
{ {
fprintf(stderr,"couldn't allocate memory\n"); fprintf(stderr,"couldn't allocate memory\n");
exit(-1); exit(-1);
} }
if(!p->cache) if(!p->cache)
if((buff2=(char *)shmalloc(bufflen+p->soffset))==(char *)NULL) if((buff2=(char *)shmalloc(bufflen+soffset))==(char *)NULL)
{ {
fprintf(stderr,"Couldn't allocate memory\n"); fprintf(stderr,"Couldn't allocate memory\n");
exit(-1); exit(-1);
} }
if(p->cache) { if(p->cache) {
p->r_buff = buff1; p->r_buff = buff1;
} else { /* Flip-flop buffers so send <--> recv between nodes */ } else { /* Flip-flop buffers so send <--> recv between nodes */
p->r_buff = p->tr ? buff1 : buff2; p->r_buff = p->tr ? buff1 : buff2;
p->s_buff = p->tr ? buff2 : buff1; p->s_buff = p->tr ? buff2 : buff1;
 End of changes. 6 change blocks. 
12 lines changed or deleted 12 lines changed or added

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