IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33895


Ignore:
Timestamp:
May 22, 2012, 5:51:17 AM (14 years ago)
Author:
eugene
Message:

working on parallel resort

Location:
branches/eam_branches/ipp-20120405/Ohana/src/addstar/src
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20120405/Ohana/src/addstar/src/resort_unthreaded.c

    r29938 r33895  
    11# include "addstar.h"
     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 */
    210
    311int resort_unthreaded (AddstarClientOptions *options, SkyTable *sky) {
     
    4452  }
    4553
    46   // XXX ALLOCATE catalog[Nthreads]
    47 
    48   /* match stars to existing catalog data (or otherwise manipulate catalog data) */
    49   Naverage = Nmeasure = 0;
    50   for (i = 0; i < skylist[0].Nregions; i++) {
    51 
    52     // XXX BLOCK here for an empty thread
    53 
    54     // set the parameters which guide catalog open/load/create
    55     catalog.filename  = skylist[0].filename[i];
    56     catalog.catformat = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
    57     catalog.catmode   = dvo_catalog_catmode (CATMODE);      // set the default catmode from config data
    58     catalog.catflags  = LOAD_AVES | LOAD_MEAS;
    59     catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
    60 
    61     // an error exit status here is a significant error (disk I/O or file access)
    62     if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "w")) {
    63       fprintf (stderr, "ERROR: failure to open/create catalog file %s\n", catalog.filename);
    64       exit (2);
    65     }
    66 
    67     // Naves_disk == 0 implies an empty catalog file, skip empty catalogs
    68     if (catalog.Naves_disk == 0) {
    69       dvo_catalog_unlock (&catalog);
    70       dvo_catalog_free (&catalog);
    71       continue;
    72     }
    73 
    74     // this is an overloaded value to mean 'force sort'
    75     if (options->nosort == 3) catalog.sorted = FALSE;
    76 
    77     // XXX send these to a free thread
    78 
    79     if (OLD_RESORT) {
    80       resort_catalog_old (&catalog);
    81     } else {
    82       resort_catalog (&catalog);
    83     }
    84 
    85     // XXX wait for completed threads
    86 
    87     /* report total updated values */
    88     Naverage += catalog.Naverage;
    89     Nmeasure += catalog.Nmeasure;
    90 
    91     // write out catalog, if appropriate
    92     SetProtect (TRUE);
    93     dvo_catalog_save (&catalog, VERBOSE);
    94     SetProtect (FALSE);
    95     dvo_catalog_unlock (&catalog);
    96     dvo_catalog_free (&catalog);
    97   }
     54  resort_unthreaded_catalogs ()
    9855
    9956  gettimeofday (&stop, NULL);
Note: See TracChangeset for help on using the changeset viewer.