maui/contrib/jobinit/AussieJobInit.c
dev 9a0042c61e Initial revision
git-svn-id: svn://opensvn.adaptivecomputing.com/maui/trunk@2 3f5042e3-fb1d-0410-be18-d6ca2573e517
2005-07-12 21:12:53 +00:00

78 lines
1.4 KiB
C

/* CONTRIB: AussieJobInit.c */
/* code to be included in LocalJobInit() in Local.c */
/* uses global BQS and Job */
enum { ajwcNONE = 0, ajwcConstant, ajwcLinear, ajwcQuadratic };
#define DEFAULTWCPOLICY ajwcConstant
int ContribAussieJobInit(
job_t *J)
{
int WCPolicy;
int ProcCount;
DBG(4,fCONFIG) DPrint("ContribAussieJobInit(%s)\n",
J->Name);
if ((J->SpecWCLimit[0] > 0) || (J->CPULimit <= 0))
{
/* wallclock time specified for job
or
no cpulimit specified for job */
return(SUCCESS);
}
if ((J->Req[0]->TaskCount > 0) && (J->Req[0]->DRes.Procs > 0))
{
ProcCount = J->Req[0]->TaskCount * J->Req[0]->DRes.Procs;
}
else
{
/* should not happen */
ProcCount = 1;
}
WCPolicy = DEFAULTWCPOLICY;
switch(WCPolicy)
{
case ajwcLinear:
J->SpecWCLimit[0] = J->CPULimit / ProcCount;
break;
case ajwcQuadratic:
J->SpecWCLimit[0] = (long)((double)J->CPULimit / pow((double)ProcCount,0.5));
break;
case ajwcConstant:
default:
J->SpecWCLimit[0] = J->CPULimit;
break;
} /* END switch(WCPolicy) */
J->SpecWCLimit[1] = J->SpecWCLimit[0];
DBG(4,fCONFIG) DPrint("INFO: job %s wallclock limit set to %s (%ld)\n",
J->Name,
StringTime(J->SpecWCLimit[1]),
J->CPULimit);
return(SUCCESS);
} /* END ContribAussieJobInit() */
/* END AussieJobInit.c */