IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33396


Ignore:
Timestamp:
Mar 2, 2012, 12:21:51 PM (14 years ago)
Author:
eugene
Message:

working towards parallel relastro (need to worry about MeasureTiny vs Measure)

Location:
branches/eam_branches/ipp-20111122/Ohana/src
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/Ohana/src/libdvo/include/dvo.h

    r33391 r33396  
    268268} PhotCodeData;
    269269
    270 // a reduced-subset structure for relphot & relastro
     270// a reduced-subset structure for relastro
     271typedef struct {
     272  double         R;
     273  double         D;
     274  unsigned short Nmeasure;
     275  int            measureOffset;
     276  uint32_t       flags;
     277  int            catID;
     278} AverageTinyAstro;
     279
     280// a reduced-subset structure for relphot
    271281typedef struct {
    272282  double         R;
  • branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/high_speed_catalogs.c

    r31635 r33396  
    2727  initializeConstraints();
    2828
     29  // XXX need to decide how to determine PARALLEL mode...
     30  if (PARALLEL & !hostID) {
     31    high_speed_catalogs (skylist);
     32    return TRUE;
     33  }
     34
    2935  // load data from each region file, only use bright stars
    3036  for (i = 0; i < skylist[0].Nregions; i++) {
    3137
     38    if (hostID && (skylist[0].regions[i]->hostID != hostID)) continue;
     39
    3240    // set up the basic catalog info
    33     catalog.filename  = skylist[0].filename[i];
     41    char hostfile[1024];
     42    snprintf (hostfile, 1024, "%s/%s.cpt", hostpath, skylist[0].regions[i]->name);
     43    catalog.filename  = hostID ? hostfile : skylist[0].filename[i];
    3444    catalog.catformat = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
    3545    catalog.catmode   = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
     
    5666  return (TRUE);
    5767}
     68
     69// CATDIR is supplied globally
     70# define DEBUG 1
     71int high_speed_catalogs_parallel (SkyList *sky) {
     72
     73  // launch the setphot_client jobs to the parallel hosts
     74
     75  // load the list of hosts
     76  HostTable *table = HostTableLoad (CATDIR, sky->hosts);
     77  if (!table) {
     78    fprintf (stderr, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR);
     79    exit (1);
     80  }   
     81
     82  int i;
     83  for (i = 0; i < table->Nhosts; i++) {
     84
     85    // ensure that the paths are absolute path names
     86    char *tmppath = abspath (table->hosts[i].pathname, MAX_PATH_LENGTH);
     87    free (table->hosts[i].pathname);
     88    table->hosts[i].pathname = tmppath;
     89
     90    char catalogFile[512];
     91    snprintf (catalogFile, 512, "%s/relastro.catalog.subset.dat", table->hosts[i].pathname);
     92
     93    // options / arguments that can affect relastro_client -update-objects:
     94
     95    char command[1024];
     96    snprintf (command, 1024, "relastro_client -high-speed -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f",
     97              table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
     98
     99    char tmpline[1024];
     100    if (VERBOSE)       { snprintf (tmpline, 1024, "%s -v",              command);                    strcpy (command, tmpline); }
     101    if (VERBOSE2)      { snprintf (tmpline, 1024, "%s -vv",             command);                    strcpy (command, tmpline); }
     102    if (RESET)         { snprintf (tmpline, 1024, "%s -reset",          command);                    strcpy (command, tmpline); }
     103    if (KEEP_UBERCAL)  { snprintf (tmpline, 1024, "%s -keep-ubercal",   command);                    strcpy (command, tmpline); }
     104
     105    fprintf (stderr, "command: %s\n", command);
     106
     107    if (PARALLEL_MANUAL) continue;
     108
     109    if (PARALLEL_SERIAL) {
     110      int status = system (command);
     111      if (status) {
     112        fprintf (stderr, "ERROR running relastro_client\n");
     113        exit (2);
     114      }
     115    } else {
     116      // launch the job on the remote machine (no handshake)
     117      int errorInfo = 0;
     118      int pid = rconnect ("ssh", table->hosts[i].hostname, command, table->hosts[i].stdio, &errorInfo, FALSE);
     119      if (!pid) {
     120        if (DEBUG) fprintf (stderr, "failure to start %s (error %d)\n", table->hosts[i].hostname, errorInfo);
     121        exit (1);
     122      }
     123      table->hosts[i].pid = pid; // save for future reference
     124    }
     125  }
     126
     127  if (PARALLEL_MANUAL) {
     128    fprintf (stderr, "run the relastro_client commands above.  when these are done, hit return\n");
     129    getchar();
     130  }
     131  if (!PARALLEL_MANUAL && !PARALLEL_SERIAL) {
     132    HostTableWaitJobs (table, __FILE__, __LINE__);
     133  }
     134
     135  return TRUE;
     136}     
  • branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/load_catalogs.c

    r30616 r33396  
    66  Catalog *catalog, *pcatalog, tcatalog;
    77
     8  // XXX need to decide how to determine PARALLEL mode...
     9  if (PARALLEL & !hostID) {
     10    catalog = load_catalogs_parallel (skylist, Ncatalog);
     11    return catalog;
     12  }
     13
    814  if (VERBOSE) fprintf (stderr, "loading catalog data\n");
    915
     
    1420  // load data from each region file, only use bright stars
    1521  for (i = 0; i < skylist[0].Nregions; i++) {
     22
     23    if (hostID && (skylist[0].regions[i]->hostID != hostID)) continue;
    1624
    1725    // we only allow output if we do not use a subset.  in this case,
     
    1927    pcatalog = subselect ? &tcatalog : &catalog[i];
    2028
     29    // define the catalog file name
     30    char hostfile[1024];
     31    snprintf (hostfile, 1024, "%s/%s.cpt", hostpath, skylist[0].regions[i]->name);
     32    pcatalog->filename = hostID ? hostfile : skylist[0].filename[i];
     33
    2134    // set up the basic catalog info
    22     pcatalog[0].filename  = skylist[0].filename[i];
    23     pcatalog[0].catformat = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
    24     pcatalog[0].catmode   = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
    25     pcatalog[0].catflags  = LOAD_AVES | LOAD_MEAS | LOAD_SECF; // don't need to load all data at this point
    26     pcatalog[0].Nsecfilt  = GetPhotcodeNsecfilt ();
     35    pcatalog->catformat = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
     36    pcatalog->catmode   = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
     37    pcatalog->catflags  = LOAD_AVES | LOAD_MEAS | LOAD_SECF; // don't need to load all data at this point
     38    pcatalog->Nsecfilt  = GetPhotcodeNsecfilt ();
    2739
    2840    if (!dvo_catalog_open (pcatalog, skylist[0].regions[i], VERBOSE2, "w")) {
     
    7688   need to use an XCLD lock here. 
    7789*/
     90
     91// CATDIR is supplied globally
     92# define DEBUG 1
     93Catalog *load_catalogs_parallel (SkyList *sky, int *Ncatalog) {
     94
     95  int Nsecfilt  = GetPhotcodeNsecfilt ();               // set the desired number in case we need to create the catalog
     96
     97  // launch the setphot_client jobs to the parallel hosts
     98
     99  // load the list of hosts
     100  HostTable *table = HostTableLoad (CATDIR, sky->hosts);
     101  if (!table) {
     102    fprintf (stderr, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR);
     103    exit (1);
     104  }   
     105
     106  int i;
     107  for (i = 0; i < table->Nhosts; i++) {
     108
     109    // ensure that the paths are absolute path names
     110    char *tmppath = abspath (table->hosts[i].pathname, MAX_PATH_LENGTH);
     111    free (table->hosts[i].pathname);
     112    table->hosts[i].pathname = tmppath;
     113
     114    char catalogFile[512];
     115    snprintf (catalogFile, 512, "%s/relastro.catalog.subset.dat", table->hosts[i].pathname);
     116
     117    // options / arguments that can affect relastro_client -load:
     118    // VERBOSE, VERBOSE2
     119    // KEEP_UBERCAL
     120    // RESET (-reset)
     121    // TimeSelect -time
     122    // DophotSelect
     123    // (note that psfQual is applied rigidly at 0.85, as is the galaxy test)
     124    // MAG_LIM
     125    // SIGMA_LIM
     126    // ImagSelect, ImagMin, ImagMax
     127    // MaxDensityUse, MaxDensityValue
     128
     129    char command[1024];
     130    snprintf (command, 1024, "relastro_client %s -load %s -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -D CAMERA %s -D MAG_LIM %f -D SIGMA_LIM %f",
     131              PhotcodeList, catalogFile, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, CAMERA, MAG_LIM, SIGMA_LIM);
     132
     133    char tmpline[1024];
     134    if (VERBOSE)       { snprintf (tmpline, 1024, "%s -v",              command);                    strcpy (command, tmpline); }
     135    if (VERBOSE2)      { snprintf (tmpline, 1024, "%s -vv",             command);                    strcpy (command, tmpline); }
     136    if (RESET)         { snprintf (tmpline, 1024, "%s -reset",          command);                    strcpy (command, tmpline); }
     137    if (KEEP_UBERCAL)  { snprintf (tmpline, 1024, "%s -keep-ubercal",   command);                    strcpy (command, tmpline); }
     138    if (DophotSelect)  { snprintf (tmpline, 1024, "%s -dophot %d",      command, DophotValue);       strcpy (command, tmpline); }
     139    if (ImagSelect)    { snprintf (tmpline, 1024, "%s -instmag %f %f",  command, ImagMin, ImagMax);  strcpy (command, tmpline); }
     140    if (MaxDensityUse) { snprintf (tmpline, 1024, "%s -max-density %f", command, MaxDensityValue);   strcpy (command, tmpline); }
     141    if (TimeSelect) {
     142      char *tstart = ohana_sec_to_date (TSTART);
     143      char *tstop  = ohana_sec_to_date (TSTOP);
     144      snprintf (tmpline, 1024, "%s -time %s %s", command, tstart, tstop);
     145      free (tstart);
     146      free (tstop);
     147      strcpy (command, tmpline);
     148    }
     149
     150    fprintf (stderr, "command: %s\n", command);
     151
     152    if (PARALLEL_MANUAL) continue;
     153
     154    if (PARALLEL_SERIAL) {
     155      int status = system (command);
     156      if (status) {
     157        fprintf (stderr, "ERROR running relastro_client\n");
     158        exit (2);
     159      }
     160    } else {
     161      // launch the job on the remote machine (no handshake)
     162      int errorInfo = 0;
     163      int pid = rconnect ("ssh", table->hosts[i].hostname, command, table->hosts[i].stdio, &errorInfo, FALSE);
     164      if (!pid) {
     165        if (DEBUG) fprintf (stderr, "failure to start %s (error %d)\n", table->hosts[i].hostname, errorInfo);
     166        exit (1);
     167      }
     168      table->hosts[i].pid = pid; // save for future reference
     169    }
     170  }
     171
     172  if (PARALLEL_MANUAL) {
     173    fprintf (stderr, "run the relastro_client commands above.  when these are done, hit return\n");
     174    getchar();
     175  }
     176  if (!PARALLEL_MANUAL && !PARALLEL_SERIAL) {
     177    HostTableWaitJobs (table, __FILE__, __LINE__);
     178  }
     179
     180  // each host generates a BrightCatalog structure, with the measure, average, etc value
     181  // loaded into a single set of arrays (of MeasureTiny, AverageTiny, Secfilt).  I need to
     182  // split out the per-catalog measurements into separate catalog entries.
     183
     184  // set up an initial array of catalogs
     185  CatalogSplitter *catalogs = BrightCatalogSplitInit (Nsecfilt);
     186
     187  for (i = 0; i < table->Nhosts; i++) {
     188
     189    // XXX save this name in table->hosts[]?  it is created above as well...
     190    char catalogFile[512];
     191    snprintf (catalogFile, 512, "%s/relastro.catalog.subset.dat", table->hosts[i].pathname);
     192
     193    BrightCatalog *bcatalog = BrightCatalogLoad (catalogFile);
     194    assert (bcatalog);
     195   
     196    BrightCatalogSplit (catalogs, bcatalog);
     197
     198    free (bcatalog->average);
     199    free (bcatalog->measure);
     200    free (bcatalog->secfilt);
     201    free (bcatalog);
     202  }
     203
     204  Catalog *catalog = catalogs->catalog;
     205  *Ncatalog = catalogs->Ncatalog;
     206  BrightCatalogSplitFree (catalogs);
     207
     208  int Nmeasure = 0;
     209  int Naverage = 0;
     210  for (i = 0; i < catalogs->Ncatalog; i++) {
     211    Nmeasure += catalogs->catalog[i].Nmeasure;
     212    Naverage += catalogs->catalog[i].Naverage;
     213  }
     214
     215  fprintf (stderr, "loaded %d catalogs, using a total of %d stars (%d measures)\n", catalogs->Ncatalog, Naverage, Nmeasure);
     216
     217  return (catalog);
     218}     
  • branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/relastro.c

    r32346 r33396  
    2020  }
    2121
    22   /* the object analysis is a separate process iterating over catalogs */
     22  /* high-speed is a 2pt cross-correlation process for linking moving objects (high PM) */
    2323  if (FIT_TARGET == TARGET_HIGH_SPEED) {
    2424    high_speed_catalogs ();
     
    2626  }
    2727
    28   /* the object analysis is a separate process iterating over catalogs */
     28  /* a special method to manually merge unlinked detections of sources togther (not parallel) */
    2929  if (FIT_TARGET == TARGET_MERGE_SOURCE) {
    3030    relastro_merge_source ();
  • branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/relastro_objects.c

    r27581 r33396  
    11# include "relastro.h"
    22
    3 int relastro_objects () {
     3int relastro_objects_parallel (SkyList *sky);
     4
     5int relastro_objects (int hostID, char *hostpath) {
    46
    57  int i, j, k, m;
     
    810  SkyList *skylist = NULL;
    911  Catalog catalog;
    10 
    1112
    1213  // load the current sky table (layout of all SkyRegions)
     
    2122  }
    2223
     24  // XXX need to decide how to determine PARALLEL mode...
     25  if (PARALLEL & !hostID) {
     26    relphot_objects_parallel (skylist);
     27    return TRUE;
     28  }
     29
    2330  // load data from each region file, only use bright stars
    2431  for (i = 0; i < skylist[0].Nregions; i++) {
    2532
     33    if (hostID && (skylist[0].regions[i]->hostID != hostID)) continue;
     34
    2635    // set up the basic catalog info
    27     catalog.filename  = skylist[0].filename[i];
     36    char hostfile[1024];
     37    snprintf (hostfile, 1024, "%s/%s.cpt", hostpath, skylist[0].regions[i]->name);
     38    catalog.filename  = hostID ? hostfile : skylist[0].filename[i];
    2839    catalog.catformat = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
    2940    catalog.catmode   = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
     
    7081  return (TRUE);
    7182}
     83
     84// CATDIR is supplied globally
     85# define DEBUG 1
     86int relastro_objects_parallel (SkyList *sky) {
     87
     88  // launch the setphot_client jobs to the parallel hosts
     89
     90  // load the list of hosts
     91  HostTable *table = HostTableLoad (CATDIR, sky->hosts);
     92  if (!table) {
     93    fprintf (stderr, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR);
     94    exit (1);
     95  }   
     96
     97  int i;
     98  for (i = 0; i < table->Nhosts; i++) {
     99
     100    // ensure that the paths are absolute path names
     101    char *tmppath = abspath (table->hosts[i].pathname, MAX_PATH_LENGTH);
     102    free (table->hosts[i].pathname);
     103    table->hosts[i].pathname = tmppath;
     104
     105    char catalogFile[512];
     106    snprintf (catalogFile, 512, "%s/relastro.catalog.subset.dat", table->hosts[i].pathname);
     107
     108    // options / arguments that can affect relastro_client -update-objects:
     109    // VERBOSE, VERBOSE2
     110    // RESET (-reset)
     111    // TimeSelect -time
     112    // DophotSelect
     113    // (note that psfQual is applied rigidly at 0.85, as is the galaxy test)
     114    // MAG_LIM
     115    // SIGMA_LIM
     116    // ImagSelect, ImagMin, ImagMax
     117    // MaxDensityUse, MaxDensityValue
     118
     119    // FIT_MODE
     120    // PM_TOOFEW
     121    // SRC_MEAS_TOOFEW
     122    // FIT_TARGET
     123
     124    char command[1024];
     125    snprintf (command, 1024, "relastro_client -update-objects -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f",
     126              table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
     127
     128    char tmpline[1024];
     129    if (VERBOSE)       { snprintf (tmpline, 1024, "%s -v",              command);                    strcpy (command, tmpline); }
     130    if (VERBOSE2)      { snprintf (tmpline, 1024, "%s -vv",             command);                    strcpy (command, tmpline); }
     131    if (RESET)         { snprintf (tmpline, 1024, "%s -reset",          command);                    strcpy (command, tmpline); }
     132    if (KEEP_UBERCAL)  { snprintf (tmpline, 1024, "%s -keep-ubercal",   command);                    strcpy (command, tmpline); }
     133
     134    fprintf (stderr, "command: %s\n", command);
     135
     136    if (PARALLEL_MANUAL) continue;
     137
     138    if (PARALLEL_SERIAL) {
     139      int status = system (command);
     140      if (status) {
     141        fprintf (stderr, "ERROR running relastro_client\n");
     142        exit (2);
     143      }
     144    } else {
     145      // launch the job on the remote machine (no handshake)
     146      int errorInfo = 0;
     147      int pid = rconnect ("ssh", table->hosts[i].hostname, command, table->hosts[i].stdio, &errorInfo, FALSE);
     148      if (!pid) {
     149        if (DEBUG) fprintf (stderr, "failure to start %s (error %d)\n", table->hosts[i].hostname, errorInfo);
     150        exit (1);
     151      }
     152      table->hosts[i].pid = pid; // save for future reference
     153    }
     154  }
     155
     156  if (PARALLEL_MANUAL) {
     157    fprintf (stderr, "run the relastro_client commands above.  when these are done, hit return\n");
     158    getchar();
     159  }
     160  if (!PARALLEL_MANUAL && !PARALLEL_SERIAL) {
     161    HostTableWaitJobs (table, __FILE__, __LINE__);
     162  }
     163
     164  return TRUE;
     165}     
Note: See TracChangeset for help on using the changeset viewer.