IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38429


Ignore:
Timestamp:
Jun 8, 2015, 11:46:15 AM (11 years ago)
Author:
eugene
Message:

add compression timing and fix opt build issues

Location:
branches/eam_branches/ohana.20150429/src/libfits
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ohana.20150429/src/libfits/table/F_compress_T.c

    r38418 r38429  
    2424int gfits_collect_table_gzp2 (FTable *table, TableField *field, char *raw, int row_start, int Nrows);
    2525
     26static float timeSum1 = 0.0;
     27static float timeSum2 = 0.0;
     28static float timeSum2a = 0.0;
     29static float timeSum2b = 0.0;
     30static float timeSum2c = 0.0;
     31static float timeSum2d = 0.0;
     32static float timeSum2e = 0.0;
     33static float timeSum3 = 0.0;
     34
     35void gfits_compress_timing () {
     36  fprintf (stderr, "cmp times: %f %f %f\n", timeSum1, timeSum2, timeSum3);
     37  fprintf (stderr, "cmp times: %f %f %f %f %f\n", timeSum2a, timeSum2b, timeSum2c, timeSum2d, timeSum2e);
     38
     39  timeSum1 = 0.0;
     40  timeSum2 = 0.0;
     41  timeSum2a = 0.0;
     42  timeSum2b = 0.0;
     43  timeSum2c = 0.0;
     44  timeSum2d = 0.0;
     45  timeSum2e = 0.0;
     46  timeSum3 = 0.0;
     47}
     48
    2649int gfits_compress_table (FTable *srctable, FTable *tgttable, int ztilelen, char *zcmptype) {
    2750
     
    3558  Header *srcheader = srctable->header;
    3659  Header *tgtheader = tgttable->header;
     60
     61  // XXX EAM:
     62  struct timeval startTimer, stopTimer;
     63  float dtime;
     64  gettimeofday (&startTimer, (void *) NULL);
    3765
    3866  int Ntile, ztilelast;
     
    6492  if (!gfits_scan (srcheader, "TFIELDS", "%d", 1, &Nfields)) ESCAPE;
    6593
     94  // XXX TIMER 1
     95  gettimeofday (&stopTimer, (void *) NULL);
     96  dtime = DTIME (stopTimer, startTimer);
     97  timeSum1 += dtime;
     98  gettimeofday (&startTimer, (void *) NULL);
     99
    66100  TableField *fields = NULL;
    67101  ALLOCATE_ZERO (fields, TableField, Nfields);
     
    181215  gfits_dump_raw_table (srctable, "cmp");
    182216
     217  // XXX TIMER 2
     218  gettimeofday (&stopTimer, (void *) NULL);
     219  dtime = DTIME (stopTimer, startTimer);
     220  timeSum2 += dtime;
     221  gettimeofday (&startTimer, (void *) NULL);
     222
    183223  // compress the data : copy into a tile, compress the tile, then add to the output table
    184224  // each tile -> 1 row of the output table
     
    186226
    187227    for (j = 0; j < Nfields; j++) {
     228
     229      gettimeofday (&startTimer, (void *) NULL);
    188230
    189231      int Nrows = (i == Ntile - 1) ? ztilelast : ztilelen;
     
    199241      }
    200242     
     243      // XXX TIMER 2a
     244      gettimeofday (&stopTimer, (void *) NULL);
     245      dtime = DTIME (stopTimer, startTimer);
     246      timeSum2a += dtime;
     247      gettimeofday (&startTimer, (void *) NULL);
     248 
    201249      if (VERBOSE_DUMP) {
    202250        int k;
     
    217265      }
    218266
     267      // XXX TIMER 2b
     268      gettimeofday (&stopTimer, (void *) NULL);
     269      dtime = DTIME (stopTimer, startTimer);
     270      timeSum2b += dtime;
     271      gettimeofday (&startTimer, (void *) NULL);
     272 
    219273      if (VERBOSE_DUMP) {
    220274        int k;
     
    231285      if (!gfits_compress_data (zdata, &Nzdata, fields[j].zctype, NULL, NULL, 0, raw, Nraw, fields[j].pixsize, 0, 0)) ESCAPE;
    232286     
     287      // XXX TIMER 2c
     288      gettimeofday (&stopTimer, (void *) NULL);
     289      dtime = DTIME (stopTimer, startTimer);
     290      timeSum2c += dtime;
     291      gettimeofday (&startTimer, (void *) NULL);
     292 
    233293      if (VERBOSE_DUMP) {
    234294        int k;
     
    250310      }
    251311
     312      // XXX TIMER 2d
     313      gettimeofday (&stopTimer, (void *) NULL);
     314      dtime = DTIME (stopTimer, startTimer);
     315      timeSum2d += dtime;
     316      gettimeofday (&startTimer, (void *) NULL);
     317 
    252318      if (VERBOSE_DUMP) {
    253319        int k;
     
    262328
    263329      if (!gfits_varlength_column_add_data (tgttable, zdata, Nzdata, i, &fields[j].zdef)) ESCAPE;
     330      // XXX TIMER 2e
     331      gettimeofday (&stopTimer, (void *) NULL);
     332      dtime = DTIME (stopTimer, startTimer);
     333      timeSum2e += dtime;
     334      gettimeofday (&startTimer, (void *) NULL);
     335 
    264336    }
    265337  }
     
    268340    if (!gfits_varlength_column_finish (tgttable, &fields[i].zdef)) ESCAPE;
    269341  }
     342
     343  // XXX TIMER 3
     344  gettimeofday (&stopTimer, (void *) NULL);
     345  dtime = DTIME (stopTimer, startTimer);
     346  timeSum3 += dtime;
     347  gettimeofday (&startTimer, (void *) NULL);
    270348
    271349  gfits_dump_cmp_table (tgttable, "cmp");
  • branches/eam_branches/ohana.20150429/src/libfits/table/F_table_varlength.c

    r38425 r38429  
    119119void *gfits_varlength_column_pointer (FTable *ftable, VarLengthColumn *column, off_t row, off_t *length) {
    120120
    121   void *result;
    122   off_t offset, Nx;
    123 
    124121  if ((column->mode != 'P') && (column->mode != 'Q')) abort();
    125122
    126123  // find the values for the specified row
    127124  // the values in the main table for this row and varlength column:
    128   Nx = ftable->header->Naxis[0];
     125  off_t Nx = ftable->header->Naxis[0];
     126  off_t offset = 0;
    129127
    130128  if (column->mode == 'P') {
     
    143141  // fprintf (stderr, "length: %d, offset: %d\n", (int) *length, (int) offset);
    144142
    145   result = (void *) (ftable->buffer + ftable->heap_start + offset);
     143  void *result = (void *) (ftable->buffer + ftable->heap_start + offset);
    146144  return result;
    147145}
  • branches/eam_branches/ohana.20150429/src/libfits/table/F_uncompress_T.c

    r38425 r38429  
    5858
    5959void gfits_uncompress_timing () {
    60   fprintf (stderr, "times: %f %f %f\n", timeSum1, timeSum2, timeSum3);
    61   fprintf (stderr, "times: %f %f %f %f %f %f\n", timeSum2a, timeSum2b, timeSum2c, timeSum2d, timeSum2e, timeSum2f);
     60  fprintf (stderr, "unc times: %f %f %f\n", timeSum1, timeSum2, timeSum3);
     61  fprintf (stderr, "unc times: %f %f %f %f %f %f\n", timeSum2a, timeSum2b, timeSum2c, timeSum2d, timeSum2e, timeSum2f);
    6262
    6363  timeSum1 = 0.0;
  • branches/eam_branches/ohana.20150429/src/libfits/test/tcomptiming.c

    r38426 r38429  
    88char *cmptype[] = {"NONE", "NONE_1", "NONE_2", "GZIP_1", "GZIP_2", "RICE_1", "RICE_ONE", "AUTO", NULL};
    99
    10 static int Nval = 1000000;
     10static int Nval = 10000000;
    1111
    1212int main (int argc, char **argv) {
     
    2424  for (lNtile = 1.0; lNtile < lNtileMax; lNtile += 1.0) {
    2525    int Ntile = pow (10.0, lNtile);
     26    fprintf (stderr, "--- Ntile = %d ---\n", Ntile);
    2627    test_compress_timing ("NONE_2", Ntile);
    27     fprintf (stderr, "--- Ntile = %d ---\n", Ntile);
     28    gfits_compress_timing();
    2829    gfits_uncompress_timing();
    2930  }
     
    5455  ok (gfits_create_table (&header, &ftable), "created the basic table");
    5556
     57  // XXX EAM:
     58  struct timeval startTimer, stopTimer;
     59  float dtime;
     60  gettimeofday (&startTimer, (void *) NULL);
     61
     62  float timeSum1 = 0.0;
     63  float timeSum2 = 0.0;
     64  float timeSum3 = 0.0;
     65  float timeSum4 = 0.0;
     66  float timeSum5 = 0.0;
     67  float timeSum6 = 0.0;
     68  float timeSum7 = 0.0;
     69
    5670  char    *VAL_B;  ALLOCATE (VAL_B, char,    Nval);
    5771  short   *VAL_I;  ALLOCATE (VAL_I, short,   Nval);
     
    6478  srand48(A);
    6579
     80  // XXX TIMER 1
     81  gettimeofday (&stopTimer, (void *) NULL);
     82  dtime = DTIME (stopTimer, startTimer);
     83  timeSum1 += dtime;
     84  gettimeofday (&startTimer, (void *) NULL);
     85
    6686  int i;
    6787  for (i = 0; i < Nval; i++) {
     
    7494  }     
    7595
     96  // XXX TIMER 1
     97  gettimeofday (&stopTimer, (void *) NULL);
     98  dtime = DTIME (stopTimer, startTimer);
     99  timeSum2 += dtime;
     100  gettimeofday (&startTimer, (void *) NULL);
     101
    76102  // add the columns to the output array
    77103  ok (gfits_set_bintable_column (&header, &ftable, "VAL_B", VAL_B, Nval), "set byte   table column");
     
    82108  ok (gfits_set_bintable_column (&header, &ftable, "VAL_D", VAL_D, Nval), "set double table column");
    83109
     110  // XXX TIMER 1
     111  gettimeofday (&stopTimer, (void *) NULL);
     112  dtime = DTIME (stopTimer, startTimer);
     113  timeSum3 += dtime;
     114  gettimeofday (&startTimer, (void *) NULL);
     115
    84116  Header *outheader = &header;
    85117  FTable *outtable = &ftable;
     
    107139  off_t Nrow;
    108140
     141  // XXX TIMER 1
     142  gettimeofday (&stopTimer, (void *) NULL);
     143  dtime = DTIME (stopTimer, startTimer);
     144  timeSum4 += dtime;
     145  gettimeofday (&startTimer, (void *) NULL);
     146
    109147  char    *VAL_B_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_B", type, &Nrow, &Ncol); ok (!strcmp (type, "byte"),    "read byte    table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
    110148  short   *VAL_I_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_I", type, &Nrow, &Ncol); ok (!strcmp (type, "short"),   "read short   table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
     
    113151  float   *VAL_E_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_E", type, &Nrow, &Ncol); ok (!strcmp (type, "float"),   "read float   table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
    114152  double  *VAL_D_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_D", type, &Nrow, &Ncol); ok (!strcmp (type, "double"),  "read double  table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
     153
     154  // XXX TIMER 1
     155  gettimeofday (&stopTimer, (void *) NULL);
     156  dtime = DTIME (stopTimer, startTimer);
     157  timeSum5 += dtime;
     158  gettimeofday (&startTimer, (void *) NULL);
    115159
    116160  // count mismatched values
     
    131175  }
    132176
     177  // XXX TIMER 1
     178  gettimeofday (&stopTimer, (void *) NULL);
     179  dtime = DTIME (stopTimer, startTimer);
     180  timeSum6 += dtime;
     181  gettimeofday (&startTimer, (void *) NULL);
     182
    133183  ok (!NVAL_B_bad, "byte    values match (input vs output)");
    134184  ok (!NVAL_I_bad, "short   values match (input vs output)");
     
    144194    gfits_free_table (outtable);
    145195  }
     196  // XXX TIMER 1
     197  gettimeofday (&stopTimer, (void *) NULL);
     198  dtime = DTIME (stopTimer, startTimer);
     199  timeSum7 += dtime;
     200  gettimeofday (&startTimer, (void *) NULL);
     201
     202  fprintf (stderr, "out times: %f %f %f %f %f %f %f\n", timeSum1, timeSum2, timeSum3, timeSum4, timeSum5, timeSum6, timeSum7);
     203
    146204  return TRUE;
    147205}
Note: See TracChangeset for help on using the changeset viewer.