IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35699


Ignore:
Timestamp:
Jun 21, 2013, 3:21:44 PM (13 years ago)
Author:
eugene
Message:

enable dvomerge to read from a parallel dvo db (regardless of output parallel state)

Location:
branches/eam_branches/ipp-20130509/Ohana/src/dvomerge
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130509/Ohana/src/dvomerge/include/dvomerge.h

    r35619 r35699  
    2323int    HOST_ID;
    2424char  *HOSTDIR;
     25
     26int    PARALLEL_INPUT;
    2527
    2628int    VERBOSE;
  • branches/eam_branches/ipp-20130509/Ohana/src/dvomerge/src/args.c

    r35619 r35699  
    7676  }
    7777
     78  // is the input database a parallel db?
     79  PARALLEL_INPUT = FALSE;
     80  if ((N = get_argument (*argc, argv, "-parallel-input"))) {
     81    PARALLEL_INPUT = TRUE;
     82    remove_argument (N, argc, argv);
     83  }
     84
     85  // is the output database a parallel db?
    7886  PARALLEL = FALSE;
    7987  if ((N = get_argument (*argc, argv, "-parallel"))) {
     
    117125  IMAGES_ONLY = FALSE;
    118126
     127  // is the input database a parallel db?
     128  PARALLEL_INPUT = FALSE;
     129  if ((N = get_argument (*argc, argv, "-parallel-input"))) {
     130    PARALLEL_INPUT = TRUE;
     131    remove_argument (N, argc, argv);
     132  }
     133
    119134  HOST_ID = 0;
    120135  if ((N = get_argument (*argc, argv, "-hostID"))) {
     
    246261  }
    247262
     263  // is the output database a parallel db?
    248264  PARALLEL = FALSE;
    249265  if ((N = get_argument (*argc, argv, "-parallel"))) {
  • branches/eam_branches/ipp-20130509/Ohana/src/dvomerge/src/dvomergeUpdate_catalogs.c

    r35619 r35699  
    1919    int status = dvomergeUpdate_parallel (input, output, outsky, IDmap);
    2020    return status;
     21  }
     22
     23  // load the list of hosts
     24  HostTable *table_input = NULL;
     25  if (PARALLEL_INPUT) {
     26    table_input = HostTableLoad (input, inlist->hosts);
     27    if (!table_input) {
     28      fprintf (stderr, "ERROR: failure reading Host Table %s for database %s\n", inlist->hosts, input);
     29      exit (1);
     30    }   
     31
     32    // ensure we have absolute paths for hostdirs
     33    for (i = 0; i < table_input->Nhosts; i++) {
     34      char *tmppath = abspath (table_input->hosts[i].pathname, DVO_MAX_PATH);
     35      free (table_input->hosts[i].pathname);
     36      table_input->hosts[i].pathname = tmppath;
     37    }
    2138  }
    2239
     
    2542    if (!inlist[0].regions[i][0].table) continue;
    2643    if (VERBOSE) fprintf (stderr, "input: %s\n", inlist[0].regions[i][0].name);
     44
     45    // in a parallel context, we need to re-map the input filename
     46    char *filename_input = strcreate (inlist[0].filename[i]);
     47    if (PARALLEL_INPUT) {
     48
     49      int hostID_input = inlist[0].regions[i]->hostID;
     50      int table_index = table_input->index[hostID_input];
     51      char *hostdir_input = table_input->hosts[table_index].pathname;
     52
     53      // set the parameters which guide catalog open/load/create
     54      char hostfile_input[DVO_MAX_PATH];
     55      snprintf (hostfile_input, DVO_MAX_PATH, "%s/%s.cpt", hostdir_input, inlist[0].regions[i]->name);
     56      free (filename_input);
     57      filename_input = strcreate (hostfile_input);
     58    }
    2759
    2860    // SkyListByBounds will return neighbor catalogs if the boundaries exactly match (due to rounding).  Since the regions are not infinitely small,
     
    4981
    5082    // get stats for history check, skip input catalog if file not found (NULL inStats)
    51     dmhObjectStats *inStats = dmhObjectStatsRead (inlist[0].filename[i]);
     83    dmhObjectStats *inStats = dmhObjectStatsRead (filename_input);
    5284    if (!inStats) {
    53       if (VERBOSE) fprintf (stderr, "skipping %s, empty \n", inlist[0].filename[i]);
     85      if (VERBOSE) fprintf (stderr, "skipping %s, empty \n", filename_input);
    5486      OutputStatusFree (outstat, outlist->Nregions);
    5587      SkyListFree (outlist);
     
    76108    }
    77109    if (!missed) {
    78       if (VERBOSE || VERIFY) fprintf (stderr, "skipping %s, already merged\n", inlist[0].filename[i]);
     110      if (VERBOSE || VERIFY) fprintf (stderr, "skipping %s, already merged\n", filename_input);
    79111      OutputStatusFree (outstat, outlist->Nregions);
    80112      dmhObjectStatsFree (inStats);
     
    83115    }
    84116    if (VERIFY) {
    85       fprintf (stderr, "%s NOT merged\n", inlist[0].filename[i]);
     117      fprintf (stderr, "%s NOT merged\n", filename_input);
    86118      continue;
    87119    }
    88120
    89121    // read the input catalog
    90     LoadCatalog (&incatalog, &inlist[0].regions[i][0], inlist[0].filename[i], "r", NsecfiltInput);
     122    LoadCatalog (&incatalog, &inlist[0].regions[i][0], filename_input, "r", NsecfiltInput);
     123    free (filename_input);
    91124
    92125    // skip empty input catalogs
     
    198231
    199232    char tmpline[DVO_MAX_PATH];
    200     if (VERBOSE)             { snprintf (tmpline, DVO_MAX_PATH, "%s -v",       command); strcpy (command, tmpline); }
    201     if (VERIFY)              { snprintf (tmpline, DVO_MAX_PATH, "%s -verify",  command); strcpy (command, tmpline); }
     233    if (VERBOSE)             { snprintf (tmpline, DVO_MAX_PATH, "%s -v",       command);          strcpy (command, tmpline); }
     234    if (VERIFY)              { snprintf (tmpline, DVO_MAX_PATH, "%s -verify",  command);          strcpy (command, tmpline); }
    202235    if (VERIFY_CATALOG_ONLY) { snprintf (tmpline, DVO_MAX_PATH, "%s -verify-catalogs",  command); strcpy (command, tmpline); }
    203     if (REPLACE_BY_PHOTCODE) { snprintf (tmpline, DVO_MAX_PATH, "%s -replace", command); strcpy (command, tmpline); }
     236    if (REPLACE_BY_PHOTCODE) { snprintf (tmpline, DVO_MAX_PATH, "%s -replace", command);          strcpy (command, tmpline); }
     237    if (PARALLEL_INPUT)      { snprintf (tmpline, DVO_MAX_PATH, "%s -parallel-input",  command);  strcpy (command, tmpline); }
    204238
    205239    fprintf (stderr, "command: %s\n", command);
  • branches/eam_branches/ipp-20130509/Ohana/src/dvomerge/test/dvomerge.parallel.sh

    r33963 r35699  
    11#!/bin/csh -f
    22
    3  rm -rf catdir.merge
    4  rsync -auv catdir.2mass/ catdir.merge/
     3 rm -rf catdir.merge catdir.merge.p?
     4 rsync --exclude=.svn -auv catdir.2mass/ catdir.merge/
    55 cp HostTable.dat catdir.merge/
    66 dvodist -out catdir.merge
     7 rm -rf catdir.merge/n????
     8
    79 dvomerge -parallel catdir.grizy into catdir.merge
     10 dvomerge -parallel catdir.grizy into catdir.merge -verify
Note: See TracChangeset for help on using the changeset viewer.