IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33328


Ignore:
Timestamp:
Feb 21, 2012, 8:53:51 PM (14 years ago)
Author:
eugene
Message:

added parallel mode for relphot -update-objects

Location:
branches/eam_branches/ipp-20111122/Ohana/src/relphot
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/Makefile

    r33254 r33328  
    7171$(SRC)/load_catalogs.$(ARCH).o   \
    7272$(SRC)/reload_catalogs.$(ARCH).o \
     73$(SRC)/relphot_objects.$(ARCH).o         \
    7374$(SRC)/relphot_client.$(ARCH).o  \
    7475$(SRC)/setExclusions.$(ARCH).o   \
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/include/relphot.h

    r33303 r33328  
    1212    MODE_LOAD   = 1,
    1313    MODE_UPDATE = 2,
     14    MODE_UPDATE_OBJECTS = 3,
    1415} ModeType;
    1516
     
    286287void          wimages             PROTO((void));
    287288void          write_coords        PROTO((Header *header, Coords *coords));
    288 int relphot_objects (void);
     289int relphot_objects (int hostID, char *hostpath);
    289290
    290291void relphot_usage (void);
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/StarOps.c

    r33169 r33328  
    239239// NOTE: this function operates on the real Measure & Average structures, not the
    240240// MeasureTiny & AverageTiny structures
     241// NOTE: this function is called on the remote machine -- make sure any (global) options
     242// are passed to the relphot_client program
    241243int setMave (Catalog *catalog, int Ncatalog) {
    242244
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/args.c

    r33303 r33328  
    352352    remove_argument (N, &argc, argv);
    353353  }
     354  if ((N = get_argument (argc, argv, "-update-objects"))) {
     355    if (MODE) {
     356      fprintf (stderr, "ERROR: cannot mix modes (-load, -update, -update-objects)\n");
     357      relphot_client_usage();
     358    }
     359    MODE = MODE_UPDATE_OBJECTS;
     360    remove_argument (N, &argc, argv);
     361  }
    354362  if (!MODE) relphot_client_usage();
    355363
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/help.c

    r33274 r33328  
    4747  fprintf (stderr, "ERROR: USAGE: relphot (photcodes) -load (filename) -hostID (hostID) -hostdir (hostdir) [options]\n");
    4848  fprintf (stderr, "       or:    relphot -update (filename) -hostID (hostID) -hostdir (hostdir) [options]\n");
     49  fprintf (stderr, "       or:    relphot -update-objects -hostID (hostID) -hostdir (hostdir) [options]\n");
    4950  fprintf (stderr, "  use -h for more usage information\n");
    5051  exit (2);
     
    6566  fprintf (stderr, "       relphot_client -update (images) : apply calculated zero points to the client's tables\n\n");
    6667  fprintf (stderr, "                              (images) : location of the table with the image zero points\n");
     68  fprintf (stderr, "       relphot_client -update-objects  : determine average magnitudes for objects\n\n");
    6769  fprintf (stderr, "       db info : -hostID (hostID) -hostdir (hostdir) -catdir (catdir)\n");
    6870  fprintf (stderr, "other options:\n");
    69   fprintf (stderr, "  -v : verbose output\n");
     71  fprintf (stderr, "  -v  : verbose output\n");
     72  fprintf (stderr, "  -vv : extra verbose output\n");
    7073  fprintf (stderr, "  \n");
    7174  exit (2);
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/relphot.c

    r33274 r33328  
    2222  /* the object analysis is a separate process iterating over catalogs */
    2323  if (UpdateAverages) {
    24     relphot_objects ();
     24    relphot_objects (0, NULL);
    2525    exit (0);
    2626  }
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/relphot_client.c

    r33301 r33328  
    7171    }
    7272
     73    case MODE_UPDATE_OBJECTS: {
     74      relphot_objects (HOST_ID, HOSTDIR);
     75      break;
     76    }
     77
    7378    default:
    7479      fprintf (stderr, "impossible!");
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/relphot_objects.c

    r33117 r33328  
    66// has been correctly propagated to the measurement, the average will respect that value.
    77
    8 int relphot_objects () {
     8int relphot_objects_parallel (SkyList *sky);
     9
     10int relphot_objects (int hostID, char *hostpath) {
    911
    1012  off_t i, j, k;
     
    2224  skylist = SkyListByPatch (sky, -1, &UserPatch);
    2325
     26  // XXX need to decide how to determine PARALLEL mode...
     27  if (PARALLEL & !hostID) {
     28    relphot_objects_parallel (skylist);
     29    return TRUE;
     30  }
     31
    2432  // load data from each region file, only use bright stars
    2533  for (i = 0; i < skylist[0].Nregions; i++) {
    2634
     35    if (hostID && (skylist[0].regions[i]->hostID != hostID)) continue;
     36
    2737    // set up the basic catalog info
    28     catalog.filename  = skylist[0].filename[i];
     38    // set up the basic catalog info
     39    char hostfile[1024];
     40    snprintf (hostfile, 1024, "%s/%s.cpt", hostpath, skylist[0].regions[i]->name);
     41    catalog.filename  = hostID ? hostfile : skylist[0].filename[i];
    2942    catalog.catformat = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
    3043    catalog.catmode   = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
     
    4356    }
    4457
     58    // XXX need to respect UBERCAL measurements (and not reset them?)
    4559    // reset
    4660    if (RESET) {
     
    8195  return (TRUE);
    8296}
     97
     98// CATDIR is supplied globally
     99# define DEBUG 1
     100int relphot_objects_parallel (SkyList *sky) {
     101
     102  // launch the setphot_client jobs to the parallel hosts
     103
     104  // load the list of hosts
     105  HostTable *table = HostTableLoad (CATDIR, sky->hosts);
     106  if (!table) {
     107    fprintf (stderr, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR);
     108    exit (1);
     109  }   
     110
     111  int i;
     112  for (i = 0; i < table->Nhosts; i++) {
     113
     114    // ensure that the paths are absolute path names
     115    char *tmppath = abspath (table->hosts[i].pathname, MAX_PATH_LENGTH);
     116    free (table->hosts[i].pathname);
     117    table->hosts[i].pathname = tmppath;
     118
     119    char catalogFile[512];
     120    snprintf (catalogFile, 512, "%s/relphot.catalog.subset.dat", table->hosts[i].pathname);
     121
     122    // options / arguments that can affect relphot_client -update-objects:
     123    // VERBOSE, VERBOSE2
     124    // KEEP_UBERCAL
     125    // RESET (-reset)
     126    // TimeSelect -time
     127    // DophotSelect
     128    // (note that psfQual is applied rigidly at 0.85, as is the galaxy test)
     129    // MAG_LIM
     130    // SIGMA_LIM
     131    // ImagSelect, ImagMin, ImagMax
     132    // MaxDensityUse, MaxDensityValue
     133
     134    char command[1024];
     135    snprintf (command, 1024, "relphot_client -update-objects -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f",
     136              table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
     137
     138    char tmpline[1024];
     139    if (VERBOSE)       { snprintf (tmpline, 1024, "%s -v",              command);                    strcpy (command, tmpline); }
     140    if (VERBOSE2)      { snprintf (tmpline, 1024, "%s -vv",             command);                    strcpy (command, tmpline); }
     141    if (RESET)         { snprintf (tmpline, 1024, "%s -reset",          command);                    strcpy (command, tmpline); }
     142    if (KEEP_UBERCAL)  { snprintf (tmpline, 1024, "%s -keep-ubercal",   command);                    strcpy (command, tmpline); }
     143
     144    fprintf (stderr, "command: %s\n", command);
     145
     146    if (PARALLEL_MANUAL) continue;
     147
     148    if (PARALLEL_SERIAL) {
     149      int status = system (command);
     150      if (status) {
     151        fprintf (stderr, "ERROR running relphot_client\n");
     152        exit (2);
     153      }
     154    } else {
     155      // launch the job on the remote machine (no handshake)
     156      int errorInfo = 0;
     157      int pid = rconnect ("ssh", table->hosts[i].hostname, command, table->hosts[i].stdio, &errorInfo, FALSE);
     158      if (!pid) {
     159        if (DEBUG) fprintf (stderr, "failure to start %s (error %d)\n", table->hosts[i].hostname, errorInfo);
     160        exit (1);
     161      }
     162      table->hosts[i].pid = pid; // save for future reference
     163    }
     164  }
     165
     166  if (PARALLEL_MANUAL) {
     167    fprintf (stderr, "run the relphot_client commands above.  when these are done, hit return\n");
     168    getchar();
     169  }
     170  if (!PARALLEL_MANUAL && !PARALLEL_SERIAL) {
     171    HostTableWaitJobs (table, __FILE__, __LINE__);
     172  }
     173
     174  return TRUE;
     175}     
Note: See TracChangeset for help on using the changeset viewer.