Adding command line argument to specify control point data filename.
authorIsaac Dooley <isaacdooley@hope.cs.uiuc.edu>
Mon, 22 Feb 2010 22:47:20 +0000 (16:47 -0600)
committerIsaac Dooley <isaacdooley@hope.cs.uiuc.edu>
Mon, 22 Feb 2010 22:47:20 +0000 (16:47 -0600)
src/ck-cp/controlPoints.C
src/ck-cp/controlPoints.ci
src/ck-cp/controlPoints.h

index ce6c3d280321e1af3a62a322bb139c991cd16b0c..023228ad44fb2d2ea75037ab9887187131e02693 100644 (file)
@@ -38,6 +38,7 @@ static void periodicProcessControlPoints(void* ptr, double currWallTime);
 /* readonly */ bool shouldGatherMemoryUsage;
 /* readonly */ bool shouldGatherUtilization;
 /* readonly */ bool shouldGatherAll;
+/* readonly */ char CPDataFilename[512];
 
 
 
@@ -196,9 +197,6 @@ controlPointManager::controlPointManager(){
     instrumentedPhase * newPhase = new instrumentedPhase();
     allData.phases.push_back(newPhase);   
     
-    dataFilename = (char*)malloc(128);
-    sprintf(dataFilename, "controlPointData.txt");
-    
     frameworkShouldAdvancePhase = false;
     haveGranularityCallback = false;
 //    CkPrintf("[%d] controlPointManager() Constructor Initializing control points, and loading data file\n", CkMyPe());
@@ -238,7 +236,7 @@ controlPointManager::controlPointManager(){
 
   /// Loads the previous run data file
   void controlPointManager::loadDataFile(){
-    ifstream infile(dataFilename);
+    ifstream infile(CPDataFilename);
     vector<std::string> names;
     std::string line;
   
@@ -328,7 +326,7 @@ controlPointManager::controlPointManager(){
   /// Add the current data to allData and output it to a file
   void controlPointManager::writeDataFile(){
     CkPrintf("============= writeDataFile() ============\n");
-    ofstream outfile(dataFilename);
+    ofstream outfile(CPDataFilename);
     allData.cleanupNames();
 
     //  string s = allData.toString();
@@ -1056,6 +1054,13 @@ public:
       loadDataFileAtStartup = true;
     }
 
+    char *cpdatafile;
+    if( CmiGetArgStringDesc(args->argv, "+CPDataFilename", &cpdatafile, "Specify control point data file to save/load") ){
+      sprintf(CPDataFilename, "%s", cpdatafile);
+    } else {
+      sprintf(CPDataFilename, "controlPointData.txt");
+    }
+
 
     controlPointManagerProxy = CProxy_controlPointManager::ckNew();
   }
index 5107329833b6ee090c8f5a69ac3d5107a57499cf..07dd52304c6e3acf132e77c296f2e896abf9b365 100644 (file)
@@ -7,6 +7,9 @@ module ControlPoints {
   readonly bool shouldGatherMemoryUsage;
   readonly bool shouldGatherUtilization;
   readonly bool shouldGatherAll;
+  readonly char CPDataFilename[512];
+
+
 
   initproc void registerCPReductions(void);    
 
index 46a888ae1c0f9b6bf1c4acd44281797c631aec24..0936021a15f1e68deddc2d6edb8db776f1952cbb 100644 (file)
@@ -49,6 +49,7 @@
 /* readonly */ extern int whichTuningScheme;
 /* readonly */ extern bool writeDataFileAtShutdown;
 /* readonly */ extern bool loadDataFileAtStartup;
+/* readonly */ extern char CPDataFilename[512];
 
 
 
@@ -569,9 +570,7 @@ public:
 
 class controlPointManager : public CBase_controlPointManager {
 public:
-  
-  char * dataFilename;
-  
+    
   instrumentedData allData;
   
   /// The lower and upper bounds for each named control point