MeshStreamer and NDMeshStreamer: default to a single buffer per destination
authorLukasz Wesolowski <wesolwsk@illinois.edu>
Tue, 7 Feb 2012 23:00:41 +0000 (17:00 -0600)
committerLukasz Wesolowski <wesolwsk@illinois.edu>
Tue, 7 Feb 2012 23:00:41 +0000 (17:00 -0600)
when first argument to constructor is too small or invalid.

src/libs/ck-libs/MeshStreamer/MeshStreamer.h
src/libs/ck-libs/NDMeshStreamer/NDMeshStreamer.h

index 71278b721d75129d982bb861477c9687028825ec..9eea2345ef0315fc88e2e1748bcdb83ae2d1e186 100644 (file)
@@ -190,6 +190,11 @@ MeshStreamer<dtype>::MeshStreamer(int totalBufferCapacity, int numRows,
   //   advantage of nonuniform filling of buckets
   // the buffers for your own column and plane are never used
   bucketSize_ = BUCKET_SIZE_FACTOR * totalBufferCapacity / (numRows + numColumns + numPlanes - 2); 
+  if (bucketSize_ <= 0) {
+    bucketSize_ = 1; 
+    CkPrintf("Argument totalBufferCapacity to MeshStreamer constructor "
+            "is invalid. Defaulting to a single buffer per destination.\n");
+  }
   totalBufferCapacity_ = totalBufferCapacity;
   numDataItemsBuffered_ = 0; 
   numRows_ = numRows; 
index d7bfe9da3a5f07cfa1d12cc6e2f400a86164e60a..162b3c3f6150214ef33b426d8f0d23e853fcfb26 100644 (file)
@@ -190,6 +190,11 @@ MeshStreamer<dtype>::MeshStreamer(
   //   same index as the sender's are not used
   bucketSize_ = BUCKET_SIZE_FACTOR * totalBufferCapacity 
     / (sumAlongAllDimensions - numDimensions_ + 1); 
+  if (bucketSize_ <= 0) {
+    bucketSize_ = 1; 
+    CkPrintf("Argument totalBufferCapacity to MeshStreamer constructor "
+            "is invalid. Defaulting to a single buffer per destination.\n");
+  }
   totalBufferCapacity_ = totalBufferCapacity;
   numDataItemsBuffered_ = 0; 
   numNodes_ = CkNumPes();