Changeset 33896 for branches/eam_branches/ipp-20120405/Ohana
- Timestamp:
- May 22, 2012, 7:12:16 AM (14 years ago)
- Location:
- branches/eam_branches/ipp-20120405/Ohana/src/addstar
- Files:
-
- 2 added
- 13 edited
-
Makefile (modified) (3 diffs)
-
include/addstar.h (modified) (3 diffs)
-
src/addstar.c (modified) (8 diffs)
-
src/addstar_client.c (added)
-
src/addstarc.c (modified) (3 diffs)
-
src/addstart.c (modified) (1 diff)
-
src/args.c (modified) (3 diffs)
-
src/args_client.c (modified) (1 diff)
-
src/args_load2mass.c (modified) (1 diff)
-
src/args_loadsupercos.c (modified) (1 diff)
-
src/args_loadwise.c (modified) (1 diff)
-
src/args_parallel_client.c (added)
-
src/args_sedstar.c (modified) (1 diff)
-
src/resort_unthreaded.c (modified) (2 diffs)
-
src/resort_unthreaded_catalogs.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20120405/Ohana/src/addstar/Makefile
r33824 r33896 78 78 $(SRC)/resort_threaded.$(ARCH).o \ 79 79 $(SRC)/resort_unthreaded.$(ARCH).o \ 80 $(SRC)/resort_unthreaded_catalogs.$(ARCH).o \ 80 81 $(SRC)/StarOps.$(ARCH).o \ 81 82 $(SRC)/ReadStarsFITS.$(ARCH).o \ … … 89 90 $(SRC)/update_coords.$(ARCH).o \ 90 91 $(SRC)/psps_ids.$(ARCH).o 92 93 # this is the client for parallel operations 94 ADDSTAR_CLIENT = \ 95 $(SRC)/ConfigInit.$(ARCH).o \ 96 $(SRC)/SetSignals.$(ARCH).o \ 97 $(SRC)/Shutdown.$(ARCH).o \ 98 $(SRC)/SkyListForStars.$(ARCH).o \ 99 $(SRC)/SkyRegionUtils.$(ARCH).o \ 100 $(SRC)/addstar_client.$(ARCH).o \ 101 $(SRC)/args_parallel_client.$(ARCH).o \ 102 $(SRC)/resort_catalog.$(ARCH).o \ 103 $(SRC)/resort_threaded.$(ARCH).o \ 104 $(SRC)/resort_unthreaded.$(ARCH).o \ 105 $(SRC)/resort_unthreaded_catalogs.$(ARCH).o 91 106 92 107 ADDSTARD = \ … … 168 183 $(SRC)/psps_ids.$(ARCH).o 169 184 185 # this is the client for server / client addstar operations 170 186 ADDSTARC = \ 171 187 $(SRC)/addstarc.$(ARCH).o \ -
branches/eam_branches/ipp-20120405/Ohana/src/addstar/include/addstar.h
r33653 r33896 59 59 typedef struct sockaddr_in SockAddress; 60 60 61 enum { M_IMAGE, M_REFLIST, M_REFCAT, M_FAKEIMAGE, M_RESORT};61 enum {ADDSTAR_MODE_NONE, ADDSTAR_MODE_IMAGE, ADDSTAR_MODE_REFLIST, ADDSTAR_MODE_REFCAT, ADDSTAR_MODE_FAKEIMAGE, ADDSTAR_MODE_RESORT}; 62 62 enum {NONE, SIMPLE_CMP, SIMPLE_CMF, SIMPLE_MEF, MOSAIC_CMP, MOSAIC_CMF, MOSAIC_MEF, MOSAIC_PHU, SDSS_OBJ}; 63 63 /* note: MEF implies CMF */ … … 132 132 int OLD_RESORT; 133 133 134 int PARALLEL; 135 int PARALLEL_MANUAL; 136 int PARALLEL_SERIAL; 137 int HOST_ID; 138 char *HOSTDIR; 139 134 140 // carries the mosaic into gstars 135 141 … … 216 222 int replace_match PROTO((Average *average, Measure *measure, Stars *star)); 217 223 int resort_threaded PROTO((AddstarClientOptions *options, SkyTable *sky)); 218 int resort_unthreaded PROTO((AddstarClientOptions *options, SkyTable *sky)); 224 int resort_unthreaded PROTO((AddstarClientOptions *options, SkyTable *sky, int hostID, char *hostpath)); 225 int resort_unthreaded_catalogs PROTO((AddstarClientOptions *options, SkyList *skylist, int hostID, char *hostpath)); 219 226 void resort_catalog PROTO((Catalog *catalog)); 220 227 void resort_catalog_old PROTO((Catalog *catalog)); -
branches/eam_branches/ipp-20120405/Ohana/src/addstar/src/addstar.c
r29938 r33896 34 34 SkyTableSetFilenames (sky, CATDIR, "cpt"); 35 35 36 if (options.mode == M_RESORT) {36 if (options.mode == ADDSTAR_MODE_RESORT) { 37 37 if (NTHREADS == 0) { 38 resort_unthreaded (&options, sky );38 resort_unthreaded (&options, sky, 0, NULL); 39 39 } else { 40 40 resort_threaded (&options, sky); … … 47 47 /*** load in the new data (images, stars) ***/ 48 48 switch (options.mode) { 49 case M_IMAGE:49 case ADDSTAR_MODE_IMAGE: 50 50 stars = LoadStars (argv[1], &Nstars, &images, &Nimages, &options); 51 51 … … 62 62 ImageOptions (&options, images, Nimages); 63 63 break; 64 case M_REFLIST:64 case ADDSTAR_MODE_REFLIST: 65 65 stars = grefstars (argv[1], options.photcode, &Nstars); 66 66 skylist = SkyListForStars (sky, -1, stars, Nstars); 67 67 break; 68 case M_RESORT:69 case M_REFCAT:68 case ADDSTAR_MODE_RESORT: 69 case ADDSTAR_MODE_REFCAT: 70 70 skylist = SkyListByPatch (sky, -1, &UserPatch); 71 71 break; 72 case M_FAKEIMAGE:72 case ADDSTAR_MODE_FAKEIMAGE: 73 73 images = fakeimage (argv[1], &Nimages, options.photcode); 74 74 ALLOCATE (skylist, SkyList, 1); … … 137 137 138 138 switch (options.mode) { 139 case M_IMAGE:139 case ADDSTAR_MODE_IMAGE: 140 140 Nsubset = Nstars; 141 141 if (options.closest) { … … 145 145 } 146 146 break; 147 case M_REFCAT:147 case ADDSTAR_MODE_REFCAT: 148 148 stars = greference (argv[1], skylist[0].regions[i], options.photcode, &Nstars); 149 case M_REFLIST:149 case ADDSTAR_MODE_REFLIST: 150 150 subset = find_subset (skylist[0].regions[i], stars, Nstars, &Nsubset); 151 151 if (options.closest) { … … 156 156 if (Nsubset) free (subset); 157 157 break; 158 case M_RESORT:158 case ADDSTAR_MODE_RESORT: 159 159 if (options.nosort == 3) catalog.sorted = FALSE; 160 160 … … 192 192 dvo_catalog_free (&catalog); 193 193 194 if (options.mode == M_REFCAT) free (stars);194 if (options.mode == ADDSTAR_MODE_REFCAT) free (stars); 195 195 } 196 196 … … 216 216 217 217 /* add the new images and save */ 218 if (options.mode == M_IMAGE) {218 if (options.mode == ADDSTAR_MODE_IMAGE) { 219 219 dvo_image_addrows (&db, images, Nimages); 220 220 SetProtect (TRUE); -
branches/eam_branches/ipp-20120405/Ohana/src/addstar/src/addstarc.c
r21153 r33896 20 20 /* send new data to server */ 21 21 switch (options.mode) { 22 case M_IMAGE:22 case ADDSTAR_MODE_IMAGE: 23 23 /* load data */ 24 24 stars = LoadStars (argv[1], &Nstars, &images, &Nimages, &options); … … 40 40 break; 41 41 42 case M_REFLIST:42 case ADDSTAR_MODE_REFLIST: 43 43 /* load data */ 44 44 stars = grefstars (argv[1], options.photcode, &Nstars); … … 50 50 break; 51 51 52 case M_REFCAT:52 case ADDSTAR_MODE_REFCAT: 53 53 /* send data to server */ 54 54 SendCommand (BindSocket, 5, "REFCT"); -
branches/eam_branches/ipp-20120405/Ohana/src/addstar/src/addstart.c
r25757 r33896 31 31 32 32 switch (dataset[0].options[0].mode) { 33 case M_IMAGE:33 case ADDSTAR_MODE_IMAGE: 34 34 UpdateDatabase_Image (dataset[0].options, dataset[0].images, dataset[0].Nimages, dataset[0].mosaic, dataset[0].stars, dataset[0].Nstars); 35 35 continue; 36 36 37 case M_REFLIST:37 case ADDSTAR_MODE_REFLIST: 38 38 UpdateDatabase_Reflist (dataset[0].options, dataset[0].stars, dataset[0].Nstars); 39 39 continue; 40 40 41 case M_REFCAT:41 case ADDSTAR_MODE_REFCAT: 42 42 UpdateDatabase_Refcat (dataset[0].options, dataset[0].patch, dataset[0].refcat); 43 43 continue; -
branches/eam_branches/ipp-20120405/Ohana/src/addstar/src/args.c
r31669 r33896 21 21 22 22 /* basic mode: image, list, refcat */ 23 options.mode = M_IMAGE;23 options.mode = ADDSTAR_MODE_IMAGE; 24 24 if ((N = get_argument (argc, argv, "-ref"))) { 25 options.mode = M_REFLIST;25 options.mode = ADDSTAR_MODE_REFLIST; 26 26 remove_argument (N, &argc, argv); 27 27 } 28 28 if ((N = get_argument (argc, argv, "-cat"))) { 29 options.mode = M_REFCAT;29 options.mode = ADDSTAR_MODE_REFCAT; 30 30 remove_argument (N, &argc, argv); 31 31 } 32 32 if ((N = get_argument (argc, argv, "-resort"))) { 33 options.mode = M_RESORT;33 options.mode = ADDSTAR_MODE_RESORT; 34 34 remove_argument (N, &argc, argv); 35 35 } 36 36 37 37 if ((N = get_argument (argc, argv, "-fakeimage"))) { 38 options.mode = M_FAKEIMAGE;38 options.mode = ADDSTAR_MODE_FAKEIMAGE; 39 39 remove_argument (N, &argc, argv); 40 40 FAKE_RA = atof (argv[N]); … … 98 98 remove_argument (N, &argc, argv); 99 99 } else { 100 if (options.mode == M_IMAGE) goto allow;101 if (options.mode == M_FAKEIMAGE) goto allow;102 if (options.mode == M_REFLIST) goto allow;103 if (options.mode == M_REFCAT) {100 if (options.mode == ADDSTAR_MODE_IMAGE) goto allow; 101 if (options.mode == ADDSTAR_MODE_FAKEIMAGE) goto allow; 102 if (options.mode == ADDSTAR_MODE_REFLIST) goto allow; 103 if (options.mode == ADDSTAR_MODE_REFCAT) { 104 104 fprintf (stderr, "you have requested uploading from a catalog to the entire sky in one pass\n"); 105 105 } 106 if (options.mode == M_RESORT) {106 if (options.mode == ADDSTAR_MODE_RESORT) { 107 107 fprintf (stderr, "you have requested resorting the entire sky in one pass\n"); 108 108 } … … 330 330 } 331 331 332 if ((options.mode == M_RESORT) && (argc == 1)) return (options); 332 // XXX for the moment, make this selection manual. it needs to be automatic 333 // based on the state of the SkyTable 334 PARALLEL = FALSE; 335 if ((N = get_argument (argc, argv, "-parallel"))) { 336 PARALLEL = TRUE; 337 remove_argument (N, &argc, argv); 338 } 339 // this is a test mode : rather than launching the remote jobs and waiting for completion, 340 // relphot will simply list the remote command and wait for the user to signal completion 341 PARALLEL_MANUAL = FALSE; 342 if ((N = get_argument (argc, argv, "-parallel-manual"))) { 343 PARALLEL = TRUE; // -parallel-manual implies -parallel 344 PARALLEL_MANUAL = TRUE; 345 remove_argument (N, &argc, argv); 346 } 347 // this is a test mode : rather than launching the relphot_client jobs remotely, they are 348 // run in serial via 'system' 349 PARALLEL_SERIAL = FALSE; 350 if ((N = get_argument (argc, argv, "-parallel-serial"))) { 351 if (PARALLEL_MANUAL) { 352 fprintf (stderr, "ERROR: cannot mix -parallel-manual and -parallel-serial\n"); 353 exit (1); 354 } 355 PARALLEL = TRUE; // -parallel-serial implies -parallel 356 PARALLEL_SERIAL = TRUE; 357 remove_argument (N, &argc, argv); 358 } 359 if (PARALLEL) { 360 if (options.mode != ADDSTAR_MODE_RESORT) { 361 fprintf (stderr, "parallel mode is only valid for -resort mode\n"); 362 exit (2); 363 } 364 } 365 366 if ((options.mode == ADDSTAR_MODE_RESORT) && (argc == 1)) return (options); 333 367 if (argc == 2) return (options); 334 368 335 if ((options.mode == M_REFLIST) && (options.photcode == 0)) {369 if ((options.mode == ADDSTAR_MODE_REFLIST) && (options.photcode == 0)) { 336 370 fprintf (stderr, "photcode must be specified for -ref\n"); 337 371 exit (2); -
branches/eam_branches/ipp-20120405/Ohana/src/addstar/src/args_client.c
r18374 r33896 18 18 19 19 /* basic mode: image, list, refcat */ 20 options.mode = M_IMAGE;20 options.mode = ADDSTAR_MODE_IMAGE; 21 21 if ((N = get_argument (argc, argv, "-ref"))) { 22 options.mode = M_REFLIST;22 options.mode = ADDSTAR_MODE_REFLIST; 23 23 remove_argument (N, &argc, argv); 24 24 } 25 25 if ((N = get_argument (argc, argv, "-cat"))) { 26 options.mode = M_REFCAT;26 options.mode = ADDSTAR_MODE_REFCAT; 27 27 remove_argument (N, &argc, argv); 28 28 } -
branches/eam_branches/ipp-20120405/Ohana/src/addstar/src/args_load2mass.c
r24977 r33896 18 18 19 19 /* basic mode: image, list, refcat */ 20 options.mode = M_REFCAT;20 options.mode = ADDSTAR_MODE_REFCAT; 21 21 22 22 /*** provide additional data ***/ -
branches/eam_branches/ipp-20120405/Ohana/src/addstar/src/args_loadsupercos.c
r33653 r33896 18 18 19 19 /* basic mode: image, list, refcat */ 20 options.mode = M_REFCAT;20 options.mode = ADDSTAR_MODE_REFCAT; 21 21 22 22 /* we do not allow a subset to be extracted -- all or nothing, babe */ -
branches/eam_branches/ipp-20120405/Ohana/src/addstar/src/args_loadwise.c
r33824 r33896 19 19 20 20 /* basic mode: image, list, refcat */ 21 options.mode = M_REFCAT;21 options.mode = ADDSTAR_MODE_REFCAT; 22 22 23 23 /* we do not allow a subset to be extracted -- all or nothing, babe */ -
branches/eam_branches/ipp-20120405/Ohana/src/addstar/src/args_sedstar.c
r18374 r33896 18 18 19 19 /* basic mode: image, list, refcat */ 20 options.mode = M_REFCAT;20 options.mode = ADDSTAR_MODE_REFCAT; 21 21 22 22 /*** provide additional data ***/ -
branches/eam_branches/ipp-20120405/Ohana/src/addstar/src/resort_unthreaded.c
r33895 r33896 1 1 # include "addstar.h" 2 2 3 /* upgrade to parallel mode: 4 5 setup up skylist and call resort_unthreaded_catalogs () 6 7 resort_unthreaded_catalogs has a parallel and serial version, etc. 8 9 */ 10 11 int resort_unthreaded (AddstarClientOptions *options, SkyTable *sky) { 12 13 off_t i; 14 off_t Naverage, Nmeasure; 15 Catalog catalog; 3 int resort_unthreaded (AddstarClientOptions *options, SkyTable *sky, int hostID, char *hostpath) { 16 4 17 5 double dtime; … … 52 40 } 53 41 54 resort_unthreaded_catalogs ( )42 resort_unthreaded_catalogs (options, 0, NULL) 55 43 56 44 gettimeofday (&stop, NULL); -
branches/eam_branches/ipp-20120405/Ohana/src/addstar/src/resort_unthreaded_catalogs.c
r33895 r33896 1 1 # include "addstar.h" 2 2 3 int resort_unthreaded_catalogs (int hostID, char *hostpath) { 3 // pass in options and skylist? 4 int resort_unthreaded_catalogs (AddstarClientOptions *options, SkyList *skylist, int hostID, char *hostpath) { 5 6 off_t i; 7 off_t Naverage, Nmeasure; 8 Catalog catalog; 4 9 5 10 if (PARALLEL && !hostID) { 6 resort_unthreaded_parallel ( );11 resort_unthreaded_parallel (options, skylist); 7 12 return TRUE; 8 13 } … … 15 20 if (!HostTableTestHost(skylist[0].regions[i], hostID)) continue; 16 21 17 // XXX BLOCK here for an empty thread 18 19 // set the parameters which guide catalog open/load/create 20 catalog.filename = skylist[0].filename[i]; 21 22 // chose the catalog file (local or remote?) 22 23 char hostfile[1024]; 23 24 snprintf (hostfile, 1024, "%s/%s.cpt", hostpath, skylist[0].regions[i]->name); 24 25 catalog.filename = hostID ? hostfile : skylist[0].filename[i]; 25 26 27 // set the parameters which guide catalog open/load/create 26 28 catalog.catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data 27 29 catalog.catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data … … 45 47 if (options->nosort == 3) catalog.sorted = FALSE; 46 48 47 // XXX send these to a free thread48 49 49 if (OLD_RESORT) { 50 50 resort_catalog_old (&catalog); … … 53 53 } 54 54 55 // XXX wait for completed threads 56 57 /* report total updated values */ 55 // report total updated values 58 56 Naverage += catalog.Naverage; 59 57 Nmeasure += catalog.Nmeasure; … … 66 64 dvo_catalog_free (&catalog); 67 65 } 66 return TRUE; 68 67 } 69 68 70 69 // CATDIR is supplied globally 71 70 # define DEBUG 1 72 int resort_unthreaded_parallel (SkyList *sky) { 73 74 // launch the setphot_client jobs to the parallel hosts 71 int resort_unthreaded_parallel (AddstarClientOptions *options, SkyList *sky) { 75 72 76 73 // load the list of hosts … … 89 86 table->hosts[i].pathname = tmppath; 90 87 91 // options / arguments that can affect relphot_client -update-objects:92 // VERBOSE, VERBOSE293 // KEEP_UBERCAL94 // RESET (-reset)95 // TimeSelect -time96 // DophotSelect97 // (note that psfQual is applied rigidly at 0.85, as is the galaxy test)98 // MAG_LIM99 // SIGMA_LIM100 // ImagSelect, ImagMin, ImagMax101 // MaxDensityUse, MaxDensityValue102 103 88 char command[1024]; 104 snprintf (command, 1024, "relphot_client -update-objects -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s -D CAMERA %s -D STAR_TOOFEW %d -minerror %f", 105 table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE, CAMERA, STAR_TOOFEW, MIN_ERROR); 89 snprintf (command, 1024, "addstar_client -resort -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f", 90 table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, 91 UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax); 106 92 107 93 char tmpline[1024]; 108 94 if (VERBOSE) { snprintf (tmpline, 1024, "%s -v", command); strcpy (command, tmpline); } 109 95 if (VERBOSE2) { snprintf (tmpline, 1024, "%s -vv", command); strcpy (command, tmpline); } 110 if (RESET) { snprintf (tmpline, 1024, "%s -reset", command); strcpy (command, tmpline); }111 if (UPDATE) { snprintf (tmpline, 1024, "%s -update", command); strcpy (command, tmpline); }112 if (!KEEP_UBERCAL) { snprintf (tmpline, 1024, "%s -reset-ubercal", command); strcpy (command, tmpline); }113 96 114 97 fprintf (stderr, "command: %s\n", command); … … 119 102 int status = system (command); 120 103 if (status) { 121 fprintf (stderr, "ERROR running relphot_client\n");104 fprintf (stderr, "ERROR running addstar_client\n"); 122 105 exit (2); 123 106 } … … 135 118 136 119 if (PARALLEL_MANUAL) { 137 fprintf (stderr, "run the relphot_client commands above. when these are done, hit return\n");120 fprintf (stderr, "run the addstar_client commands above. when these are done, hit return\n"); 138 121 getchar(); 139 122 }
Note:
See TracChangeset
for help on using the changeset viewer.
