Changeset 37116 for trunk/Ohana/src/addstar
- Timestamp:
- Jul 24, 2014, 5:10:56 PM (12 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 1 deleted
- 13 edited
- 1 copied
-
. (modified) (1 prop)
-
src/addstar/Makefile (modified) (2 diffs)
-
src/addstar/include/addstar.h (modified) (3 diffs)
-
src/addstar/src/BoundaryTreeIO.c (modified) (1 diff)
-
src/addstar/src/addstar.c (modified) (3 diffs)
-
src/addstar/src/addstar_client.c (modified) (1 diff)
-
src/addstar/src/args.c (modified) (3 diffs)
-
src/addstar/src/args_parallel_client.c (modified) (2 diffs)
-
src/addstar/src/build_links.c (modified) (6 diffs)
-
src/addstar/src/findskycell.c (modified) (6 diffs)
-
src/addstar/src/resort_catalog.c (modified) (2 diffs)
-
src/addstar/src/resort_catalogs.c (copied) (copied from branches/eam_branches/ipp-20140717/Ohana/src/addstar/src/resort_catalogs.c )
-
src/addstar/src/resort_threaded.c (modified) (8 diffs)
-
src/addstar/src/resort_unthreaded.c (modified) (1 diff)
-
src/addstar/src/resort_unthreaded_catalogs.c (deleted)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
- Property svn:mergeinfo set to
-
trunk/Ohana/src/addstar/Makefile
r35263 r37116 78 78 $(SRC)/parse_time.$(ARCH).o \ 79 79 $(SRC)/replace_match.$(ARCH).o \ 80 $(SRC)/resort_catalog .$(ARCH).o \80 $(SRC)/resort_catalogs.$(ARCH).o \ 81 81 $(SRC)/resort_threaded.$(ARCH).o \ 82 82 $(SRC)/resort_unthreaded.$(ARCH).o \ 83 $(SRC)/resort_ unthreaded_catalogs.$(ARCH).o \83 $(SRC)/resort_catalog.$(ARCH).o \ 84 84 $(SRC)/StarOps.$(ARCH).o \ 85 85 $(SRC)/ReadStarsFITS.$(ARCH).o \ … … 105 105 $(SRC)/addstar_client.$(ARCH).o \ 106 106 $(SRC)/args_parallel_client.$(ARCH).o \ 107 $(SRC)/resort_catalog .$(ARCH).o \107 $(SRC)/resort_catalogs.$(ARCH).o \ 108 108 $(SRC)/resort_threaded.$(ARCH).o \ 109 109 $(SRC)/resort_unthreaded.$(ARCH).o \ 110 $(SRC)/resort_ unthreaded_catalogs.$(ARCH).o110 $(SRC)/resort_catalog.$(ARCH).o 111 111 112 112 ADDSTARD = \ -
trunk/Ohana/src/addstar/include/addstar.h
r37036 r37116 237 237 Stars *rd_gsc PROTO((char *filename, unsigned int *nstars)); 238 238 int replace_match PROTO((Average *average, Measure *measure, Stars *star)); 239 int resort_threaded PROTO((AddstarClientOptions *options, SkyTable *sky)); 240 int resort_unthreaded PROTO((AddstarClientOptions *options, SkyTable *sky, int hostID, char *hostpath)); 241 int resort_unthreaded_catalogs PROTO((AddstarClientOptions *options, SkyList *skylist, int hostID, char *hostpath)); 239 int resort_catalogs PROTO((AddstarClientOptions *options, SkyTable *sky)); 240 int resort_catalogs_parallel PROTO((AddstarClientOptions *options, SkyList *sky)); 241 int resort_threaded PROTO((SkyList *skylist, int ForceSort)); 242 int resort_unthreaded PROTO((SkyList *skylist, int ForceSort)); 242 243 void resort_catalog PROTO((Catalog *catalog)); 243 244 void resort_catalog_old PROTO((Catalog *catalog)); 245 244 246 Stars *ReadStarsFITS PROTO((FILE *f, Header *header, Header *in_theader, unsigned int *nstars)); 245 247 Stars *ReadStarsTEXT PROTO((FILE *f, unsigned int *nstars)); … … 253 255 off_t *init_lensing_links PROTO((Average *average, off_t Naverage, Lensing *lensing, off_t Nlensing)); 254 256 off_t *init_missing_links PROTO((Average *average, off_t Naverage, Missing *missing, off_t Nmissing)); 255 off_t add_meas_link PROTO((Average *average, off_t *next_meas, off_t Nmeasure, off_t NMEASURE));256 off_t add_miss_link PROTO((Average *average, off_t *next_miss, off_t Nmissing));257 off_tadd_lens_link PROTO((Average *average, off_t *next_lens, off_t Nlensing, off_t NLENSING));257 int add_meas_link PROTO((Average *average, off_t *next_meas, off_t Nmeasure, off_t NMEASURE)); 258 int add_miss_link PROTO((Average *average, off_t *next_miss, off_t Nmissing)); 259 int add_lens_link PROTO((Average *average, off_t *next_lens, off_t Nlensing, off_t NLENSING)); 258 260 off_t *build_measure_links PROTO((Average *average, off_t Naverage, Measure *measure, off_t Nmeasure)); 259 261 off_t *build_lensing_links PROTO((Average *average, off_t Naverage, Lensing *lensing, off_t Nlensing)); … … 316 318 void *memrchr(const void *s, int c, size_t n); 317 319 int addstar_create_ID (); 320 int strextend (char *input, char *format,...); 318 321 319 322 /** -
trunk/Ohana/src/addstar/src/BoundaryTreeIO.c
r34260 r37116 1 1 # include "addstar.h" 2 3 /** this file is deprecated (functions moved to libdvo) ***/ 2 4 3 5 # define GET_COLUMN_NEW(OUT,NAME,TYPE) \ -
trunk/Ohana/src/addstar/src/addstar.c
r37036 r37116 40 40 41 41 if (options.mode == ADDSTAR_MODE_RESORT) { 42 if (NTHREADS == 0) { 43 resort_unthreaded (&options, sky, 0, NULL); 44 } else { 45 resort_threaded (&options, sky); 46 } 42 resort_catalogs (&options, sky); 47 43 exit (0); 48 44 } … … 71 67 skylist = SkyListForStars (sky, -1, stars, Nstars); 72 68 break; 73 case ADDSTAR_MODE_RESORT:74 69 case ADDSTAR_MODE_REFCAT: 75 70 skylist = SkyListByPatch (sky, -1, &UserPatch); … … 161 156 if (Nsubset) free (subset); 162 157 break; 163 case ADDSTAR_MODE_RESORT:164 if (options.nosort == 3) catalog.sorted = FALSE;165 166 // no need to resort empty catalogs167 if (catalog.Naves_disk == 0) {168 dvo_catalog_unlock (&catalog);169 dvo_catalog_free (&catalog);170 continue;171 }172 173 if (OLD_RESORT) {174 resort_catalog_old (&catalog);175 } else {176 resort_catalog (&catalog);177 }178 Nsubset = 1;179 break;180 158 } 181 159 /* report total updated values */ -
trunk/Ohana/src/addstar/src/addstar_client.c
r33963 r37116 25 25 26 26 if (options.mode == ADDSTAR_MODE_RESORT) { 27 resort_ unthreaded (&options, sky, HOST_ID, HOSTDIR);27 resort_catalogs (&options, sky); 28 28 exit (0); 29 29 } -
trunk/Ohana/src/addstar/src/args.c
r35760 r37116 34 34 remove_argument (N, &argc, argv); 35 35 } 36 OLD_RESORT = FALSE; 37 if ((N = get_argument (argc, argv, "-old-resort"))) { 38 remove_argument (N, &argc, argv); 39 OLD_RESORT = TRUE; 40 } 41 36 42 if ((N = get_argument (argc, argv, "-create-id"))) { 37 43 options.mode = ADDSTAR_MODE_CREATE_ID; … … 350 356 // XXX for the moment, make this selection manual. it needs to be automatic 351 357 // based on the state of the SkyTable 358 HOST_ID = 0; 359 HOSTDIR = NULL; 352 360 PARALLEL = FALSE; 353 361 if ((N = get_argument (argc, argv, "-parallel"))) { … … 466 474 } 467 475 476 int strextend (char *input, char *format,...) { 477 478 char tmpextra[1024], tmpline[1024]; 479 va_list argp; 480 481 va_start (argp, format); 482 vsnprintf (tmpextra, 1024, format, argp); 483 snprintf (tmpline, 1024, "%s %s", input, tmpextra); 484 strcpy (input, tmpline); 485 486 return TRUE; 487 } 488 468 489 /** addstar modes: 469 490 -
trunk/Ohana/src/addstar/src/args_parallel_client.c
r33963 r37116 87 87 } 88 88 89 OLD_RESORT = FALSE; 90 if ((N = get_argument (argc, argv, "-old-resort"))) { 91 remove_argument (N, &argc, argv); 92 OLD_RESORT = TRUE; 93 } 94 89 95 /* extra error messages */ 90 96 VERBOSE = FALSE; … … 118 124 exit (2); 119 125 } 126 127 int strextend (char *input, char *format,...) { 128 129 char tmpextra[1024], tmpline[1024]; 130 va_list argp; 131 132 va_start (argp, format); 133 vsnprintf (tmpextra, 1024, format, argp); 134 snprintf (tmpline, 1024, "%s %s", input, tmpextra); 135 strcpy (input, tmpline); 136 137 return TRUE; 138 } 139 -
trunk/Ohana/src/addstar/src/build_links.c
r37036 r37116 102 102 103 103 /* average[].measureOffset, average[].Nmeasure are valid within an addstar run */ 104 off_t add_meas_link (Average *average, off_t *next_meas, off_t Nmeasure, off_t NMEASURE) {104 int add_meas_link (Average *average, off_t *next_meas, off_t Nmeasure, off_t NMEASURE) { 105 105 106 106 off_t k, m; … … 133 133 return (TRUE); 134 134 } 135 136 /* Missing does not carry enough information to reconstruct the links137 we must always save the missing table, if it exists */138 135 139 136 Measure *sort_measure (Average *average, off_t Naverage, Measure *measure, off_t Nmeasure, off_t *next_meas) { … … 160 157 } 161 158 159 /*******************************************************************************************/ 160 162 161 /* build the initial links assuming the table is sorted */ 163 162 off_t *init_missing_links (Average *average, off_t Naverage, Missing *missing, off_t Nmissing) { … … 186 185 } 187 186 188 off_t add_miss_link (Average *average, off_t *next_miss, off_t Nmissing) {187 int add_miss_link (Average *average, off_t *next_miss, off_t Nmissing) { 189 188 190 189 off_t k, m; … … 205 204 } 206 205 206 /* Missing does not carry enough information to reconstruct the links 207 we must always save the missing table, if it exists */ 208 207 209 Missing *sort_missing (Average *average, off_t Naverage, Missing *missing, off_t Nmissing, off_t *next_miss) { 208 210 … … 307 309 308 310 /* average[].lensingOffset, average[].Nlensing are valid within an addstar run */ 309 off_t add_lens_link (Average *average, off_t *next_lens, off_t Nlensing, off_t NLENSING) {311 int add_lens_link (Average *average, off_t *next_lens, off_t Nlensing, off_t NLENSING) { 310 312 311 313 off_t k, m; -
trunk/Ohana/src/addstar/src/findskycell.c
r37036 r37116 27 27 int apply_tree (char *treefile, char *datafile); 28 28 29 float SCALE = 1.0;30 int NX_SUB = 1;31 int NY_SUB = 1;29 float SCALE = 1.0; 30 float NX_SUB = 1.0; 31 float NY_SUB = 1.0; 32 32 33 33 double R_MIN = 0.0; … … 217 217 ALLOCATE (tree.Xo, double *, tree.Nzone); 218 218 ALLOCATE (tree.Yo, double *, tree.Nzone); 219 ALLOCATE (tree.dX, int *, tree.Nzone);220 ALLOCATE (tree.dY, int *, tree.Nzone);219 ALLOCATE (tree.dX, float *, tree.Nzone); 220 ALLOCATE (tree.dY, float *, tree.Nzone); 221 221 ALLOCATE (tree.cell, int *, tree.Nzone); 222 222 ALLOCATE (tree.name, char **, tree.Nzone); … … 251 251 ALLOCATE (tree.Xo[zone], double, tree.NBAND[zone]); 252 252 ALLOCATE (tree.Yo[zone], double, tree.NBAND[zone]); 253 ALLOCATE (tree.dX[zone], int, tree.NBAND[zone]);254 ALLOCATE (tree.dY[zone], int, tree.NBAND[zone]);253 ALLOCATE (tree.dX[zone], float, tree.NBAND[zone]); 254 ALLOCATE (tree.dY[zone], float, tree.NBAND[zone]); 255 255 ALLOCATE (tree.cell[zone], int, tree.NBAND[zone]); 256 256 ALLOCATE (tree.name[zone], char *, tree.NBAND[zone]); … … 260 260 tree.Xo[zone][band] = NAN; 261 261 tree.Yo[zone][band] = NAN; 262 tree.dX[zone][band] = -1;263 tree.dY[zone][band] = -1;262 tree.dX[zone][band] = NAN; 263 tree.dY[zone][band] = NAN; 264 264 tree.cell[zone][band] = -1; 265 265 ALLOCATE (tree.name[zone][band], char, BOUNDARY_TREE_NAME_LENGTH); … … 286 286 REALLOCATE (tree.Xo[zone], double, tree.NBAND[zone]); 287 287 REALLOCATE (tree.Yo[zone], double, tree.NBAND[zone]); 288 REALLOCATE (tree.dX[zone], int, tree.NBAND[zone]);289 REALLOCATE (tree.dY[zone], int, tree.NBAND[zone]);288 REALLOCATE (tree.dX[zone], float, tree.NBAND[zone]); 289 REALLOCATE (tree.dY[zone], float, tree.NBAND[zone]); 290 290 REALLOCATE (tree.cell[zone], int, tree.NBAND[zone]); 291 291 REALLOCATE (tree.name[zone], char *, tree.NBAND[zone]); … … 295 295 tree.Xo[zone][band] = NAN; 296 296 tree.Yo[zone][band] = NAN; 297 tree.dX[zone][band] = -1;298 tree.dY[zone][band] = -1;297 tree.dX[zone][band] = NAN; 298 tree.dY[zone][band] = NAN; 299 299 tree.cell[zone][j] = -1; 300 300 ALLOCATE (tree.name[zone][j], char, BOUNDARY_TREE_NAME_LENGTH); -
trunk/Ohana/src/addstar/src/resort_catalog.c
r37036 r37116 7 7 void resort_catalog_old (Catalog *catalog) { 8 8 9 off_t *next_meas ;10 off_t Naves, Nmeas ;9 off_t *next_meas, *next_lens; 10 off_t Naves, Nmeas, Nlens; 11 11 12 12 if (catalog[0].sorted == TRUE) return; … … 16 16 /* internal counters */ 17 17 Nmeas = catalog[0].Nmeasure; 18 Nlens = catalog[0].Nlensing; 18 19 Naves = catalog[0].Naverage; 19 20 20 21 /* set up pointers for linked list of measure, missing */ 21 22 next_meas = build_measure_links (catalog[0].average, Naves, catalog[0].measure, Nmeas); 23 next_lens = build_lensing_links (catalog[0].average, Naves, catalog[0].lensing, Nlens); 22 24 23 25 catalog[0].sorted = TRUE; 24 26 catalog[0].measure = sort_measure (catalog[0].average, Naves, catalog[0].measure, Nmeas, next_meas); 27 catalog[0].lensing = sort_lensing (catalog[0].average, Naves, catalog[0].lensing, Nlens, next_lens); 25 28 26 29 MARKTIME (" match time %9.4f sec for %7lld measures, %6lld average\n", dtime, (long long) Nmeas, (long long) Naves); -
trunk/Ohana/src/addstar/src/resort_threaded.c
r37036 r37116 13 13 int iThread; 14 14 int state; 15 int nosort;15 int forcesort; 16 16 char *filename; 17 17 SkyRegion *region; … … 37 37 } 38 38 39 // chose the catalog file (local or remote?) 40 char hostfile[1024]; 41 snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, threadData->region->name); 42 catalog.filename = HOST_ID ? hostfile : threadData->filename; 43 39 44 // set the parameters which guide catalog open/load/create 40 catalog.filename = threadData->filename;41 45 catalog.catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data 42 46 catalog.catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data … … 64 68 65 69 // this is an overloaded value to mean 'force sort' 66 if (threadData-> nosort == 3) catalog.sorted = FALSE;70 if (threadData->forcesort) catalog.sorted = FALSE; 67 71 68 72 if (OLD_RESORT) { … … 88 92 } 89 93 90 int resort_threaded ( AddstarClientOptions *options, SkyTable *sky) {94 int resort_threaded (SkyList *skylist, int ForceSort) { 91 95 92 96 int j, launched, done, Nwait, Nrun; … … 97 101 ThreadData *threadData; 98 102 pthread_t *threads; 99 100 double dtime;101 struct timeval start, stop;102 gettimeofday (&start, NULL);103 104 SkyList *skylist = SkyListByPatch (sky, -1, &UserPatch);105 106 // in these cases, limit the sky catalogs to an existing subset107 if (options->existing_regions) {108 SkyList *tmp;109 tmp = SkyListExistingSubset (skylist, CATDIR);110 SkyListFree (skylist);111 skylist = tmp;112 }113 if (VERBOSE) fprintf (stderr, "writing to "OFF_T_FMT" regions\n", skylist[0].Nregions);114 115 if (options->only_images) {116 fprintf (stderr, "-image (only images) makes no sense with -resort\n");117 exit (2);118 }119 if (options->only_match) {120 fprintf (stderr, "-only-match makes no sense with -resort\n");121 exit (2);122 }123 if (options->nosort == 1) {124 fprintf (stderr, "-nosort makes no sense with -resort\n");125 exit (2);126 }127 if (options->update) {128 fprintf (stderr, "-update makes no sense with -resort\n");129 exit (2);130 }131 if (options->calibrate) {132 fprintf (stderr, "-cal (calibrate) makes no sense with -resort\n");133 exit (2);134 }135 103 136 104 ALLOCATE(threads, pthread_t, NTHREADS); … … 148 116 Naverage = Nmeasure = 0; 149 117 for (i = 0; i < skylist[0].Nregions; i++) { 118 119 // does this host ID match the desired location for the table? 120 if (!HostTableTestHost(skylist[0].regions[i], HOST_ID)) continue; 150 121 151 122 launched = FALSE; … … 166 137 if (threadData[j].state == TS_FAIL) goto failure; 167 138 if (threadData[j].state != TS_WAIT) continue; 168 threadData[j]. nosort = options->nosort;139 threadData[j].forcesort = ForceSort; 169 140 threadData[j].filename = skylist[0].filename[i]; 170 141 threadData[j].region = skylist[0].regions[i]; … … 203 174 } 204 175 205 gettimeofday (&stop, NULL);206 dtime = DTIME (stop, start);207 fprintf (stderr, "SUCCESS: elapsed time %9.4f sec for, "OFF_T_FMT" average, "OFF_T_FMT" measure\n", dtime, Naverage, Nmeasure);208 209 176 // for (i = 0; i < NTHREADS; i++) { 210 177 // pthread_cancel(threads[i]); -
trunk/Ohana/src/addstar/src/resort_unthreaded.c
r35142 r37116 1 1 # include "addstar.h" 2 2 3 int resort_unthreaded (AddstarClientOptions *options, SkyTable *sky, int hostID, char *hostpath) { 3 // pass in options and skylist? 4 int resort_unthreaded (SkyList *skylist, int ForceSort) { 4 5 5 double dtime; 6 struct timeval start, stop; 6 off_t i; 7 off_t Naverage, Nmeasure; 8 Catalog catalog; 7 9 8 gettimeofday (&start, NULL); 10 /* match stars to existing catalog data (or otherwise manipulate catalog data) */ 11 Naverage = Nmeasure = 0; 12 for (i = 0; i < skylist[0].Nregions; i++) { 9 13 10 SkyList *skylist = SkyListByPatch (sky, -1, &UserPatch); 11 12 // in these cases, limit the sky catalogs to an existing subset 13 if (options->existing_regions) { 14 SkyList *tmp; 15 tmp = SkyListExistingSubset (skylist, CATDIR); 16 SkyListFree (skylist); 17 skylist = tmp; 14 // does this host ID match the desired location for the table? 15 if (!HostTableTestHost(skylist[0].regions[i], HOST_ID)) continue; 16 17 // chose the catalog file (local or remote?) 18 char hostfile[1024]; 19 snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name); 20 catalog.filename = HOST_ID ? hostfile : skylist[0].filename[i]; 21 22 // set the parameters which guide catalog open/load/create 23 catalog.catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data 24 catalog.catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data 25 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_LENSING; 26 catalog.Nsecfilt = GetPhotcodeNsecfilt (); 27 28 // an error exit status here is a significant error (disk I/O or file access) 29 if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "w")) { 30 fprintf (stderr, "ERROR: failure to open/create catalog file %s\n", catalog.filename); 31 exit (2); 32 } 33 34 // Naves_disk == 0 implies an empty catalog file, skip empty catalogs 35 if (catalog.Naves_disk == 0) { 36 dvo_catalog_unlock (&catalog); 37 dvo_catalog_free (&catalog); 38 continue; 39 } 40 41 // this is an overloaded value to mean 'force sort' 42 if (ForceSort) catalog.sorted = FALSE; 43 44 if (OLD_RESORT) { 45 resort_catalog_old (&catalog); 46 } else { 47 resort_catalog (&catalog); 48 } 49 50 // report total updated values 51 Naverage += catalog.Naverage; 52 Nmeasure += catalog.Nmeasure; 53 54 // write out catalog, if appropriate 55 SetProtect (TRUE); 56 dvo_catalog_save (&catalog, VERBOSE); 57 SetProtect (FALSE); 58 dvo_catalog_unlock (&catalog); 59 dvo_catalog_free (&catalog); 18 60 } 19 if (VERBOSE) fprintf (stderr, "writing to "OFF_T_FMT" regions\n", skylist[0].Nregions);20 21 if (options->only_images) {22 fprintf (stderr, "-image (only images) makes no sense with -resort\n");23 exit (2);24 }25 if (options->only_match) {26 fprintf (stderr, "-only-match makes no sense with -resort\n");27 exit (2);28 }29 if (options->nosort == 1) {30 fprintf (stderr, "-nosort makes no sense with -resort\n");31 exit (2);32 }33 if (options->update) {34 fprintf (stderr, "-update makes no sense with -resort\n");35 exit (2);36 }37 if (options->calibrate) {38 fprintf (stderr, "-cal (calibrate) makes no sense with -resort\n");39 exit (2);40 }41 42 resort_unthreaded_catalogs (options, skylist, hostID, hostpath);43 44 gettimeofday (&stop, NULL);45 dtime = DTIME (stop, start);46 fprintf (stderr, "SUCCESS: elapsed time %9.4f sec\n", dtime);47 48 61 return TRUE; 49 62 } 50 63 64
Note:
See TracChangeset
for help on using the changeset viewer.
