fixed a bug when it can not be negative when using unsigned
authorGengbin Zheng <gzheng@illinois.edu>
Tue, 11 Apr 2006 21:35:43 +0000 (21:35 +0000)
committerGengbin Zheng <gzheng@illinois.edu>
Tue, 11 Apr 2006 21:35:43 +0000 (21:35 +0000)
examples/ampi/alltoall/alltoall_VPtest.c

index eab61d740e9379cc4814b676a773bc26a74f7f29..0b906a2b370ac7e447d005827112e8f3b530f9e3 100644 (file)
@@ -113,8 +113,10 @@ main(int argc, char **argv){
   MPI_Barrier(MPI_COMM_WORLD); 
 
   memory_after = CmiMemoryUsage();
-  local_memory_max = CmiMaxMemoryUsage() - memory_before;
-  if (local_memory_max < 0) local_memory_max = 0;
+  if (CmiMaxMemoryUsage() < memory_before)  
+    local_memory_max = 0;
+  else
+    local_memory_max = CmiMaxMemoryUsage() - memory_before;
 
   // Reduce MAX here
   assert(MPI_SUCCESS==MPI_Reduce(&local_memory_max, &memory_max, 1, MPI_UNSIGNED_LONG, MPI_MAX, 0, MPI_COMM_WORLD));