IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 12, 2015, 12:29:24 PM (12 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-pv3-20140717-merge/Ohana
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-pv3-20140717-merge/Ohana

  • branches/eam_branches/ipp-pv3-20140717-merge/Ohana/src/relastro/src/UpdateObjectOffsets.c

    r37038 r37822  
    5959
    6060    // uses MeasureTiny values, but will also update Measure values when populated
    61     UpdateObjects (&catalog, 1);
     61    // if Galaxy Motion Model correction is active, do not apply at this last stage
     62    UpdateObjects (&catalog, 1, FALSE);
    6263
    6364    free_tiny_values(&catalog);
     
    7475    save_catalogs (&catalog, 1);
    7576  }
    76  
     77  printNcatTotal();
    7778  return (TRUE);
    7879}
     80
     81int UpdateObjectOffsets_parallel_group (HostTableGroup *group, SkyList *sky);
     82int UpdateObjectOffsets_parallel_table (HostTable *table, SkyList *sky);
    7983
    8084// CATDIR is supplied globally
     
    9094    exit (1);
    9195  }   
     96
     97# if (0)
     98 
     99  UpdateObjectOffsets_parallel_table (table, sky);
     100
     101# else
     102
     103  int Ngroups;
     104  HostTableGroup *groups = HostTableGroups (table, &Ngroups);
     105  // split the table into Ngroups, each with a unique set of machines (this avoids overloading the remote host machines)
     106
     107  int i;
     108  for (i = 0; i < Ngroups; i++) {
     109    // update only a group of unique machines at a time
     110    UpdateObjectOffsets_parallel_group (&groups[i], sky);
     111  }
     112# endif
     113
     114  return TRUE;
     115}     
     116
     117// CATDIR is supplied globally
     118# define DEBUG 1
     119int UpdateObjectOffsets_parallel_group (HostTableGroup *group, SkyList *sky) {
     120
     121  // launch the relastro_client jobs to the parallel hosts
     122
     123  int i, j;
     124  for (i = 0; i < group->Nhosts; i++) {
     125
     126    if (sky->Nregions < group->Nhosts) {
     127      // do any of the regions want this host?
     128      int wantThisHost = FALSE;
     129      for (j = 0; j < sky->Nregions; j++) {
     130        if (HostTableTestHost (sky->regions[j], group->hosts[i][0].hostID)) {
     131          wantThisHost = TRUE;
     132          break;
     133        }
     134      }
     135      if (!wantThisHost) {
     136        // fprintf (stderr, "skip host %s\n", group->hosts[i][0].hostname);
     137        continue;
     138      }
     139    }
     140
     141    // ensure that the paths are absolute path names
     142    char *tmppath = abspath (group->hosts[i][0].pathname, DVO_MAX_PATH);
     143    free (group->hosts[i][0].pathname);
     144    group->hosts[i][0].pathname = tmppath;
     145
     146    // options / arguments that can affect relastro_client -load:
     147    // VERBOSE, VERBOSE2
     148    // RESET (-reset)
     149    // TimeSelect -time
     150    // (note that psfQF is applied rigidly at 0.85, as is the galaxy test)
     151    // ImagSelect, ImagMin, ImagMax
     152    // MaxDensityUse, MaxDensityValue
     153
     154    char command[1024];
     155    snprintf (command, 1024, "relastro_client -update-offsets -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s -minerror %f",
     156              group->hosts[i][0].hostID, CATDIR, group->hosts[i][0].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE, MIN_ERROR);
     157
     158    if (FIT_MODE == FIT_PM_ONLY)         strextend (command, "-pm");
     159    if (FIT_MODE == FIT_PAR_ONLY)        strextend (command, "-par");
     160    if (FIT_MODE == FIT_PM_AND_PAR)      strextend (command, "-pmpar");
     161
     162    if (VERBOSE)       strextend (command, "-v");
     163    if (VERBOSE2)      strextend (command, "-vv");
     164    if (RESET)         strextend (command, "-reset");
     165    if (UPDATE)        strextend (command, "-update");
     166
     167    if (RESET_BAD_IMAGES) strextend (command, "-reset-bad-images");
     168
     169    if (ImagSelect)    strextend (command, "-instmag %f %f", ImagMin, ImagMax);
     170    if (MaxDensityUse) strextend (command, "-max-density %f", MaxDensityValue);
     171   
     172    if (USE_BASIC_CHECK) strextend (command, "-basic-image-search");
     173    if (FlagOutlier)     strextend (command, "-clip %d", CLIP_THRESH);
     174    if (ExcludeBogus)    strextend (command, "-exclude-bogus %f", ExcludeBogusRadius);
     175   
     176    if (USE_FIXED_PIXCOORDS) strextend (command, "-D USE_FIXED_PIXCOORDS 1");
     177
     178    if (PHOTCODE_KEEP_LIST) strextend (command, "+photcode %s", PHOTCODE_KEEP_LIST);
     179    if (PHOTCODE_SKIP_LIST) strextend (command, "-photcode %s", PHOTCODE_SKIP_LIST);
     180    if (PhotFlagSelect)     strextend (command, "+photflags");
     181    if (PhotFlagBad)        strextend (command, "+photflagbad %d", PhotFlagBad);
     182    if (PhotFlagPoor)       strextend (command, "+photflagpoor %d", PhotFlagPoor);
     183    // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values
     184
     185    if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) {
     186      strextend (command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG);
     187    }
     188    if (DCR_RED_COLOR_POS && DCR_RED_COLOR_NEG) {
     189      strextend (command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG);
     190    }
     191
     192    if (MinBadQF > 0.0)        strextend (command, "-min-bad-psfqf %f", MinBadQF);
     193    if (MaxMeanOffset != 10.0) strextend (command, "-max-mean-offset  %f", MaxMeanOffset);
     194
     195    if (TimeSelect) {
     196      char *tstart = ohana_sec_to_date (TSTART);
     197      char *tstop  = ohana_sec_to_date (TSTOP);
     198      strextend (command, "-time %s %s", tstart, tstop);
     199      free (tstart);
     200      free (tstop);
     201    }
     202    fprintf (stderr, "command: %s\n", command);
     203
     204    if (PARALLEL_MANUAL) continue;
     205
     206    if (PARALLEL_SERIAL) {
     207      int status = system (command);
     208      if (status) {
     209        fprintf (stderr, "ERROR running relastro_client\n");
     210        exit (2);
     211      }
     212    } else {
     213      // launch the job on the remote machine (no handshake)
     214      int errorInfo = 0;
     215      int pid = rconnect ("ssh", group->hosts[i][0].hostname, command, group->hosts[i][0].stdio, &errorInfo, FALSE);
     216      if (!pid) {
     217        if (DEBUG) fprintf (stderr, "failure to start %s (error %d)\n", group->hosts[i][0].hostname, errorInfo);
     218        exit (1);
     219      }
     220      group->hosts[i][0].pid = pid; // save for future reference
     221    }
     222  }
     223
     224  if (PARALLEL_MANUAL) {
     225    fprintf (stderr, "run the relastro_client commands above.  when these are done, hit return\n");
     226    getchar();
     227  }
     228  if (!PARALLEL_MANUAL && !PARALLEL_SERIAL) {
     229    HostTableGroupWaitJobsGetIO (group, __FILE__, __LINE__, VERBOSE);
     230  }
     231
     232  return TRUE;
     233}     
     234
     235// CATDIR is supplied globally
     236# define DEBUG 1
     237int UpdateObjectOffsets_parallel_table (HostTable *table, SkyList *sky) {
     238
     239  // launch the relastro_client jobs to the parallel hosts
    92240
    93241  int i, j;
Note: See TracChangeset for help on using the changeset viewer.