IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33510


Ignore:
Timestamp:
Mar 13, 2012, 3:41:09 PM (14 years ago)
Author:
eugene
Message:

use int for image<->measure+catalog index (user-set in relphot.h with IDX_T); allow retry for failed remote load jobs

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

Legend:

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

    r33447 r33510  
    77# define GRID_V2
    88# define NO_IMAGE -100
     9
     10// choose off_t or int depending on full-scale relphot analysis resources
     11// # define IDX_T off_t
     12# define IDX_T int
    913
    1014typedef enum {
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/BrightCatalog.c

    r33503 r33510  
    3535  if (!f) {
    3636    fprintf (stderr, "ERROR: cannot open image subset file %s\n", filename);
    37     goto escape;
     37    return NULL;
    3838  }
    3939
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/ImageOps.c

    r33503 r33510  
    11# include "relphot.h"
    22void plot_setMcal (double *list, int Npts, StatType *stats, float clouds);
     3
     4// the MeasureToImage, ImageToCatalog, and ImageToMeasure arrays are a substantial part of the memory footprint.
     5// total data volume is currently:
     6// a) Naverage*sizeof(AverageTiny)      [averages]       : 32
     7// b) Naverage*sizeof(Secfilt)*Nsecfilt [secfilt values] : 8 * 32
     8// b) Nmeasure*sizeof(Measure)          [measurements]   : 72
     9// c) Nmeasure*sizeof(IDX_T)*3          [image idx]      : 3 * 16
     10// d) Nmeasure*sizeof(IDX_T)*3          [mosaic idx]     : 3 * 16
     11// e) Nimage*sizeof(Image)              [image data]     : 360
     12
     13// for 3pi analysis in 2012, we have Nmeasure ~ 20 x Naverage
     14// so, each measurement costs ~14.5B (Ave + Sec) + 72B (Meas) + 96B (idx)!
     15// we are using off_t (64bit) to avoid the 32bit limit of an int, but
     16// if we really had 2^31 measurements in a single analysis, we would be using > 350GB of ram...
     17// until we reach that point, it is sort of silly to use IDX_T = off_t here.
     18
     19// with IDX_T = int, each measurement costs ~14.5B (Ave + Sec) + 72B (Meas) + 48B (idx)!
     20
     21// elsewhere (not in relphot_images), we need to use off_t because a single catalog
    322
    423// we have an array of images: image[ImageIndex] (ImageIndex : 0 < Nimage)
     
    2039
    2140// relationships between the measure,catalog set and the images:
    22 static off_t       **MeasureToImage; // image index from measure,catalog   : MeasureToImage[cat][meas] = ImageIndex
    23 static off_t       **ImageToCatalog; // catalog for given measure on image : ImageCatalog[ImageIndex][i] = cat (i : 0 < NonImage[ImageIndex])
    24 static off_t       **ImageToMeasure; // measure for given measure on image : ImageMeasure[ImageIndex][i] = cat (i : 0 < NonImage[ImageIndex])
     41static IDX_T       **MeasureToImage; // image index from measure,catalog   : MeasureToImage[cat][meas] = ImageIndex
     42static IDX_T       **ImageToCatalog; // catalog for given measure on image : ImageCatalog[ImageIndex][i] = cat (i : 0 < NonImage[ImageIndex])
     43static IDX_T       **ImageToMeasure; // measure for given measure on image : ImageMeasure[ImageIndex][i] = cat (i : 0 < NonImage[ImageIndex])
    2544
    2645// MeasureToImage was 'bin'
     
    138157void initImageBins (Catalog *catalog, int Ncatalog, int doImageList) {
    139158
    140   off_t i, j;
    141 
    142   ALLOCATE (MeasureToImage, off_t *, Ncatalog);
     159  IDX_T i, j;
     160
     161  ALLOCATE (MeasureToImage, IDX_T *, Ncatalog);
    143162  for (i = 0; i < Ncatalog; i++) {
    144     ALLOCATE (MeasureToImage[i], off_t, MAX (catalog[i].Nmeasure, 1));
     163    ALLOCATE (MeasureToImage[i], IDX_T, MAX (catalog[i].Nmeasure, 1));
    145164    for (j = 0; j < catalog[i].Nmeasure; j++) MeasureToImage[i][j] = -1;
    146165  }
     
    149168    ALLOCATE (N_onImage, off_t, Nimage);
    150169    ALLOCATE (N_ONIMAGE, off_t, Nimage);
    151     ALLOCATE (ImageToCatalog, off_t *, Nimage);
    152     ALLOCATE (ImageToMeasure, off_t *, Nimage);
     170    ALLOCATE (ImageToCatalog, IDX_T *, Nimage);
     171    ALLOCATE (ImageToMeasure, IDX_T *, Nimage);
    153172
    154173    for (i = 0; i < Nimage; i++) {
    155174      N_onImage[i] = 0;
    156175      N_ONIMAGE[i] = 30;
    157       ALLOCATE (ImageToCatalog[i], off_t, N_ONIMAGE[i]);
    158       ALLOCATE (ImageToMeasure[i], off_t, N_ONIMAGE[i]);
     176      ALLOCATE (ImageToCatalog[i], IDX_T, N_ONIMAGE[i]);
     177      ALLOCATE (ImageToMeasure[i], IDX_T, N_ONIMAGE[i]);
    159178    }
    160179  }
     
    289308    if (N_onImage[idx] == N_ONIMAGE[idx]) {
    290309      N_ONIMAGE[idx] += 30;
    291       REALLOCATE (ImageToCatalog[idx], off_t, N_ONIMAGE[idx]);
    292       REALLOCATE (ImageToMeasure[idx], off_t, N_ONIMAGE[idx]);
     310      REALLOCATE (ImageToCatalog[idx], IDX_T, N_ONIMAGE[idx]);
     311      REALLOCATE (ImageToMeasure[idx], IDX_T, N_ONIMAGE[idx]);
    293312    }   
    294313  }
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/load_catalogs.c

    r33480 r33510  
    7777    Nstar += catalog[i].Naverage;
    7878    Nmeas += catalog[i].Nmeasure;
     79    if ((sizeof(IDX_T) == 8) && (catalog[i].Nmeasure > 0xffffffff)) {
     80      fprintf (stderr, "ERROR: using small-sized IDX_T on data with more than 2G detections per table will cause errors\n");
     81      fprintf (stderr, "  If you need to do this, and you can afford the RAM, rebuild with IDX_T set to off_t (see relphot.h, ImagesOps.c)\n");
     82      exit (3);
     83    }
    7984  }
    8085  if (Nstar < 2) {
     
    173178      if (!pid) {
    174179        if (DEBUG) fprintf (stderr, "failure to start %s (error %d)\n", table->hosts[i].hostname, errorInfo);
    175         exit (1);
     180        continue;
    176181      }
    177182      table->hosts[i].pid = pid; // save for future reference
     
    196201  for (i = 0; i < table->Nhosts; i++) {
    197202
    198     // XXX save this name in table->hosts[]?  it is created above as well...
    199203    char catalogFile[512];
    200204    snprintf (catalogFile, 512, "%s/relphot.catalog.subset.dat", table->hosts[i].pathname);
    201205
    202     BrightCatalog *bcatalog = BrightCatalogLoad (catalogFile);
    203     assert (bcatalog);
     206    BrightCatalog *bcatalog = NULL;
     207    while ((bcatalog = BrightCatalogLoad (catalogFile)) == NULL) {
     208      // failed to get the data from this host.  This can happen for various reasons.  Give the user a chance to try again...
     209      fprintf (stderr, "failed to read data from %s, stopping operations until this can be fixed\n", table->hosts[i].hostname);
     210      fprintf (stderr, "you may run the command manually and send this process the CONT signal\n");
     211      int pid = getpid();
     212      kill (pid, SIGSTOP);
     213      fprintf (stderr, "retrying %s\n", catalogFile);
     214    }
    204215   
    205216    BrightCatalogSplit (catalogs, bcatalog);
Note: See TracChangeset for help on using the changeset viewer.