Revision 1 -
(download)
(annotate)
Mon Apr 5 17:12:14 2010 UTC
(14 years, 4 months ago)
by dalvarez File size: 5081 byte(s)
First release to the general public
/*****************************************************************************/
/* */
/* Copyright (c) 2008, 2009, 2010 */
/* Computer Architecture Group (CAG) */
/* University of A Coruña, Spain */
/* (http://gac.des.udc.es) */
/* Galicia Supercomputing Center (CESGA) */
/* (http://www.cesga.es) */
/* Hewlett-Packard Spain (HP) */
/* (http://www.hp.es) */
/* */
/* This file is part of UPC Operations Microbenchmarking Suite (UOMS). */
/* */
/* UOMS is free software: you can redistribute it and/or modify */
/* it under the terms of the GNU Lesser General Public License as published */
/* by the Free Software Foundation, either version 3 of the License, or */
/* (at your option) any later version. */
/* */
/* UOMS is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU Lesser General Public License for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public License */
/* along with UOMS. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*****************************************************************************/
/*****************************************************************************/
/* */
/* FUNDING: This development has been funded by Hewlett-Packard Spain */
/* */
/* Project Name: */
/* UPCHACO (2008-2011) */
/* Subproject: */
/* Improving UPC Usability and Performance in Constellation Systems: */
/* Implementation/Extensions of UPC Libraries. */
/* (UPCPUProject -> UPC Performance and Usability Project) */
/* */
/*****************************************************************************/
/*****************************************************************************
For further documentation, see
[1] Files under doc/
******************************************************************************/
#include "../defines.h"
extern int cache_invalidation;
/*********************************************
Utility functions (niters...)
**********************************************/
int niters(int msize)
{
/*
* With cache invalidation the number of buckets will be equal to the number
* of iterations, resulting in excesive memory consumption. To avoid that
* the number of iterations will be less than without cache invalidation.
*/
int iters = 0;
int factor = 1;
if(cache_invalidation == 1){
if (msize <= 16*1024) iters=100;
else if (msize <= 512*1024) iters=50;
else if (msize <= 4*1024*1024) iters=25;
else if (msize <= 16*1024*1024) iters=10;
else iters=5;
}
else{
if (msize <= 16*1024) iters=1000;
else if (msize <= 512*1024) iters=500;
else if (msize <= 4*1024*1024) iters=250;
else if (msize <= 16*1024*1024) iters=100;
else iters=50;
}
if(THREADS<16){
factor=1;
}
else if(THREADS<64){
factor=2;
}
else if(THREADS<256){
factor=3;
}
else if(THREADS<1024){
factor=4;
}
else{
factor=5;
}
if(iters/factor < 1)
return 1;
else
return iters/factor;
}
/*
Sets the header type
*/
int operation_header(int operation_code){
int headertype=0;
switch (operation_code) {
case BROADCAST:
case SCATTER:
case GATHER:
case GATHERALL:
case EXCHANGE:
case PERMUTE:
case MEMGET:
case MEMPUT:
case MEMCPY:
case LMEMGET:
case LMEMPUT:
case LMEMCPY:
#ifdef ASYNC_MEM_TEST
case AMEMGET:
case AMEMPUT:
case AMEMCPY:
case ALMEMGET:
case ALMEMPUT:
case ALMEMCPY:
#endif
case SMEMCPY:
case MEMMOVE:
headertype=3;
break;
case BARRIER:
headertype=1;
break;
default:
headertype=2;
break;
}
return headertype;
}