ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/BioCocoa/BioSwarm/trunk/Simulation/BioSwarmMPIController.m
(Generate patch)
# Line 123 | Line 123
123             bc_sector_direction_string(i), nRank, c[0], c[1], c[2]);
124    }
125  
126 +  if (TIME_PROFILE) bc_record_time([[NSString stringWithFormat: @"initialize MPI rank = %d", rank] UTF8String]);
127 +
128    return self;
129   }
130  
# Line 163 | Line 165
165   - (void)initializeHierarchy
166   {
167    printf("initializeHierarchy\n");
168 +  if (TIME_PROFILE) bc_record_time([[NSString stringWithFormat: @"start MPI init simulation, rank = %d", rank] UTF8String]);
169    [super initializeHierarchy];
170 +  if (TIME_PROFILE) bc_record_time([[NSString stringWithFormat: @"end MPI init simulation, rank = %d", rank] UTF8String]);
171  
172    // if initialized from file, allow specific MPI initialization                                                                                                                                                
173    if (initializeFile) {
# Line 440 | Line 444
444    [modelObject finalizeGPUMPIData: NULL mode: mode];
445   }
446  
447 + void BC_MPI_record_time(void *model, const char *msg)
448 + {
449 +  id modelObject = (id)model;
450 +  id modelController = [modelObject modelController];
451 +  
452 +  if (TIME_PROFILE) bc_record_time([[NSString stringWithFormat: @"%s, rank = %d", msg, [modelController rank]] UTF8String]);
453 + }
454 +
455   //
456   // MPI enhancements to standard BioSwarmModel
457   //
# Line 569 | Line 581
581  
582    case BC_MPI_SEM_MODE_INIT: {
583      printf("BC_MPI_SEM_MODE_INIT\n");
584 +    if (TIME_PROFILE) bc_record_time([[NSString stringWithFormat: @"start MPI_INIT rank = %d", [modelController rank]] UTF8String]);
585  
586      // element map for each MPI neighbor
587      elementMapping = (id *)malloc(neighborSize * sizeof(id));
# Line 719 | Line 732
732      free(receiveElements);
733      free(packElements);
734  
735 +    if (TIME_PROFILE) bc_record_time([[NSString stringWithFormat: @"end MPI_INIT rank = %d", [modelController rank]] UTF8String]);
736      break;
737    }
738  
739    case BC_MPI_SEM_MODE_F1: {
740      printf("BC_MPI_SEM_MODE_F1\n");
741 +    if (TIME_PROFILE) bc_record_time([[NSString stringWithFormat: @"start MPI_F1 rank = %d", [modelController rank]] UTF8String]);
742  
743      if (receiveRequests) free(receiveRequests);
744      receiveRequests = malloc(neighborSize * sizeof(MPI_Request));
# Line 872 | Line 887
887      free(receiveElements);
888      free(packElements);
889  
890 +    if (TIME_PROFILE) bc_record_time([[NSString stringWithFormat: @"end MPI_F1 rank = %d", [modelController rank]] UTF8String]);
891      break;
892    }
893  
894    case BC_MPI_SEM_MODE_MOVE_READ_ONLY: {
895      printf("BC_MPI_SEM_MODE_MOVE_READ_ONLY\n");
896 +    if (TIME_PROFILE) bc_record_time([[NSString stringWithFormat: @"start MPI_MOVE_READ_ONLY rank = %d", [modelController rank]] UTF8String]);
897  
898      if (receiveRequests) free(receiveRequests);
899      receiveRequests = malloc(neighborSize * sizeof(MPI_Request));
# Line 1133 | Line 1150
1150      free(receiveElements);
1151      free(packElements);
1152  
1153 +    if (TIME_PROFILE) bc_record_time([[NSString stringWithFormat: @"end MPI_MOVE_READ_ONLY rank = %d", [modelController rank]] UTF8String]);
1154      break;
1155    }
1156  
1157    case BC_MPI_SEM_MODE_MOVE: {
1158      printf("BC_MPI_SEM_MODE_MOVE\n");
1159 +    if (TIME_PROFILE) bc_record_time([[NSString stringWithFormat: @"start MPI_MOVE rank = %d", [modelController rank]] UTF8String]);
1160  
1161      if (receiveRequests) free(receiveRequests);
1162      receiveRequests = malloc(neighborSize * sizeof(MPI_Request));
# Line 1354 | Line 1373
1373      free(receiveElements);
1374      free(packElements);
1375  
1376 +    if (TIME_PROFILE) bc_record_time([[NSString stringWithFormat: @"end MPI_MOVE rank = %d", [modelController rank]] UTF8String]);
1377      break;
1378    }
1379  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines