Skip to content

Commit

Permalink
Updating API calls to sync with 1.2 spec
Browse files Browse the repository at this point in the history
-Apps changes for getArgc -> ocrGetArgc
-Apps changes for getArgv -> ocrGetArgv
-Apps changes for ASSERT -> ocrAssert
-Apps changes for PRINTF -> ocrPrintf

Change-Id: I477084266072d6fb94e500449aadb0a41b0bd8be
  • Loading branch information
pepperln authored and bseshasa committed Aug 29, 2017
1 parent b63d6d8 commit d8f48ba
Show file tree
Hide file tree
Showing 197 changed files with 3,278 additions and 3,276 deletions.
52 changes: 26 additions & 26 deletions apps/CoMD/refactored/ocr/intel-chandra-tiled/CoMD.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void sanityChecks(u64 id, Command cmd, double cutoff, double latticeConst, char
{
failCode |= 2;
if (id==0)
PRINTF( "\nSimulation too small.\n"
ocrPrintf( "\nSimulation too small.\n"
" Increase the number of unit cells to make the simulation\n"
" at least (%3.2f, %3.2f. %3.2f) Ansgstroms in size\n",
minx, miny, minz);
Expand All @@ -62,11 +62,11 @@ void sanityChecks(u64 id, Command cmd, double cutoff, double latticeConst, char
{
failCode |= 4;
if (id==0)
PRINTF( "\nOnly FCC Lattice type supported, not %s. Fatal Error.\n",
ocrPrintf( "\nOnly FCC Lattice type supported, not %s. Fatal Error.\n",
latticeType);
}
int checkCode = failCode;
ASSERT(checkCode == failCode);
ocrAssert(checkCode == failCode);

if (failCode != 0)
ocrShutdown();
Expand All @@ -82,7 +82,7 @@ ocrDBK_t initPotential(
else
DBK_pot = initLjPot(pot);

ASSERT(pot);
ocrAssert(pot);
return DBK_pot;
}

Expand Down Expand Up @@ -245,30 +245,30 @@ void printSimulationData(Command* PTR_cmd, SimFlat* s, int maxOcc)
if(s->PTR_rankH->myRank != 0 )
return;

PRINTF("Simulation data: \n");
PRINTF(" Total atoms : %d\n",
ocrPrintf("Simulation data: \n");
ocrPrintf(" Total atoms : %d\n",
s->atoms->nGlobal);
PRINTF(" Min global bounds : [ %14.10f, %14.10f, %14.10f ]\n",
ocrPrintf(" Min global bounds : [ %14.10f, %14.10f, %14.10f ]\n",
s->domain->globalMin[0], s->domain->globalMin[1], s->domain->globalMin[2]);
PRINTF(" Max global bounds : [ %14.10f, %14.10f, %14.10f ]\n",
ocrPrintf(" Max global bounds : [ %14.10f, %14.10f, %14.10f ]\n",
s->domain->globalMax[0], s->domain->globalMax[1], s->domain->globalMax[2]);
printSeparator();
PRINTF("Decomposition data: \n");
PRINTF(" Processors : %6d,%6d,%6d\n",
ocrPrintf("Decomposition data: \n");
ocrPrintf(" Processors : %6d,%6d,%6d\n",
s->domain->procGrid[0], s->domain->procGrid[1], s->domain->procGrid[2]);
PRINTF(" Local boxes : %6d,%6d,%6d = %8d\n",
ocrPrintf(" Local boxes : %6d,%6d,%6d = %8d\n",
s->boxes->gridSize[0], s->boxes->gridSize[1], s->boxes->gridSize[2],
s->boxes->gridSize[0]*s->boxes->gridSize[1]*s->boxes->gridSize[2]);
PRINTF(" Box size : [ %14.10f, %14.10f, %14.10f ]\n",
ocrPrintf(" Box size : [ %14.10f, %14.10f, %14.10f ]\n",
s->boxes->boxSize[0], s->boxes->boxSize[1], s->boxes->boxSize[2]);
PRINTF(" Box factor : [ %14.10f, %14.10f, %14.10f ] \n",
ocrPrintf(" Box factor : [ %14.10f, %14.10f, %14.10f ] \n",
s->boxes->boxSize[0]/s->pot->cutoff,
s->boxes->boxSize[1]/s->pot->cutoff,
s->boxes->boxSize[2]/s->pot->cutoff);
PRINTF( " Max Link Cell Occupancy: %d of %d\n",
ocrPrintf( " Max Link Cell Occupancy: %d of %d\n",
maxOcc, MAXATOMS);
printSeparator();
PRINTF("Potential data: \n");
ocrPrintf("Potential data: \n");
s->pot->print(s->pot);

// Memory footprint diagnostics
Expand All @@ -284,11 +284,11 @@ void printSimulationData(Command* PTR_cmd, SimFlat* s, int maxOcc)
float paddedMemTotal = (float) nTotalBoxes*(perAtomSize*MAXATOMS)/1024/1024;

printSeparator();
PRINTF("Memory data: \n");
PRINTF( " Intrinsic atom footprint = %4d B/atom \n", perAtomSize);
PRINTF( " Total atom footprint = %7.3f MB (%6.2f MB/node)\n", totalMemGlobal, totalMemLocal);
PRINTF( " Link cell atom footprint = %7.3f MB/node\n", paddedMemLocal);
PRINTF( " Link cell atom footprint = %7.3f MB/node (including halo cell data\n", paddedMemTotal);
ocrPrintf("Memory data: \n");
ocrPrintf( " Intrinsic atom footprint = %4d B/atom \n", perAtomSize);
ocrPrintf( " Total atom footprint = %7.3f MB (%6.2f MB/node)\n", totalMemGlobal, totalMemLocal);
ocrPrintf( " Link cell atom footprint = %7.3f MB/node\n", paddedMemLocal);
ocrPrintf( " Link cell atom footprint = %7.3f MB/node (including halo cell data\n", paddedMemTotal);
}

ocrGuid_t printSimulationData1Edt( EDT_ARGS )
Expand Down Expand Up @@ -972,7 +972,7 @@ _OCR_TASK_FNC_( initEdt )
ocrEventCreate( &stickyEVT_new, OCR_EVENT_STICKY_T, GUID_PROP_CHECK | EVT_PROP_TAKES_ARG );

//DEBUG_PRINTF(("s %d se %d r %d re %d s(%d %d %d) r(%d %d %d)\n", id, nbr, nbrRank, nbrImage, ix0, iy0, iz0, ix, iy, iz ));
//PRINTF("Send rank %d %d "GUIDF" \n", id, nbr, PTR_rankH->haloSendEVTs[nbr]);
//ocrPrintf("Send rank %d %d "GUIDF" \n", id, nbr, PTR_rankH->haloSendEVTs[nbr]);

ocrAddDependence( stickyEVT_new, channelSetupEDT, nbr, DB_MODE_RW ); //TODO
}
Expand All @@ -986,7 +986,7 @@ _OCR_TASK_FNC_( initEdt )

ocrGuid_t wrapUpEdt( u32 paramc, u64 *paramv, u32 depc, ocrEdtDep_t depv[] )
{
PRINTF("Shutting down\n");
ocrPrintf("Shutting down\n");
ocrShutdown();
return NULL_GUID;
}
Expand All @@ -998,14 +998,14 @@ ocrGuid_t mainEdt( u32 paramc, u64* paramv, u32 depc, ocrEdtDep_t depv[] )
ocrGuid_t DBK_cmdLineArgs = depv[0].guid;

void * PTR_cmdLineArgs = depv[0].ptr;
u32 argc = getArgc( PTR_cmdLineArgs );
u32 argc = ocrGetArgc( PTR_cmdLineArgs );

//Pack the PTR_cmdLineArgs into the "cannonical" char** argv
ocrGuid_t argv_g;
char** argv;
ocrDbCreate( &argv_g, (void**)&argv, sizeof(char*)*argc, DB_PROP_NONE, PICK_1_1(NULL_HINT,NULL_GUID), NO_ALLOC );
for( u32 a = 0; a < argc; ++a )
argv[a] = getArgv( PTR_cmdLineArgs, a );
argv[a] = ocrGetArgv( PTR_cmdLineArgs, a );

Command cmd = parseCommandLine(argc, argv);
printCmd(&cmd);
Expand Down Expand Up @@ -1050,10 +1050,10 @@ ocrGuid_t mainEdt( u32 paramc, u64* paramv, u32 depc, ocrEdtDep_t depv[] )

//2-D Cartesian grid of SPMD EDTs get mapped to a 2-D Cartesian grid of PDs
#ifdef USE_STATIC_SCHEDULER
PRINTF("Using STATIC scheduler\n");
ocrPrintf("Using STATIC scheduler\n");
forkSpmdEdts_staticScheduler_Cart3D( initEdt, edtGridDims, spmdDepv );
#else
PRINTF("NOT Using STATIC scheduler\n");
ocrPrintf("NOT Using STATIC scheduler\n");
forkSpmdEdts_Cart3D( initEdt, edtGridDims, spmdDepv );
#endif

Expand Down
4 changes: 2 additions & 2 deletions apps/CoMD/refactored/ocr/intel-chandra-tiled/CoMDTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ static inline void timestamp( const char* msg )
time_t t = time( NULL );
char* time_string = ctime( &t );
time_string[24] = '\0';
PRINTF( "%s: ", time_string );
ocrPrintf( "%s: ", time_string );
#endif
PRINTF( "%s\n", msg );
ocrPrintf( "%s\n", msg );
}

struct SimFlatSt;
Expand Down
4 changes: 2 additions & 2 deletions apps/CoMD/refactored/ocr/intel-chandra-tiled/SPMDappUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ void forkSpmdEdts_Cart3D( ocrGuid_t (*initEdt)(u32, u64*, u32, ocrEdtDep_t*), u6
//Map the SPMD EDTs onto the policy domains
u64 affinityCount=1;
#ifdef ENABLE_EXTENSION_AFFINITY
PRINTF("Using affinity API\n");
ocrPrintf("Using affinity API\n");
ocrAffinityCount( AFFINITY_PD, &affinityCount );
#else
PRINTF("NOT Using affinity API\n");
ocrPrintf("NOT Using affinity API\n");
#endif
u64 PD_X, PD_Y, PD_Z;
splitDimension_Cart3D( affinityCount, &PD_X, &PD_Y, &PD_Z ); //Split available PDs into a 2-D grid
Expand Down
12 changes: 6 additions & 6 deletions apps/CoMD/refactored/ocr/intel-chandra-tiled/cmdLineParser.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,18 @@ void printArgs(MyOption* myargs)
MyOption* o = myargs;
char s[4096];
unsigned char *shortArg;
PRINTF("\n"
ocrPrintf("\n"
" Arguments are: \n");
while(o)
{
if(o->shortArg[0]<0xFF) shortArg = o->shortArg;
else shortArg = (unsigned char *) "---";
PRINTF(" --%%-%20s",o->longArg);
PRINTF(" -%c arg=%1d type=%c %s\n",shortArg[0],o->argFlag,o->type,o->help);
ocrPrintf(" --%%-%20s",o->longArg);
ocrPrintf(" -%c arg=%1d type=%c %s\n",shortArg[0],o->argFlag,o->type,o->help);
o = nextOption(o);

}
PRINTF("\n\n");
ocrPrintf("\n\n");
return;
}

Expand Down Expand Up @@ -153,7 +153,7 @@ void processArgs(MyOption* myargs, int argc, char** argv)
o = findOption(myargs,c);
if ( ! o )
{
PRINTF("\n\n"
ocrPrintf("\n\n"
" invalid switch : -%c in getopt()\n"
"\n\n",
c);
Expand Down Expand Up @@ -185,7 +185,7 @@ void processArgs(MyOption* myargs, int argc, char** argv)
sscanf(optarg,"%c",(char*)o->ptr);
break;
default:
PRINTF("\n\n"
ocrPrintf("\n\n"
" invalid type : %c in getopt()\n"
" valid values are 'e', 'z'. 'i','d','f','s', and 'c'\n"
"\n\n",
Expand Down
24 changes: 12 additions & 12 deletions apps/CoMD/refactored/ocr/intel-chandra-tiled/eam.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ ocrDBK_t initEamPot(BasePotential** bpot, const char* dir, const char* file, con
int eamForce1(SimFlat* s, u64 itimestep)
{
EamPotential* pot = (EamPotential*) s->pot;
ASSERT(pot);
ocrAssert(pot);

real_t rCut2 = pot->cutoff*pot->cutoff;

Expand Down Expand Up @@ -289,7 +289,7 @@ int eamForce1(SimFlat* s, u64 itimestep)
int eamForce2(SimFlat* s)
{
EamPotential* pot = (EamPotential*) s->pot;
ASSERT(pot);
ocrAssert(pot);

real_t rCut2 = pot->cutoff*pot->cutoff;

Expand Down Expand Up @@ -346,13 +346,13 @@ int eamForce2(SimFlat* s)
void eamPrint(BasePotential* pot)
{
EamPotential *eamPot = (EamPotential*) pot;
PRINTF( " Potential type : EAM\n");
PRINTF( " Species name : %s\n", eamPot->name);
PRINTF( " Atomic number : %d\n", eamPot->atomicNo);
PRINTF( " Mass : "FMT1" amu\n", eamPot->mass/amuToInternalMass); // print in amu
PRINTF( " Lattice type : %s\n", eamPot->latticeType);
PRINTF( " Lattice spacing : "FMT1" Angstroms\n", eamPot->lat);
PRINTF( " Cutoff : "FMT1" Angstroms\n", eamPot->cutoff);
ocrPrintf( " Potential type : EAM\n");
ocrPrintf( " Species name : %s\n", eamPot->name);
ocrPrintf( " Atomic number : %d\n", eamPot->atomicNo);
ocrPrintf( " Mass : "FMT1" amu\n", eamPot->mass/amuToInternalMass); // print in amu
ocrPrintf( " Lattice type : %s\n", eamPot->latticeType);
ocrPrintf( " Lattice spacing : "FMT1" Angstroms\n", eamPot->lat);
ocrPrintf( " Cutoff : "FMT1" Angstroms\n", eamPot->cutoff);
}

void eamDestroy(BasePotential** pPot)
Expand Down Expand Up @@ -387,10 +387,10 @@ void eamDestroy(BasePotential** pPot)
void initInterpolationObject( InterpolationObject* table,
int n, real_t x0, real_t dx, real_t* data)
{
ASSERT(table);
ocrAssert(table);

ocrDbCreate( &table->DBK_values, (void**) &table->values, (n+3)*sizeof(real_t), 0, NULL_HINT, NO_ALLOC );
ASSERT(table->values);
ocrAssert(table->values);

table->values++;
table->n = n;
Expand Down Expand Up @@ -864,7 +864,7 @@ void eamReadFuncfl(EamPotential* pot, const char* dir, const char* potName)

void typeNotSupported(const char* callSite, const char* type)
{
PRINTF("%s: Potential type %s not supported. Fatal Error.\n", callSite, type);
ocrPrintf("%s: Potential type %s not supported. Fatal Error.\n", callSite, type);
ocrShutdown();
}

Expand Down
22 changes: 11 additions & 11 deletions apps/CoMD/refactored/ocr/intel-chandra-tiled/haloExchange.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ void initAtomHaloExchange(HaloExchange* hh, Domain* domain, LinkCell* boxes)
ocrHint_t myDbkAffinityHNT;
ocrHintInit( &myDbkAffinityHNT, OCR_HINT_DB_T );
#ifdef USE_EAGER_DB_HINT
if( domain->procCoord[0]==0 && domain->procCoord[1]==0 && domain->procCoord[2]==0 ) PRINTF("Using Eager DB hint\n");
if( domain->procCoord[0]==0 && domain->procCoord[1]==0 && domain->procCoord[2]==0 ) ocrPrintf("Using Eager DB hint\n");
ocrSetHintValue(&myDbkAffinityHNT, OCR_HINT_DB_EAGER, 1);
#else
ocrGuid_t currentAffinity = NULL_GUID;
Expand Down Expand Up @@ -744,7 +744,7 @@ ocrDBK_t mkAtomCellList(int** list_PTR, LinkCell* boxes, enum HaloFaceOrder iFac
for (int iy=yBegin; iy<yEnd; ++iy)
for (int iz=zBegin; iz<zEnd; ++iz)
list[count++] = getBoxFromTuple(boxes, ix, iy, iz);
ASSERT(count == nCells);
ocrAssert(count == nCells);
return DBK_list;
}

Expand Down Expand Up @@ -971,7 +971,7 @@ void unloadAtomsBuffer(void* vparms, void* data, int face, int bufSize, char* ch
SimFlat* s = (SimFlat*) data;
AtomMsg* buf = (AtomMsg*) charBuf;
int nBuf = bufSize / sizeof(AtomMsg);
ASSERT(bufSize % sizeof(AtomMsg) == 0);
ocrAssert(bufSize % sizeof(AtomMsg) == 0);

for (int ii=0; ii<nBuf; ++ii)
{
Expand Down Expand Up @@ -1035,7 +1035,7 @@ ocrDBK_t mkForceSendCellList(int** list_PTR, LinkCell* boxes, int face, int nCel
xBegin=-1; xEnd=nx+1; yBegin=-1; yEnd=ny+1; zBegin=nz-1; zEnd=nz;
break;
default:
ASSERT(1==0);
ocrAssert(1==0);
}

int count = 0;
Expand All @@ -1044,7 +1044,7 @@ ocrDBK_t mkForceSendCellList(int** list_PTR, LinkCell* boxes, int face, int nCel
for (int iz=zBegin; iz<zEnd; ++iz)
list[count++] = getBoxFromTuple(boxes, ix, iy, iz);

ASSERT(count == nCells);
ocrAssert(count == nCells);
return DBK_list;
}

Expand Down Expand Up @@ -1087,7 +1087,7 @@ ocrDBK_t mkForceRecvCellList(int** list_PTR, LinkCell* boxes, int face, int nCel
xBegin=-1; xEnd=nx+1; yBegin=-1; yEnd=ny+1; zBegin=nz; zEnd=nz+1;
break;
default:
ASSERT(1==0);
ocrAssert(1==0);
}

int count = 0;
Expand All @@ -1096,7 +1096,7 @@ ocrDBK_t mkForceRecvCellList(int** list_PTR, LinkCell* boxes, int face, int nCel
for (int iz=zBegin; iz<zEnd; ++iz)
list[count++] = getBoxFromTuple(boxes, ix, iy, iz);

ASSERT(count == nCells);
ocrAssert(count == nCells);
return DBK_list;
}

Expand Down Expand Up @@ -1286,7 +1286,7 @@ void unloadForceBuffer(void* vparms, void* vdata, int face, int bufSize, char* c
ForceExchangeParms* parms = (ForceExchangeParms*) vparms;
ForceExchangeData* data = (ForceExchangeData*) vdata;
ForceMsg* buf = (ForceMsg*) charBuf;
ASSERT(bufSize % sizeof(ForceMsg) == 0);
ocrAssert(bufSize % sizeof(ForceMsg) == 0);

int nCells = parms->nCells[face];
int* cellList = parms->recvCells[face];
Expand All @@ -1301,7 +1301,7 @@ void unloadForceBuffer(void* vparms, void* vdata, int face, int bufSize, char* c
++iBuf;
}
}
ASSERT(iBuf == bufSize/ sizeof(ForceMsg));
ocrAssert(iBuf == bufSize/ sizeof(ForceMsg));
}

void destroyForceExchange(void* vparms)
Expand Down Expand Up @@ -1405,13 +1405,13 @@ ocrGuid_t sortAtomsInCellsEdt( EDT_ARGS )
/// A function suitable for passing to qsort to sort atoms by gid.
/// Because every atom in the simulation is supposed to have a unique
/// id, this function checks that the atoms have different gids. If
/// that ASSERTion ever fails it is a sign that something has gone
/// that ocrAssertion ever fails it is a sign that something has gone
/// wrong elsewhere in the code.
int sortAtomsById(const void* a, const void* b)
{
int aId = ((AtomMsg*) a)->gid;
int bId = ((AtomMsg*) b)->gid;
ASSERT(aId != bId);
ocrAssert(aId != bId);

if (aId < bId)
return -1;
Expand Down
2 changes: 1 addition & 1 deletion apps/CoMD/refactored/ocr/intel-chandra-tiled/initAtoms.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void createFccLattice(int nx, int ny, int nz, real_t lat, SimFlat* s)
//stopTimer(commReduceTimer);
s->atoms->nGlobal = nb*nx*ny*nz;

ASSERT(s->atoms->nGlobal == nb*nx*ny*nz);
ocrAssert(s->atoms->nGlobal == nb*nx*ny*nz);
}

void adjustVcm(SimFlat* s, real_t *oldVcm, real_t *newVcm )
Expand Down
Loading

0 comments on commit d8f48ba

Please sign in to comment.