Changeset 33510
- Timestamp:
- Mar 13, 2012, 3:41:09 PM (14 years ago)
- Location:
- branches/eam_branches/ipp-20111122/Ohana/src/relphot
- Files:
-
- 4 edited
-
include/relphot.h (modified) (1 diff)
-
src/BrightCatalog.c (modified) (1 diff)
-
src/ImageOps.c (modified) (5 diffs)
-
src/load_catalogs.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/Ohana/src/relphot/include/relphot.h
r33447 r33510 7 7 # define GRID_V2 8 8 # 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 9 13 10 14 typedef enum { -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/BrightCatalog.c
r33503 r33510 35 35 if (!f) { 36 36 fprintf (stderr, "ERROR: cannot open image subset file %s\n", filename); 37 goto escape;37 return NULL; 38 38 } 39 39 -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/ImageOps.c
r33503 r33510 1 1 # include "relphot.h" 2 2 void 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 3 22 4 23 // we have an array of images: image[ImageIndex] (ImageIndex : 0 < Nimage) … … 20 39 21 40 // relationships between the measure,catalog set and the images: 22 static off_t**MeasureToImage; // image index from measure,catalog : MeasureToImage[cat][meas] = ImageIndex23 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])41 static IDX_T **MeasureToImage; // image index from measure,catalog : MeasureToImage[cat][meas] = ImageIndex 42 static IDX_T **ImageToCatalog; // catalog for given measure on image : ImageCatalog[ImageIndex][i] = cat (i : 0 < NonImage[ImageIndex]) 43 static IDX_T **ImageToMeasure; // measure for given measure on image : ImageMeasure[ImageIndex][i] = cat (i : 0 < NonImage[ImageIndex]) 25 44 26 45 // MeasureToImage was 'bin' … … 138 157 void initImageBins (Catalog *catalog, int Ncatalog, int doImageList) { 139 158 140 off_ti, j;141 142 ALLOCATE (MeasureToImage, off_t*, Ncatalog);159 IDX_T i, j; 160 161 ALLOCATE (MeasureToImage, IDX_T *, Ncatalog); 143 162 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)); 145 164 for (j = 0; j < catalog[i].Nmeasure; j++) MeasureToImage[i][j] = -1; 146 165 } … … 149 168 ALLOCATE (N_onImage, off_t, Nimage); 150 169 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); 153 172 154 173 for (i = 0; i < Nimage; i++) { 155 174 N_onImage[i] = 0; 156 175 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]); 159 178 } 160 179 } … … 289 308 if (N_onImage[idx] == N_ONIMAGE[idx]) { 290 309 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]); 293 312 } 294 313 } -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/load_catalogs.c
r33480 r33510 77 77 Nstar += catalog[i].Naverage; 78 78 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 } 79 84 } 80 85 if (Nstar < 2) { … … 173 178 if (!pid) { 174 179 if (DEBUG) fprintf (stderr, "failure to start %s (error %d)\n", table->hosts[i].hostname, errorInfo); 175 exit (1);180 continue; 176 181 } 177 182 table->hosts[i].pid = pid; // save for future reference … … 196 201 for (i = 0; i < table->Nhosts; i++) { 197 202 198 // XXX save this name in table->hosts[]? it is created above as well...199 203 char catalogFile[512]; 200 204 snprintf (catalogFile, 512, "%s/relphot.catalog.subset.dat", table->hosts[i].pathname); 201 205 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 } 204 215 205 216 BrightCatalogSplit (catalogs, bcatalog);
Note:
See TracChangeset
for help on using the changeset viewer.
