IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33314


Ignore:
Timestamp:
Feb 20, 2012, 3:18:25 PM (14 years ago)
Author:
eugene
Message:

convert avextract to parallel form

Location:
branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo/avextract.c

    r31450 r33314  
    11# include "dvoshell.h"
     2
     3int HostTableLaunchJobs (HostTable *table, char *basecmd);
     4Vector **MergeVectors (Vector **vec, int *Nvec, Vector **invec, int Ninvec);
     5int HostTableParallelOps (int argc, char **argv, char *ResultFile);
    26
    37int avextract (int argc, char **argv) {
     
    3741  }
    3842
     43  int PARALLEL = FALSE;
     44  if ((N = get_argument (argc, argv, "-parallel"))) {
     45    remove_argument (N, &argc, argv);
     46    PARALLEL = TRUE;
     47  }
     48
     49  // dump results directly to fits file (esp for parallel dvo)
     50  char *ResultFile = NULL;
     51  if ((N = get_argument (argc, argv, "-result"))) {
     52    remove_argument (N, &argc, argv);
     53    ResultFile = strcreate(argv[N]);
     54    remove_argument (N, &argc, argv);
     55  }
     56
    3957  dvo_catalog_init (&catalog, TRUE);
    4058
     
    4361  Nsecfilt = GetPhotcodeNsecfilt ();
    4462
    45   // parse skyregion options
     63  // parse skyregion options.  NOTE: this is stripped off in parallel operation and always
     64  // defined for the client via the -skyregion option.  The dvo_client parses this
     65  // argument in the main program, before it is passed to the command (like mextract)
    4666  if ((selection = SetRegionSelection (&argc, argv)) == NULL) {
    4767    print_error();
    4868    goto escape;
     69  }
     70
     71  // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results
     72  if (PARALLEL && !HOST_ID) {
     73    // not all parallel ops need to set the region selection...
     74    if (!SetSkyRegions (selection)) goto escape;
     75
     76    int status = HostTableParallelOps (argc, argv, ResultFile);
     77    return status;
    4978  }
    5079
     
    114143  interrupt = FALSE;
    115144  for (i = 0; (i < skylist[0].Nregions) && !interrupt; i++) {
     145    // parallel case, wrong client
     146    if (HOST_ID && (HOST_ID != skylist[0].regions[i]->hostID)) continue;
     147
    116148    /* lock, load, unlock catalog */
    117     catalog.filename = skylist[0].filename[i];
     149    char hostfile[1024];
     150    snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name);
     151    catalog.filename = HOST_ID ? hostfile : skylist[0].filename[i];
    118152    catalog.catflags = LOAD_AVES | LOAD_SECF;
    119153    if (needMeasures) {
     
    169203  interrupt = FALSE;
    170204  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     }
     205    ResetVector (vec[n], fields[n].type, Npts);
     206  }
     207
     208  // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere)
     209  if (ResultFile) {
     210    int status = WriteVectorTableFITS (ResultFile, "RESULT", vec, Nreturn, FALSE, NULL);
     211    if (!status) goto escape;
    177212  }
    178213
  • branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo/mextract.c

    r33313 r33314  
    11# include "dvoshell.h"
    22
    3 # define DEBUG 1
     3# define DEBUG 0
    44# define PARALLEL_MANUAL 0
    55# define PARALLEL_SERIAL 0
     
    6060  dvo_catalog_init (&catalog, TRUE);
    6161
     62  /* load photcode information */
     63  if (!InitPhotcodes ()) goto escape;
     64  Nsecfilt = GetPhotcodeNsecfilt ();
     65 
    6266  // parse skyregion options.  NOTE: this is stripped off in parallel operation and always
    6367  // defined for the client via the -skyregion option.  The dvo_client parses this
    6468  // argument in the main program, before it is passed to the command (like mextract)
    65   if ((selection = SetRegionSelection (&argc, argv)) == NULL) goto escape;
     69  if ((selection = SetRegionSelection (&argc, argv)) == NULL) {
     70    print_error();
     71    goto escape;
     72  }
    6673
    6774  // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results
     
    7481  }
    7582
    76   /* load photcode information */
    77   if (!InitPhotcodes ()) goto escape;
    78   Nsecfilt = GetPhotcodeNsecfilt ();
    79  
    8083  // init locally static variables (time refs)
    8184  dbExtractMeasuresInit();
    8285
    83   // command-line is of the form: avextract field,field, field [where (field op value)...]
     86  // command-line is of the form: mextract field,field, field [where (field op value)...]
    8487
    8588  // parse the fields to be extracted and returned
     
    156159
    157160  for (i = 0; (i < skylist[0].Nregions) && !interrupt; i++) {
    158 
    159161    // parallel case, wrong client
    160162    if (HOST_ID && (HOST_ID != skylist[0].regions[i]->hostID)) continue;
Note: See TracChangeset for help on using the changeset viewer.