IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33944


Ignore:
Timestamp:
May 29, 2012, 4:18:58 PM (14 years ago)
Author:
eugene
Message:

split out time from csystem inits in dbExtractAverageInit to dbExtractAverageInitAve; allow option to skip result output for parallel ops; fix remote -reload; flush, fsync, fsetlockfile on remote command to ensure all machines see it (and report errors caught); handle equal value bins in threshold function; set global variable to hold the scrip name

Location:
branches/eam_branches/ipp-20120405/Ohana/src/opihi
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20120405/Ohana/src/opihi/cmd.data/threshold.c

    r33662 r33944  
    6969    x0 = isFltX ? vecx[0].elements.Flt[Nhi] : vecy[0].elements.Int[Nhi];
    7070    x1 = isFltX ? vecx[0].elements.Flt[Nhi+1]   : vecy[0].elements.Int[Nhi+1];
    71     Xvalue = (value - y0) * (x1 - x0) / (y1 - y0) + x0;
     71    if (y0 == y1) {
     72      Xvalue = 0.5*(x0 + x1);
     73    } else {
     74      Xvalue = (value - y0) * (x1 - x0) / (y1 - y0) + x0;
     75    }   
    7276  } else {
    7377    // interpolate to value:
     
    7680    x0 = isFltX ? vecx[0].elements.Flt[Nhi-1] : vecy[0].elements.Int[Nhi-1];
    7781    x1 = isFltX ? vecx[0].elements.Flt[Nhi]   : vecy[0].elements.Int[Nhi];
    78     Xvalue = (value - y0) * (x1 - x0) / (y1 - y0) + x0;
     82    if (y0 == y1) {
     83      Xvalue = 0.5*(x0 + x1);
     84    } else {
     85      Xvalue = (value - y0) * (x1 - x0) / (y1 - y0) + x0;
     86    }
    7987  }
    8088
  • branches/eam_branches/ipp-20120405/Ohana/src/opihi/dvo/avextract.c

    r33827 r33944  
    7474  }
    7575
     76  // this is used to NOT save the results in the results file
     77  // use this option when mextract is used in a script which does its
     78  // own job of packaging the results
     79  int SKIP_RESULTS = FALSE;
     80  if ((N = get_argument (argc, argv, "-skip-results"))) {
     81    remove_argument (N, &argc, argv);
     82    SKIP_RESULTS = TRUE;
     83  }
     84
    7685  dvo_catalog_init (&catalog, TRUE);
    7786
     
    8796    goto escape;
    8897  }
     98
     99  // init locally static variables (time refs)
     100  dbExtractAveragesInit ();
    89101
    90102  // command-line is of the form: avextract field,field, field [where (field op value)...]
     
    198210      m = catalog.average[j].measureOffset;
    199211
    200       // reset counters for saved fields, extract fields
    201       dbExtractAveragesInit ();
     212      dbExtractAveragesInitAve ();  // reset counters for saved fields (costs very little)
     213
    202214      for (n = 0; n < Nfields; n++) {
    203215        values[n] = dbExtractAverages (&catalog.average[j], &catalog.secfilt[j*Nsecfilt], &catalog.measure[m], &fields[n]);
     
    234246
    235247  // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere)
    236   if (RESULT_FILE) {
     248  if (RESULT_FILE && !SKIP_RESULTS) {
    237249    int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nreturn, FALSE, NULL);
    238     if (!status) goto escape;
     250    if (!status) {
     251      goto escape;
     252    }
    239253  }
    240254
  • branches/eam_branches/ipp-20120405/Ohana/src/opihi/dvo/avmatch.c

    r33827 r33944  
    6666  if (!InitPhotcodes ()) goto escape;
    6767  Nsecfilt = GetPhotcodeNsecfilt ();
     68
     69  // init locally static variables (time refs)
     70  dbExtractAveragesInit ();
    6871
    6972  // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results
     
    206209
    207210      // reset counters for saved fields, extract fields
    208       dbExtractAveragesInit ();
     211      dbExtractAveragesInitAve ();
    209212      for (n = 0; n < Nfields; n++) {
    210213        values[n] = dbExtractAverages (&catalog.average[Ncat], &catalog.secfilt[Ncat*Nsecfilt], &catalog.measure[m], &fields[n]);
  • branches/eam_branches/ipp-20120405/Ohana/src/opihi/dvo/dvo_host_utils.c

    r33912 r33944  
    66# define DVO_MAX_PATH 1024
    77
     8# define DIE(WHO,MSG) { perror(WHO); myAbort(MSG); }
     9
    810int HostTableLaunchJobs (HostTable *table, char *basecmd, char *options, int VERBOSE) {
    911
     
    3335    FILE *f = fopen (commandFile, "w");
    3436    fprintf (f, "%s\n", basecmd);
    35     fclose (f);
     37    if (fflush (f)) DIE("flush", "failed to flush");
     38
     39    int fd = fileno (f);
     40    if (fsync (fd)) DIE("fsync", "failed to fsync");
     41
     42    if (fclose (f)) DIE("close", "failed to close");
     43
     44    // force NFS to write the file to disk
     45    int state;
     46    f = fsetlockfile (commandFile, 0.5, LCK_XCLD, &state);
     47    fclearlockfile (commandFile, f, LCK_XCLD, &state);
    3648
    3749    char command[1024];
     
    216228  Vector **vec = NULL;
    217229  for (i = 0; i < table->Nhosts; i++) {
    218     if (table->hosts[i].status) continue;
    219 
    220230    // ensure that the paths are absolute path names
    221231    char *tmppath = abspath (table->hosts[i].pathname, DVO_MAX_PATH);
     
    240250    table->hosts[i].results = NULL;
    241251
     252    // fprintf (stderr, "%s : %d\n", table->hosts[i].pathname, invec[0]->Nelements);
     253
    242254    vec = MergeVectors (vec, &Nvec, invec, Ninvec);
    243255    if (vec != invec) {
  • branches/eam_branches/ipp-20120405/Ohana/src/opihi/dvo/mextract.c

    r33662 r33944  
    189189      }
    190190
    191       dbExtractMeasuresInitAve (); // reset counters for saved fields (costs very little
     191      dbExtractMeasuresInitAve (); // reset counters for saved fields (costs very little)
    192192
    193193      for (k = 0; (k < catalog.average[j].Nmeasure); k++, m++) {
  • branches/eam_branches/ipp-20120405/Ohana/src/opihi/dvo/remote.c

    r33911 r33944  
    3131
    3232  if ((N = get_argument (argc, argv, "-reload"))) {
    33     if (argc != N) {
     33    remove_argument (N, &argc, argv);
     34    if (argc != 2) {
    3435      gprint (GP_ERR, "USAGE: remote -reload (uniquer)\n");
    3536      gprint (GP_ERR, " (uniquer) is the element in the middle of the results file\n");
     
    3738      return FALSE;
    3839    }
    39     remove_argument (N, &argc, argv);
    4040    int status = HostTableReloadResults (argv[1], VERBOSE);
    4141    return status;
  • branches/eam_branches/ipp-20120405/Ohana/src/opihi/lib.shell/VectorIO.c

    r33662 r33944  
    2020  }
    2121  if (f == (FILE *) NULL) {
    22     gprint (GP_ERR, "can't open file for write\n");
     22    gprint (GP_ERR, "can't open file for write : %s\n", filename);
    2323    return (FALSE);
    2424  }
  • branches/eam_branches/ipp-20120405/Ohana/src/opihi/lib.shell/startup.c

    r27998 r33944  
    138138    if (is_script) {
    139139      /* first argument in input script, rest are argv */
     140      set_str_variable ("SCRIPT_NAME", argv[1]);
    140141      list[Nlist] = strcreate (argv[1]);
    141142      Nlist ++;
Note: See TracChangeset for help on using the changeset viewer.