Changeset 8228

Show
Ignore:
Timestamp:
02/03/10 11:59:50 (3 years ago)
Author:
sson
Message:

added some timing measurement calls for bmi and trove.

Location:
branches/as-branch
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • branches/as-branch/src/client/sysint/client-state-machine.c

    r7633 r8228  
    450450    } 
    451451    gen_mutex_unlock(&test_mutex); 
    452     return js.error_code; 
    453 } 
     452    return js.error_code;} 
     453 
    454454 
    455455PVFS_error PINT_client_state_machine_release( 
  • branches/as-branch/src/common/misc/state-machine-fns.c

    r7830 r8228  
    1111#include <string.h> 
    1212#include <assert.h> 
    13 #include <stdlib.h> /* sson */ 
    1413 
    1514#include "gossip.h" 
  • branches/as-branch/src/io/bmi/bmi_tcp/bmi-tcp.c

    r7872 r8228  
    392392{ 
    393393    TCP_MODE_EAGER_LIMIT = 16384,       /* 16K */ 
    394     TCP_MODE_REND_LIMIT = 16777216*6    /* 16M */ /* sson: 96MB */ 
     394    TCP_MODE_REND_LIMIT = 16777216*32   /* 16M */ /* sson: 96MB */ 
    395395}; 
    396396 
     
    14481448                       bmi_tcp_pid, NULL, query_op->event_id, 
    14491449                       query_op->actual_size); 
     1450#if 0 
     1451                struct timeval tv; 
     1452                gettimeofday(&tv, NULL); 
     1453                double t1 = tv.tv_sec+(tv.tv_usec/1000000.0); 
     1454                printf("end(%s): %f\n", ((query_op->send_recv==BMI_SEND)?"BMI_SEND":"BMI_RECV"), t1); 
     1455#endif 
     1456 
    14501457 
    14511458        dealloc_tcp_method_op(query_op); 
     
    25432550        PINT_HINT_GET_OP_ID(hints), 
    25442551        expected_size); 
    2545  
     2552#if 0 
     2553    /* sson */ 
     2554    struct timeval tv;  
     2555    gettimeofday(&tv, NULL); 
     2556    double t1 = tv.tv_sec+(tv.tv_usec/1000000.0); 
     2557    printf("start(%s): %f\n", "BMI_RECV", t1); 
     2558#endif 
    25462559    tcp_addr_data = src->method_data; 
    25472560 
     
    39583971        PINT_HINT_GET_OP_ID(hints), 
    39593972        total_size); 
     3973#if 0 
     3974    /* sson */ 
     3975    struct timeval tv; 
     3976    gettimeofday(&tv, NULL); 
     3977    double t1 = tv.tv_sec+(tv.tv_usec/1000000.0); 
     3978    if(bmi_tracing==1)  
     3979        printf("start(%s): %f(event_id=%d,tcp_id=%d)\n", "BMI_SEND", t1, bmi_tcp_send_event_id, bmi_tcp_pid); 
     3980#endif 
    39603981 
    39613982    /* Three things can happen here: 
  • branches/as-branch/src/server/io.sm

    r8137 r8228  
    2525#define NUM_OF_PARALLEL_SMS 1 
    2626#define BUFFER_SIZE (1024*1024) /* 1MB */ 
     27 
     28double bmi_time, trove_time, io_time; 
     29double sio, eio; 
     30int iotype=0; /* 1: READ, 2: WRITE */ 
    2731 
    2832%% 
     
    180184    s_op->u.io.file_data.server_nr = s_op->req->u.io.server_nr; 
    181185    s_op->u.io.file_data.server_ct = s_op->req->u.io.server_ct; 
     186 
     187    if(iotype != s_op->req->u.io.io_type) { 
     188        iotype = s_op->req->u.io.io_type; 
     189        bmi_time = trove_time = 0.0; 
     190        io_time = 0.0; 
     191        printf("\n\n%s\n", (iotype==1)?"READ":"WRITE"); 
     192    } 
    182193 
    183194    /* on writes, we allow the bstream to be extended at EOF */ 
     
    362373    } 
    363374 
     375    struct timeval tv;  
     376    gettimeofday(&tv, NULL); 
     377    sio = tv.tv_sec+(tv.tv_usec/1000000.0); 
     378 
    364379    js_p->error_code = 0; 
    365380    return SM_ACTION_COMPLETE; 
     
    377392    { 
    378393        pipeline_op = PINT_sm_pop_frame(smcb, &task_id, &tmp_err,  
    379                                         &remaining); 
     394                                        &remaining); 
    380395        gossip_debug(GOSSIP_SERVER_DEBUG,  
    381                      "io: nested sm returned error code: %d\n", tmp_err); 
     396                     "io: nested sm returned error code: %d\n", tmp_err); 
    382397        if(pipeline_op->u.pipeline.buffer) { 
    383398            if(s_op->req->u.io.io_type == PVFS_IO_READ) { 
    384399                if(pipeline_op->u.pipeline.op != 0 &&  
    385400                   pipeline_op->u.pipeline.op != (0x5800000f)) 
    386                     memcpy(s_op->u.io.tmp_buffer,  
    387                            pipeline_op->u.pipeline.buffer,  
    388                            sizeof(double)); /* FIXME */ 
     401                    if(s_op->u.io.tmp_buffer != NULL) 
     402                        memcpy(s_op->u.io.tmp_buffer,  
     403                               pipeline_op->u.pipeline.buffer,  
     404                               sizeof(double)); 
    389405                BMI_memfree(pipeline_op->u.pipeline.address,  
    390406                            pipeline_op->u.pipeline.buffer,  
     
    404420} 
    405421 
    406                                           
    407422/* 
    408423 * Function: io_release() 
     
    436451} 
    437452 
    438 /* 
     453 
     454/*  
    439455 * Function: io_cleanup() 
    440456 * 
     
    468484        free(s_op->u.io.tmp_buffer); /* FIXME */ 
    469485 
    470     gen_mutex_destroy(&s_op->u.io.mutex); /* FIXME: */ 
    471  
     486    gen_mutex_destroy(&s_op->u.io.mutex); /* FIXME */ 
     487 
     488    //printf("event_id=%d\n", s_op->event_id); // always 0 
     489    printf("bmi_time=%f, trove_time=%f, total=%f\n", bmi_time, trove_time, bmi_time+trove_time); 
     490    struct timeval tv;  
     491    gettimeofday(&tv, NULL); 
     492    eio = tv.tv_sec+(tv.tv_usec/1000000.0); 
     493    io_time = eio - sio; 
     494    printf("io_time=%f\n", io_time); 
    472495    /* let go of our encoded response buffer, if we appear to have 
    473496     * made one 
  • branches/as-branch/src/server/kmeans.sm

    r8129 r8228  
    1616#include <assert.h> 
    1717#include <math.h> 
     18#include <time.h> 
    1819 
    1920#include "server-config.h" 
     
    2829#include "kmeans.h" 
    2930 
    30 #include <cuda.h> 
    31 #include <cuda_runtime.h> 
     31//#include <cuda.h> 
     32//#include <cuda_runtime.h> 
    3233 
    3334extern void initGPU (float* objects, int numDataPoints, 
     
    5051int device_initialized=0; 
    5152#define MAX_ITERATIONS 500 
     53 
     54struct timeval td_start, td_end; 
    5255 
    5356%% 
     
    311314        /* initialize GPU device and allocate memory on it */ 
    312315        if(device_initialized == 0) { 
     316            time_t start, end; 
    313317            /* initDevice(argc, argv, numObjs, numCoords, numClusters) */ 
     318            gossip_debug(GOSSIP_IO_DEBUG, "before initGPU\n"); 
     319            time(&start); 
    314320            initGPU(s_op->u.kmeans.objects[0], s_op->u.kmeans.numObjs, 
    315321                    s_op->u.kmeans.numCoords, s_op->u.kmeans.numClusters); 
     322            time(&end); 
     323            gossip_debug(GOSSIP_IO_DEBUG, "after initGPU: elapsed=%lf ms\n", 
     324                         difftime(end, start)*1000); 
    316325            /* FIXME: I don't know why this is called twice */ 
    317326            device_initialized = 1; 
  • branches/as-branch/src/server/pipeline.sm

    r8137 r8228  
    4545int NUM_CLUSTERS; /* for kmeans only */ 
    4646#define TMP_BUF_SIZ 128 
     47 
     48extern double bmi_time, trove_time; /* sson */ 
     49double bs1, bs2, br1, br2, tr1, tr2, tw1, tw2; 
    4750 
    4851%% 
     
    165168    s_op->u.pipeline.segs = count; 
    166169 
    167     if(s_op->u.pipeline.io_type == PVFS_IO_READ) {       
     170    if(s_op->u.pipeline.io_type == PVFS_IO_READ) { 
     171        struct timeval tv;  
     172        gettimeofday(&tv, NULL); 
     173        tr1 = tv.tv_sec+(tv.tv_usec/1000000.0); 
     174        //printf("start(%s): %f\n", "TROVE_READ", t1); 
    168175        ret = job_trove_bstream_read_list 
    169176            (s_op->u.pipeline.fs_id, 
     
    186193    } 
    187194    else if (s_op->u.pipeline.io_type == PVFS_IO_WRITE) { 
     195        struct timeval tv;  
     196        gettimeofday(&tv, NULL); 
     197        br1 = tv.tv_sec+(tv.tv_usec/1000000.0); 
     198        //printf("start(%s): %f\n", "BMI_RECV", t1); 
    188199        ret = job_bmi_recv(s_op->u.pipeline.address, 
    189200                       (void *)s_op->u.pipeline.buffer, 
     
    191202                       s_op->u.pipeline.tag, 
    192203                       BMI_PRE_ALLOC,  
    193                        smcb,  
     204                       smcb,  
    194205                       0, /* unsigned long status_user_tag = 0 */ 
    195206                       js_p, 
     
    197208                       server_job_context, 
    198209                       user_opts->server_job_flow_timeout, 
    199                        (bmi_hint)s_op->u.pipeline.hints); 
     210                       (bmi_hint)s_op->u.pipeline.hints); 
    200211    } 
    201212 
     
    235246    struct server_configuration_s *user_opts = get_server_config_struct(); 
    236247 
     248    struct timeval tv;  
     249    gettimeofday(&tv, NULL); 
     250    if(s_op->u.pipeline.io_type==PVFS_IO_READ) { 
     251        tr2 = tv.tv_sec+(tv.tv_usec/1000000.0); 
     252        //printf("end(%s): %f\n", "TROVE_READ", tr2); 
     253        trove_time += tr2-tr1; 
     254    } 
     255    else if(s_op->u.pipeline.io_type==PVFS_IO_WRITE) { 
     256        br2 = tv.tv_sec+(tv.tv_usec/1000000.0); 
     257        //printf("end(%s): %f\n", "BMI_RECV", br2); 
     258        bmi_time += br2-br1; 
     259    } 
     260 
    237261    if(s_op->u.pipeline.segs == 0) { 
    238262        js_p->error_code = 0; 
     
    258282        assert(s_op->u.pipeline.buffer_used); 
    259283 
     284        struct timeval tv;  
     285        gettimeofday(&tv, NULL); 
     286        bs1 = tv.tv_sec+(tv.tv_usec/1000000.0); 
     287        //printf("start(%s): %f\n", "BMI_SEND", bs1); 
     288 
    260289        if(s_op->u.pipeline.op != 0) { /* AS: when op is specified */ 
    261290            ret = DO_COMP; /* AS: skip sending if op is specified */  
    262             gossip_debug(GOSSIP_IO_DEBUG, "%s: parent->op != 0\n", __func__); 
     291            gossip_debug(GOSSIP_IO_DEBUG, "%s: s_op->u.pipeline->op != 0\n", __func__); 
    263292            js_p->error_code = ret; 
    264293            return SM_ACTION_COMPLETE; 
    265294        }  
    266         else  
     295        else { 
    267296            ret = job_bmi_send(s_op->u.pipeline.address, 
    268297                               s_op->u.pipeline.buffer, 
     
    278307                               user_opts->server_job_bmi_timeout, 
    279308                               (bmi_hint)s_op->u.pipeline.hints); 
     309        } 
    280310         
    281311    } 
    282312    else if(s_op->u.pipeline.io_type == PVFS_IO_WRITE) { 
     313        struct timeval tv;  
     314        gettimeofday(&tv, NULL); 
     315        tw1 = tv.tv_sec+(tv.tv_usec/1000000.0); 
     316        //printf("start(%s): %f\n", "TROVE_WRITE", t1); 
    283317        ret = job_trove_bstream_write_list 
    284318            (s_op->u.pipeline.fs_id, 
     
    11791213    js_p->error_code = 0; 
    11801214 
     1215    struct timeval tv;  
     1216    gettimeofday(&tv, NULL); 
     1217    if(s_op->u.pipeline.io_type == PVFS_IO_READ) { 
     1218        bs2 = tv.tv_sec+(tv.tv_usec/1000000.0); 
     1219        //printf("end(%s): %f\n", "BMI_SEND", bs2); 
     1220        //printf("bmi_time=%f\n", bmi_time); 
     1221        bmi_time += bs2-bs1; 
     1222    } 
     1223    else if(s_op->u.pipeline.io_type == PVFS_IO_WRITE) { 
     1224        tw2 = tv.tv_sec+(tv.tv_usec/1000000.0); 
     1225        trove_time += tw2-tw1; 
     1226    } 
     1227 
    11811228    /* FIMXE: do we really need this lock? */ 
    11821229    gen_mutex_lock(&parent_s_op->u.io.mutex); 
  • branches/as-branch/test/active-storage/simple.c

    r8129 r8228  
    1414    "       -g : use generated file\n" 
    1515    "       -s size : file size to generate in MB\n" 
    16     "       -x : test active storage module\n"; 
     16    "       -x : test active storage module\n" 
     17    "       -t : test normal storage module\n"; 
    1718  fprintf(stderr, help, argv0); 
    1819} 
     
    3132  extern int     optind; 
    3233  int is_output_timing=0, is_print_usage = 0; 
    33   int _debug=0, use_gen_file = 0, use_actsto = 0; 
     34  int _debug=0, use_gen_file = 0, use_actsto = 0, use_normalsto=0; 
    3435 
    3536  MPI_Offset disp, offset, file_size; 
     
    5758  MPI_Comm_rank( comm, &rank ); 
    5859  
    59   while ( (opt=getopt(argc,argv,"i:s:godhx"))!= EOF) { 
     60  while ( (opt=getopt(argc,argv,"i:s:godhxt"))!= EOF) { 
    6061    switch (opt) { 
    6162    case 'i': fname = optarg; 
     
    8586    case 'x': use_actsto = 1; 
    8687      break; 
     88    case 't': use_normalsto = 1; 
     89      break; 
    8790    default: is_print_usage = 1; 
    8891      break; 
     
    9497    MPI_Finalize(); 
    9598    exit(1); 
     99  } 
     100  if(use_normalsto == 1 && use_actsto == 1) { 
     101      if(rank == 0) 
     102          printf("Can't test both: either normalsto or actsto\n"); 
     103      MPI_Finalize(); 
     104      exit(1); 
    96105  } 
    97106  
     
    133142    } 
    134143 
     144    stime = MPI_Wtime(); 
    135145    /* Write to file */ 
    136146    MPI_File_write_all( fh, buf, nitem, MPI_DOUBLE, &status ); 
     147    etime = MPI_Wtime(); 
     148    iotime = etime - stime; 
     149       
     150    printf("%d: iotime (write) = %10.4f\n", rank, iotime); 
    137151 
    138152    MPI_Get_count( &status, MPI_DOUBLE, &count ); 
     
    149163    MPI_File_close(&fh); 
    150164  } 
    151    
    152   MPI_File_open( comm, fname, MPI_MODE_RDWR, MPI_INFO_NULL, &fh ); 
    153   /* Read nothing (check status) */ 
    154   memset( &status, 0xff, sizeof(MPI_Status) ); 
    155165 
    156166  double *tmp = (double *)malloc( nitem * sizeof(double) ); 
    157   offset = rank * nitem * type_size; 
    158  
    159   /* start I/O */ 
    160   stime = MPI_Wtime(); 
    161   MPI_File_read_at(fh, offset, tmp, nitem, MPI_DOUBLE, &status); 
    162   etime = MPI_Wtime(); 
    163   /* end I/O */ 
    164   iotime = etime - stime; 
    165  
    166   if(_debug==1) printf("%d: iotime = %10.4f\n", rank, iotime); 
    167   MPI_Reduce(&iotime, &max_iotime, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD); 
    168   
    169   sum = 0.0; /* reset sum */ 
    170  
    171   /* start computation */ 
    172   stime = MPI_Wtime(); 
    173  
    174   for(i=0; i<nitem; i++) { 
    175       sum += tmp[i]; 
    176   } 
    177  
    178   MPI_Reduce(&sum, &global_sum, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD); 
    179   etime = MPI_Wtime(); 
    180   /* end computation */ 
    181  
    182   comptime = etime - stime; 
    183  
    184   if(_debug==1) printf("%d: comptime = %10.4f\n", rank, comptime); 
    185  
    186   MPI_Reduce(&comptime, &max_comptime, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD); 
    187  
    188   if(rank == 0) { 
    189       elapsed_time = max_comptime + max_iotime; 
    190       printf("<<Result (SUM) with normal read>>\n" 
    191              "SUM              = %10.4f \n" 
    192              "Computation time = %10.4f sec\n" 
    193              "I/O time         = %10.4f sec\n" 
    194              "total time       = %10.4f sec\n\n",  
    195              global_sum, max_comptime, max_iotime, elapsed_time); 
    196   } 
    197        
    198   MPI_File_close(&fh); 
     167 
     168  if(use_normalsto == 1) { 
     169      MPI_File_open( comm, fname, MPI_MODE_RDWR, MPI_INFO_NULL, &fh ); 
     170      /* Read nothing (check status) */ 
     171      memset( &status, 0xff, sizeof(MPI_Status) ); 
     172       
     173      offset = rank * nitem * type_size; 
     174 
     175      /* start I/O */ 
     176      stime = MPI_Wtime(); 
     177      MPI_File_read_at(fh, offset, tmp, nitem, MPI_DOUBLE, &status); 
     178      etime = MPI_Wtime(); 
     179      /* end I/O */ 
     180      iotime = etime - stime; 
     181       
     182      if(_debug==1) printf("%d: iotime = %10.4f\n", rank, iotime); 
     183      MPI_Reduce(&iotime, &max_iotime, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD); 
     184       
     185      sum = 0.0; /* reset sum */ 
     186       
     187      /* start computation */ 
     188      stime = MPI_Wtime(); 
     189       
     190      for(i=0; i<nitem; i++) { 
     191          sum += tmp[i]; 
     192      } 
     193       
     194      MPI_Reduce(&sum, &global_sum, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD); 
     195      etime = MPI_Wtime(); 
     196      /* end computation */ 
     197 
     198      comptime = etime - stime; 
     199 
     200      if(_debug==1) printf("%d: comptime = %10.4f\n", rank, comptime); 
     201       
     202      MPI_Reduce(&comptime, &max_comptime, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD); 
     203 
     204      if(rank == 0) { 
     205          elapsed_time = max_comptime + max_iotime; 
     206          printf("<<Result (SUM) with normal read>>\n" 
     207                 "SUM              = %10.4f \n" 
     208                 "Computation time = %10.4f sec\n" 
     209                 "I/O time         = %10.4f sec\n" 
     210                 "total time       = %10.4f sec\n\n",  
     211                 global_sum, max_comptime, max_iotime, elapsed_time); 
     212      } 
     213       
     214      MPI_File_close(&fh); 
     215  } 
    199216 
    200217  if(use_actsto == 1) { 
     218      memset(&status, 0xff, sizeof(MPI_Status)); 
     219      offset = rank * nitem * type_size; 
     220#if 0 
    201221    /* MPI_MAX */ 
    202222    MPI_File_open( comm, fname, MPI_MODE_RDWR, MPI_INFO_NULL, &fh ); 
     
    221241     
    222242    MPI_File_close(&fh); 
    223      
     243#endif 
    224244    /* MPI_SUM */ 
    225245    MPI_File_open( comm, fname, MPI_MODE_RDWR, MPI_INFO_NULL, &fh ); 
     
    229249    etime = MPI_Wtime(); 
    230250    elapsed_time = etime - stime; 
    231     printf ("sum=%lf (in %10.4f sec)\n", tmp[0], elapsed_time);  
     251    printf ("<<Result with active storage>>\n" 
     252            "sum=%lf (in %10.4f sec)\n", tmp[0], elapsed_time);  
    232253     
    233254    MPI_File_close( &fh ); 
  • branches/as-branch/test/active-storage/test_kmeans.c

    r8137 r8228  
    3737  MPI_Info info; 
    3838  float threshold = 0.0; 
     39  double stime, etime; 
    3940 
    4041  /* for KMEANS */ 
     
    118119    objects[i] = objects[i-1] + (numCoords); 
    119120 
    120    
     121  stime = MPI_Wtime();  
    121122  MPI_File_read_ex(fh, objects[0], (numObjs)*(numCoords), 
    122123                   MPI_FLOAT, MPI_KMEANS, &status); 
    123124 
     125  etime = MPI_Wtime(); 
     126  printf("%d: time =%10.4f\n", rank, etime-stime); 
    124127  //printf ("kmean=%lf\n", objects[0]);  
    125128