IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35873


Ignore:
Timestamp:
Aug 2, 2013, 10:44:53 AM (13 years ago)
Author:
eugene
Message:

updates avmatch for parallel opts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130711/Ohana/src/opihi/dvo/avmatch.c

    r35416 r35873  
    7070  dbExtractAveragesInit ();
    7171
    72   // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results
    7372  RAvec  = NULL;
    7473  DECvec = NULL;
    75   if (PARALLEL && !HOST_ID) {
    76     if (!CoordsFile) {
    77       // get vectors corresponding to coordinates of interest
    78       if ((RAvec  = SelectVector (argv[1], ANYVECTOR, TRUE)) == NULL) goto help;
    79       if ((DECvec = SelectVector (argv[2], ANYVECTOR, TRUE)) == NULL) goto help;
    80      
    81       ALLOCATE (vec, Vector *, 2);
    82       vec[0] = RAvec;
    83       vec[1] = DECvec;
    84 
    85       CoordsFile = abspath("coords.fits", 1024);
    86       int status = WriteVectorTableFITS (CoordsFile, "COORDS", vec, 2, FALSE, NULL);
    87       if (!status) goto escape;
    88     }
    89 
    90     char *targv1 = argv[1];
    91     char *targv2 = argv[2];
    92     argv[1] = strcreate ("-coords");
    93     argv[2] = strcreate (CoordsFile);
    94     free (CoordsFile);
    95 
    96     // I need to pass the RA & DEC vectors to the remote clients...
    97     int status = HostTableParallelOps (skylist, argc, argv, RESULT_FILE, TRUE, RAvec->Nelements, VERBOSE);
    98     if (vec) free (vec);
    99    
    100     free (argv[1]);
    101     free (argv[2]);
    102     argv[1] = targv1;
    103     argv[2] = targv2;
    104 
    105     return status;
    106   }
    107 
    10874  // get vectors corresponding to coordinates of interest
    10975  if (CoordsFile) {
     
    12086    remove_argument (1, &argc, argv);
    12187  }
     88
     89  /* load regions which contain all supplied RA,DEC coordinates */
     90  if ((skylist = SelectRegionsByCoordVectors (RAvec, DECvec)) == NULL) goto escape;
     91
     92  // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results
     93  if (PARALLEL && !HOST_ID) {
     94
     95    // We need to copy the args to a temp array and modify them so that we send the
     96    // correct set to the remote client.  The args list looks like this:
     97    // if (!CoordsFile) : avmatch (RADIUS) field, ... [we removed RA & DEC above]
     98    // if ( CoordsFile) : avmatch (RADIUS) field, ... [because we stripped off the -coords filename elements]
     99
     100    // allocate the temp array and copy all but (RA) (DEC)
     101    int targc = 0;
     102    char **targv = NULL;
     103    ALLOCATE (targv, char *, argc + 2);
     104    for (i = 0; i < argc; i++) {
     105      targv[targc] = strcreate (argv[i]);
     106      targc ++;
     107    }
     108
     109    // if not specified, create the coords.fits input file
     110    // NOTE: RAvec, DECvec were set above
     111    if (!CoordsFile) {
     112      ALLOCATE (vec, Vector *, 2);
     113      vec[0] = RAvec;
     114      vec[1] = DECvec;
     115
     116      CoordsFile = abspath("coords.fits", 1024);
     117      int status = WriteVectorTableFITS (CoordsFile, "COORDS", vec, 2, FALSE, NULL);
     118      if (!status) goto escape;
     119    }
     120
     121    // add the coords file to the args list
     122    targv[targc+0] = strcreate ("-coords");
     123    targv[targc+1] = CoordsFile; // this gets freed with targv
     124    targc += 2;
     125   
     126    // I need to pass the RA & DEC vectors to the remote clients...
     127    int status = HostTableParallelOps (skylist, targc, targv, RESULT_FILE, TRUE, RAvec->Nelements, VERBOSE);
     128    if (vec) free (vec);
     129   
     130    // free up targv
     131    for (i = 0; i < targc; i++) {
     132      free (targv[i]);
     133    }
     134    free (targv);
     135
     136    return status;
     137  }
     138
    122139  RADIUS = atof (argv[1]);
    123140  remove_argument (1, &argc, argv);
     
    140157    if (fields[i].photcode[0].type == PHOT_DEP) needMeasures = TRUE;
    141158  }
    142 
    143   /* load regions which contain all supplied RA,DEC coordinates */
    144   if ((skylist = SelectRegionsByCoordVectors (RAvec, DECvec)) == NULL) goto escape;
    145159
    146160  /* create output storage vectors */
Note: See TracChangeset for help on using the changeset viewer.