IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 1, 2012, 3:24:39 PM (14 years ago)
Author:
eugene
Message:

support for parallel dvo in mextract, avextract, avmerge, gstar, gcat; remove some if-def-ed out code already moved to libdvo; list -vectors and -buffers options (store names of vectors and buffers in lists); list -copy give error if missing source; catlist, hosts & remote functions to support parallel dvos; skyregion -save option; new skycoverage modes (-min-ubercal; -min-dmag-sys; -min-mcal; -max-mcal); gstar output formatting cleanups; add more average info to gstar output; functions for spectral similarity analysis; coords returns nans for projections off the sphere; fix cumulative function; add name:type option to opihi/read function (eg read a:float 2 b:time 3 c:int 4); line -frac option; vtype function to get vector types; threshold function; write -fits option; code for unfinished mtype function (matching vtype)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/dvo/avextract.c

    r31450 r33662  
    3737  }
    3838
     39  int PARALLEL = FALSE;
     40  if ((N = get_argument (argc, argv, "-parallel"))) {
     41    remove_argument (N, &argc, argv);
     42    PARALLEL = TRUE;
     43  }
     44
     45  // use remote tables, but not dvo_client..
     46  int PARALLEL_LOCAL = FALSE;
     47  HostTable *table = NULL;
     48  if ((N = get_argument (argc, argv, "-parallel-local"))) {
     49    remove_argument (N, &argc, argv);
     50    PARALLEL_LOCAL = TRUE;
     51
     52    char *CATDIR = GetCATDIR();
     53    if (!CATDIR) {
     54      gprint (GP_ERR, "CATDIR is not set\n");
     55      return FALSE;
     56    }
     57    SkyTable *sky = GetSkyTable();
     58    if (!sky) {
     59      gprint (GP_ERR, "failed to load sky table for database\n");
     60      return FALSE;
     61    }
     62    table = HostTableLoad (CATDIR, sky->hosts);
     63    if (!table) {
     64      gprint (GP_ERR, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR);
     65      return FALSE;
     66    }   
     67  }
     68
    3969  dvo_catalog_init (&catalog, TRUE);
    4070
     
    4373  Nsecfilt = GetPhotcodeNsecfilt ();
    4474
    45   // parse skyregion options
     75  // parse skyregion options.  NOTE: this is stripped off in parallel operation and always
     76  // defined for the client via the -skyregion option.  The dvo_client parses this
     77  // argument in the main program, before it is passed to the command (like mextract)
    4678  if ((selection = SetRegionSelection (&argc, argv)) == NULL) {
    4779    print_error();
     
    85117  /* load region corresponding to selection above */
    86118  if ((skylist = SelectRegions (selection)) == NULL) goto escape;
     119
     120  // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results
     121  if (PARALLEL && !HOST_ID) {
     122    int status = HostTableParallelOps (argc, argv, RESULT_FILE, 0, VERBOSE);
     123
     124    dbFreeFields (fields, Nfields);
     125    dbFreeStack (stack, Nstack);
     126    free (stack);
     127    FreeSkyRegionSelection (selection);
     128    dvo_catalog_free (&catalog);
     129
     130    return status;
     131  }
    87132
    88133  /* create output storage vectors */
     
    114159  interrupt = FALSE;
    115160  for (i = 0; (i < skylist[0].Nregions) && !interrupt; i++) {
     161
     162    // does this host ID match the desired location for the table?
     163    if (!HostTableTestHost(skylist[0].regions[i], HOST_ID)) continue;
     164
    116165    /* lock, load, unlock catalog */
    117     catalog.filename = skylist[0].filename[i];
     166    char hostfile[1024];
     167    if (PARALLEL_LOCAL) {
     168      int hostID = (skylist[0].regions[i]->hostFlags & DATA_USE_BCK) ? skylist[0].regions[i]->backupID : skylist[0].regions[i]->hostID;
     169      int seq = table->index[hostID];
     170      HOSTDIR = table->hosts[seq].pathname;
     171    }
     172    snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name);
     173    catalog.filename = (HOST_ID || PARALLEL_LOCAL) ? hostfile : skylist[0].filename[i];
    118174    catalog.catflags = LOAD_AVES | LOAD_SECF;
    119175    if (needMeasures) {
     
    169225  interrupt = FALSE;
    170226  for (n = 0; n < Nreturn; n++) {
    171     vec[n][0].Nelements = Npts;
    172     if (vec[n][0].type == OPIHI_FLT) {
    173       REALLOCATE (vec[n][0].elements.Flt, opihi_flt, MAX(1,Npts));
    174     } else {
    175       REALLOCATE (vec[n][0].elements.Int, opihi_int, MAX(1,Npts));
    176     }
    177   }
    178 
     227    ResetVector (vec[n], fields[n].type, Npts);
     228  }
     229
     230  // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere)
     231  if (RESULT_FILE) {
     232    int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nreturn, FALSE, NULL);
     233    if (!status) goto escape;
     234  }
     235
     236  if (table) free (table);
    179237  if (vec) free (vec);
    180238  if (values) free (values);
     
    187245
    188246 escape:
     247  if (table) free (table);
    189248  if (vec) free (vec);
    190249  if (values) free (values);
Note: See TracChangeset for help on using the changeset viewer.