Changeset 33244
- Timestamp:
- Feb 13, 2012, 11:32:14 AM (14 years ago)
- Location:
- branches/eam_branches/ipp-20111122/Ohana/src
- Files:
-
- 4 added
- 9 edited
-
libdvo/include/dvo.h (modified) (4 diffs)
-
libdvo/src/skyregion_ops.c (modified) (6 diffs)
-
relphot/doc/parallel.txt (added)
-
relphot/src/BrightCatalog.c (added)
-
relphot/src/ImageSubset.c (added)
-
relphot/src/args.c (modified) (1 diff)
-
relphot/src/help.c (modified) (1 diff)
-
relphot/src/initialize.c (modified) (1 diff)
-
relphot/src/load_catalogs.c (modified) (3 diffs)
-
relphot/src/reload_catalogs.c (modified) (1 diff)
-
relphot/src/relphot.c (modified) (1 diff)
-
relphot/src/relphot_client.c (added)
-
uniphot/src/setphot_client.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/Ohana/src/libdvo/include/dvo.h
r33239 r33244 205 205 char **filename; 206 206 SkyRegion **regions; 207 char hosts[80]; 207 208 } SkyList; 208 209 … … 261 262 } PhotCodeData; 262 263 263 // a reduced-subset structure for relphot 264 // a reduced-subset structure for relphot & relastro 264 265 typedef struct { 265 266 double R; … … 268 269 int measureOffset; 269 270 uint32_t flags; 271 int catID; 270 272 } AverageTiny; 271 273 272 // a reduced-subset structure for relphot 274 // a reduced-subset structure for relphot & relastro 273 275 typedef struct { 274 276 float dR; … … 285 287 unsigned int imageID; 286 288 unsigned int dbFlags; 289 int catID; // unsigned int? 287 290 unsigned short photcode; 288 291 } MeasureTiny; -
branches/eam_branches/ipp-20111122/Ohana/src/libdvo/src/skyregion_ops.c
r29439 r33244 20 20 list[0].Nregions = 0; 21 21 list[0].ownElements = FALSE; // this list is only holding a view to the elements 22 strcpy (list[0].hosts, table[0].hosts); 22 23 23 24 region = table[0].regions; … … 67 68 list[0].Nregions = N; 68 69 list[0].ownElements = FALSE; // this list is only holding a view to the elements 70 strcpy (list[0].hosts, table[0].hosts); 69 71 70 72 region = table[0].regions; … … 102 104 list[0].Nregions = N; 103 105 list[0].ownElements = FALSE; // this list is only holding a view to the elements 106 strcpy (list[0].hosts, table[0].hosts); 104 107 105 108 region = table[0].regions; … … 261 264 ALLOCATE (list[0].filename, char *, NNEW); 262 265 list[0].ownElements = FALSE; // this list is only holding a view to the elements 266 strcpy (list[0].hosts, table[0].hosts); 263 267 264 268 region = table[0].regions; … … 326 330 list[0].Nregions = 0; 327 331 list[0].ownElements = FALSE; // this list is only holding a view to the elements 332 strcpy (list[0].hosts, inList[0].hosts); 328 333 329 334 region = inList[0].regions; … … 403 408 ALLOCATE (list[0].filename, char *, NNEW); 404 409 list[0].ownElements = FALSE; // this list is only holding a view to the elements 410 strcpy (list[0].hosts, table[0].hosts); 405 411 406 412 region = table[0].regions; -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/args.c
r33169 r33244 265 265 return TRUE; 266 266 } 267 268 int args_client (int argc, char **argv) { 269 270 int N; 271 272 if ((N = get_argument (argc, argv, "-v"))) { 273 VERBOSE = TRUE; 274 remove_argument (N, &argc, argv); 275 } 276 277 HOST_ID = 0; 278 if ((N = get_argument (argc, argv, "-hostID"))) { 279 remove_argument (N, &argc, argv); 280 HOST_ID = atoi (argv[N]); 281 remove_argument (N, &argc, argv); 282 } 283 if (!HOST_ID) relphot_client_usage(); 284 285 HOSTDIR = NULL; 286 if ((N = get_argument (argc, argv, "-hostdir"))) { 287 remove_argument (N, &argc, argv); 288 HOSTDIR = strcreate (argv[N]); 289 remove_argument (N, &argc, argv); 290 } 291 if (!HOSTDIR) relphot_client_usage(); 292 293 CATDIR[0] = 0; 294 if ((N = get_argument (argc, argv, "-catdir"))) { 295 remove_argument (N, &argc, argv); 296 strcpy (CATDIR, argv[N]); 297 remove_argument (N, &argc, argv); 298 } 299 if (!CATDIR[0]) relphot_client_usage(); 300 301 IMAGES = NULL; // used in -update mode 302 BCATALOG = NULL; // used in -load mode 303 MODE = MODE_NONE; 304 if ((N = get_argument (argc, argv, "-load"))) { 305 MODE = MODE_LOAD; 306 remove_argument (N, &argc, argv); 307 BCATALOG = strcreate (argv[N]); 308 remove_argument (N, &argc, argv); 309 } 310 if ((N = get_argument (argc, argv, "-update"))) { 311 if (MODE) { 312 fprintf (stderr, "ERROR: cannot use both -load and -update options!\n"); 313 usage(); 314 } 315 MODE = MODE_UPDATE; 316 remove_argument (N, &argc, argv); 317 IMAGES = strcreate (argv[N]); 318 remove_argument (N, &argc, argv); 319 } 320 if (!MODE) relphot_client_usage(); 321 322 if (argc != 1) relphot_client_usage (); 323 324 return TRUE; 325 } -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/help.c
r33157 r33244 44 44 } 45 45 46 void relphot_client_usage (void) { 47 fprintf (stderr, "ERROR: USAGE: relphot -load -bcatalog (filename) -hostID (hostID) -hostdir (hostdir) -catdir (catdir)\n"); 48 fprintf (stderr, " or: relphot -update -images (filename) -hostID (hostID) -hostdir (hostdir) -catdir (catdir)\n"); 49 fprintf (stderr, " use -h for more usage information\n"); 50 exit (2); 51 } 52 53 void relphot_client_help (int argc, char **argv) { 54 55 /* check for help request */ 56 if (get_argument (argc, argv, "-help")) goto show_help; 57 if (get_argument (argc, argv, "-h")) goto show_help; 58 if (argc == 1) relphot_client_usage(); 59 return; 60 61 show_help: 62 fprintf (stderr, "USAGE: relphot_client [-load / -update] (db info)\n\n"); 63 fprintf (stderr, " relphot_client -load (bcatalog) : extract the bright catalog subset from client's tables\n"); 64 fprintf (stderr, " (bcatalog) : location where the bright subset is saved\n"); 65 fprintf (stderr, " relphot_client -update (images) : apply calculated zero points to the client's tables\n\n"); 66 fprintf (stderr, " (images) : location of the table with the image zero points\n"); 67 fprintf (stderr, " db info : -hostID (hostID) -hostdir (hostdir) -catdir (catdir)\n"); 68 fprintf (stderr, "other options:\n"); 69 fprintf (stderr, " -v : verbose output\n"); 70 fprintf (stderr, " \n"); 71 exit (2); 72 } 73 -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/initialize.c
r31450 r33244 95 95 srand48(B); 96 96 } 97 98 void initialize_relphot_client (int argc, char **argv) { 99 100 int N; 101 102 relphot_client_help (argc, argv); 103 // ConfigInit (&argc, argv); XXX not sure if we need anything in here (maybe photcode table) 104 args_client (argc, argv); 105 } -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/load_catalogs.c
r31668 r33244 1 1 # include "relphot.h" 2 2 3 Catalog *load_catalogs (SkyList *skylist, int *Ncatalog) { 3 // this function loops over the catalogs, loads the data, and extracts a bright subset 4 // the returned array (catalog, Ncatalog) has the same layout as the full database, but 5 // only a subset of the detetions & objects 6 7 // if this function is called in parallel mode, it in turn calls load_catalogs_parallel, 8 // which distributes the work to the remote hosts and loads their results 9 10 // if this function is called with a specified hostID, then only the fraction of the 11 // database hosted by that hostID is loaded 12 Catalog *load_catalogs (SkyList *skylist, int *Ncatalog, int hostID, char *hostpath) { 4 13 5 14 off_t i, Nmeas, Nstar, Nmeas_total, Nstar_total; 6 15 Catalog *catalog, tcatalog; 7 16 17 // XXX need to decide how to determine PARALLEL mode... 18 if (PARALLEL & !hostID) { 19 catalog = load_catalogs_parallel (skylist, Ncatalog); 20 return catalog; 21 } 22 8 23 if (VERBOSE2) fprintf (stderr, "loading catalog data\n"); 9 24 25 // a bit of an over-alloc, since we don't load all catalogs for a region 10 26 ALLOCATE (catalog, Catalog, skylist[0].Nregions); 11 27 … … 16 32 dvo_catalog_init (&catalog[i], TRUE); 17 33 34 if (hostID && (skylist[0].regions[i]->hostID != hostID)) continue; 35 18 36 // set up the basic catalog info 19 tcatalog.filename = skylist[0].filename[i]; 37 char hostfile[1024]; 38 snprintf (hostfile, 1024, "%s/%s.cpt", hostpath, skylist[0].regions[i]->name); 39 tcatalog.filename = hostID ? hostfile : skylist[0].filename[i]; 40 20 41 tcatalog.catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data 21 42 tcatalog.catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data … … 67 88 need to use an XCLD lock here. 68 89 */ 90 91 // CATDIR is supplied globally 92 Catalog *load_catalogs_parallel (SkyTable *sky, int *Ncatalog) { 93 94 // launch the setphot_client jobs to the parallel hosts 95 96 // load the list of hosts 97 HostTable *table = HostTableLoad (CATDIR, sky->hosts); 98 99 int i; 100 for (i = 0; i < table->Nhosts; i++) { 101 102 char catalogFile[512]; 103 snprintf (catalogFile, 512, "%s/relphot.catalog.subset.dat", table->hosts[i].pathname); 104 105 char command[1024]; 106 snprintf (command, 1024, "relphot_client -test -load %s -hostID %d -catdir %s -hostdir %s", 107 catalogFile, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname); 108 109 fprintf (stderr, "command: %s\n", command); 110 111 // launch the job on the remote machine (no handshake) 112 int errorInfo = 0; 113 int pid = rconnect ("ssh", table->hosts[i].hostname, command, table->hosts[i].stdio, &errorInfo, FALSE); 114 if (!pid) { 115 if (DEBUG) fprintf (stderr, "failure to start %s (error %d)\n", table->hosts[i].hostname, errorInfo); 116 exit (1); 117 } 118 table->hosts[i].pid = pid; // save for future reference 119 120 // check that all hosts started OK? 121 } 122 123 // watch for stdout / stderr from those jobs... 124 // wait for all of them to complete... 125 126 // each host generates a BrightCatalog structure, with the measure, average, etc value loaded into a single 127 // set of arrays (of MeasureTiny, AverageTiny, Secfilt). I need to split out the 128 // per-catalog measurements into separate catalog entries. 129 130 // we don't know how many catalogs we actually need. allocate a single entry, then 131 // below we will allocate the max number needed after the BrightCatalog is loaded 132 int Ncatalog = 0; 133 int NCATALOG = 1; 134 ALLOCATE (catalog, Catalog, NCATALOG); 135 136 int *NAVERAGE; 137 int *NMEASURE; 138 ALLOCATE (NAVERAGE, int, NCATALOG); 139 ALLOCATE (NMEASURE, int, NCATALOG); 140 for (i = 0; i < NCATALOG; i++) { 141 NAVERAGE[i] = 100; 142 NMEASURE[i] = 100; 143 catalog[i].Naverage = 0; 144 catalog[i].Nmeasure = 0; 145 ALLOCATE (catalog[i].averageT, AverageTiny, NAVERAGE[i]); 146 ALLOCATE (catalog[i].measureT, MeasureTiny, NMEASURE[i]); 147 ALLOCATE (catalog[i].secfilt, SecFilt, Nsecfilt*NAVERAGE[i]); 148 } 149 150 for (i = 0; i < table->Nhosts; i++) { 151 152 // XXX save this name in table->hosts[]? it is created above as well... 153 char catalogFile[512]; 154 snprintf (catalogFile, 512, "%s/relphot.catalog.subset.dat", table->hosts[i].pathname); 155 156 BrightCatalog *bcatalog = BrightCatalogLoad (catalogFile); 157 assert (bcatalog); 158 159 // XXX put the code below into a function equivalent to BrightCatalogMerge? 160 161 // find the max value of catID and realloc to match that (check measure & average or 162 // just average?) 163 int catIDmax = 0; 164 for (j = 0; j < bcatalog->Naverage; j++) { 165 catIDmax = MAX(catIDmax, bcatalog->average[j].catID); 166 } 167 // XXX validate the measure ID range here 168 169 int NCATALOG_OLD = NCATALOG; 170 NCATALOG = MAX (NCATALOG, catIDmax); 171 REALLOCATE (catalog, Catalog, NCATALOG); 172 173 REALLOCATE (NAVERAGE, int, NCATALOG); 174 REALLOCATE (NMEASURE, int, NCATALOG); 175 for (i = NCATALOG_OLD; i < NCATALOG; i++) { 176 NAVERAGE[i] = 100; 177 NMEASURE[i] = 100; 178 catalog[i].Naverage = 0; 179 catalog[i].Nmeasure = 0; 180 ALLOCATE (catalog[i].averageT, AverageTiny, NAVERAGE[i]); 181 ALLOCATE (catalog[i].measureT, MeasureTiny, NMEASURE[i]); 182 ALLOCATE (catalog[i].secfilt, SecFilt, Nsecfilt*NAVERAGE[i]); 183 } 184 185 // each bcatalog (from each host) has a different set of catID ranges 186 // they also (probably) have contiguous ranges. But, it is a bit tricky to be sure I 187 // can use that info, so perhaps ignore it 188 189 // assign the averages to the corresponding catalog 190 for (j = 0; j < bcatalog->Naverage; j++) { 191 Nc = bcatalog->average[j].catID; 192 assert (Nc < NCATALOG); 193 Na = catalog[Nc].Naverage; 194 catalog[Nc].averageT[Na] = bcatalog->average[j]; 195 196 // secfilt entries are grouped in blocks for each average 197 for (k = 0; k < Nsecfilt; k++) { 198 catalog[Nc].secfilt[Na*Nsecfilt + k] = bcatalog->secfilt[j*Nsecfilt + k]; 199 } 200 201 catalog[Nc].Naverage ++; 202 if (catalog[Nc].Naverage >= NAVERAGE[N]) { 203 NAVERAGE[Nc] += 100; 204 REALLOCATE (catalog[Nc].averageT, AverageTiny, NAVERAGE[Nc]); 205 REALLOCATE (catalog[Nc].secfilt, SecFilt, Nsecfilt*NAVERAGE[Nc]); 206 } 207 } 208 209 // assign the measures to the corresponding catalog 210 // XXX what about averef and related links? Do I need them? 211 for (j = 0; j < bcatalog->Nmeasure; j++) { 212 Nc = bcatalog->measure[j].catID; 213 assert (Nc < NCATALOG); 214 Na = catalog[Nc].Nmeasure; 215 catalog[Nc].measureT[Na] = bcatalog->measure[j]; 216 catalog[Nc].Nmeasure ++; 217 if (catalog[Nc].Nmeasure >= NMEASURE[N]) { 218 NMEASURE[Nc] += 100; 219 REALLOCATE (catalog[Nc].measureT, MeasureTiny, NMEASURE[Nc]); 220 } 221 } 222 // XXX free the input bcatalog entries 223 } 224 *Ncatalog = NCATALOG; 225 return (catalog); 226 } -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/reload_catalogs.c
r33117 r33244 94 94 fprintf (stderr, "time7 %f : free catalog\n", time7); 95 95 } 96 97 int reload_catalogs_parallel (SkyTable *sky, Image *image, off_t Nimage) { 98 99 // write out the subset table of image information 100 char imageFile[512]; 101 snprintf (imageFile, 512, "%s/Images.subset.dat", CATDIR); 102 if (!ImageSubsetSave (imageFile, image, Nimage)) { 103 fprintf (stderr, "failed to write image subset\n"); 104 exit (1); 105 } 106 107 // now launch the relphot_client jobs to the parallel hosts 108 109 // load the list of hosts 110 HostTable *table = HostTableLoad (CATDIR, sky->hosts); 111 112 int i; 113 for (i = 0; i < table->Nhosts; i++) { 114 115 char command[1024]; 116 snprintf (command, 1024, "relphot_client -reload -hostname %s -catdir %s -hostdir %s -images %s", 117 table->hosts[i].hostname, CATDIR, table->hosts[i].pathname, imageFile); 118 119 fprintf (stderr, "command: %s\n", command); 120 121 // launch the job on the remote machine (no handshake) 122 int errorInfo = 0; 123 int pid = rconnect ("ssh", table->hosts[i].hostname, command, table->hosts[i].stdio, &errorInfo, FALSE); 124 if (!pid) { 125 if (DEBUG) fprintf (stderr, "failure to start %s (error %d)\n", table->hosts[i].hostname, errorInfo); 126 exit (1); 127 } 128 table->hosts[i].pid = pid; // save for future reference 129 130 // check that all hosts started OK? 131 } 132 133 // watch for stdout / stderr from those jobs... 134 // wait for all of them to complete... 135 136 return (TRUE); 137 } -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/relphot.c
r33157 r33244 241 241 242 242 /* load catalog data from region files, update Mrel include all data */ 243 reload_catalogs (skylist, flatcorr); 243 if (PARALLEL) { 244 reload_catalogs_parallel (); 245 } else { 246 reload_catalogs (skylist, flatcorr); 247 } 244 248 MARKTIME("-- updated all catalogs: %f sec\n", dtime); 245 249 -
branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/setphot_client.c
r33241 r33244 29 29 exit (0); 30 30 } 31 32 33 /* setphot : set the zero points for images in the db (perhaps based on external information)34 setphot (zpt_table)35 36 setphot has 2 modes : basic & ubercal37 38 * outline of basic mode:39 40 ** load text table of zpts, time (photcode?)41 ** load images42 ** match images to zpts43 ** set zpts44 ** load catalogs45 ** update detection (& averages?)46 47 * outline of ubercal mode:48 49 ** load fits table of zpts & time + table of flat-field corrections50 ** load images51 ** match images to zpts52 ** set zpts53 ** load catalogs54 ** update detection (& averages?)55 56 */57
Note:
See TracChangeset
for help on using the changeset viewer.
