Index: /branches/eam_branches/ipp-20140610/Ohana/src/relphot/Makefile
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/relphot/Makefile	(revision 36997)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/relphot/Makefile	(revision 36998)
@@ -88,4 +88,5 @@
 $(SRC)/liststats.$(ARCH).o	 \
 $(SRC)/initialize.$(ARCH).o	 \
+$(SRC)/syncfile.$(ARCH).o	 \
 $(SRC)/load_catalogs.$(ARCH).o	 \
 $(SRC)/reload_catalogs.$(ARCH).o \
Index: /branches/eam_branches/ipp-20140610/Ohana/src/relphot/include/relphot.h
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/relphot/include/relphot.h	(revision 36997)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/relphot/include/relphot.h	(revision 36998)
@@ -351,6 +351,6 @@
 void          liststats_setmode   PROTO((StatType *stats, char *strmode));
 int           liststats           PROTO((double *value, double *dvalue, double *wvalue, int N, StatType *stats));
-Catalog      *load_catalogs       PROTO((SkyList *skylist, int *Ncatalog, int hostID, char *hostpath));
-Catalog      *load_catalogs_parallel PROTO((SkyList *sky, int *Ncatalog));
+Catalog      *load_catalogs       PROTO((SkyList *skylist, int *Ncatalog, int hostID, char *hostpath, char *syncfile));
+Catalog      *load_catalogs_parallel PROTO((SkyList *sky, int *Ncatalog, char *syncfile));
 
 SkyList      *load_images         PROTO((FITS_DB *db, char *regionName, SkyRegion *region));
Index: /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/load_catalogs.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/load_catalogs.c	(revision 36997)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/load_catalogs.c	(revision 36998)
@@ -12,5 +12,5 @@
 // if this function is called with a specified hostID, then only the fraction of the
 // database hosted by that hostID is loaded
-Catalog *load_catalogs (SkyList *skylist, int *Ncatalog, int hostID, char *hostpath) {
+Catalog *load_catalogs (SkyList *skylist, int *Ncatalog, int hostID, char *hostpath, char *syncfile) {
 
   off_t i, Nmeas, Nstar, Nmeas_total, Nstar_total;
@@ -19,5 +19,5 @@
   // XXX need to decide how to determine PARALLEL mode...
   if (PARALLEL && !hostID) {
-    catalog = load_catalogs_parallel (skylist, Ncatalog);
+    catalog = load_catalogs_parallel (skylist, Ncatalog, syncfile);
     return catalog;
   }
@@ -92,4 +92,10 @@
   // in regular relphot, we shutdown here; in relphot_client, we generate and return an empty table (for consistency)
 
+  // if we are running with parallel_images but not a parallel database, we need to
+  // release the lock so the next image host can proceed
+  if (!hostID && syncfile) {
+    update_sync_file (syncfile, 1);
+  }
+
   // XXX consider only returning the populated catalogs
   *Ncatalog = skylist[0].Nregions;
@@ -105,5 +111,5 @@
 // CATDIR is supplied globally
 # define DEBUG 1
-Catalog *load_catalogs_parallel (SkyList *sky, int *Ncatalog) {
+Catalog *load_catalogs_parallel (SkyList *sky, int *Ncatalog, char *syncfile) {
 
   char uniquer[12];
@@ -206,4 +212,17 @@
   }
 
+  // update syncfile here (save lots of I/O time):
+
+  // at this point, the remote relastro_client jobs are done loading their data.  in a
+  // parallel_images mode, the next image host can be launched while this image host now
+  // reads that
+
+  // NOTE: if I let all hosts load blindly, I saturate the data clients with too many
+  // relphot_client requests.  I need to have the master mediate this.  the master
+  // will not launch the next remote job until this one says it is done
+  if (syncfile) {
+    update_sync_file (syncfile, 1);
+  }
+
   // each host generates a BrightCatalog structure, with the measure, average, etc value
   // loaded into a single set of arrays (of MeasureTiny, AverageTiny, Secfilt).  I need to
Index: /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/relphot_client.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/relphot_client.c	(revision 36997)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/relphot_client.c	(revision 36998)
@@ -39,5 +39,5 @@
     case MODE_LOAD: {
       int Ncatalog;
-      Catalog *catalog = load_catalogs (skylist, &Ncatalog, HOST_ID, HOSTDIR);
+      Catalog *catalog = load_catalogs (skylist, &Ncatalog, HOST_ID, HOSTDIR, NULL);
       if (!catalog) {
 	  fprintf (stderr, "ERROR loading catalogs from %s\n", CATDIR);
Index: /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/relphot_images.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/relphot_images.c	(revision 36997)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/relphot_images.c	(revision 36998)
@@ -52,5 +52,5 @@
   if (NLOOP > 0) {
     /* load catalog data from region files (hostID is 0 since we are not a client */
-    catalog = load_catalogs (skylist, &Ncatalog, 0, NULL);
+    catalog = load_catalogs (skylist, &Ncatalog, 0, NULL, NULL);
     MARKTIME("-- load catalog data: %f sec\n", dtime);
   
Index: /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/relphot_parallel_images.c
===================================================================
--- /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/relphot_parallel_images.c	(revision 36997)
+++ /branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/relphot_parallel_images.c	(revision 36998)
@@ -55,14 +55,11 @@
 
   /* load catalog data from region files (hostID is 0 since we are not a client */
-  catalog = load_catalogs (skylist, &Ncatalog, 0, NULL);
+  char *syncfile = make_filename (CATDIR, regionHosts->hosts[myHost].hostname, REGION_HOST_ID, "loadcat.sync");
+  catalog = load_catalogs (skylist, &Ncatalog, 0, NULL, syncfile);
   MARKTIME("-- load catalog data: %f sec\n", dtime);
+  free (syncfile);
+
   client_logger_message ("loaded catalog data\n");
 
-  // NOTE: if I let all hosts load blindly, I saturate the data clients with too many
-  // relphot_client requests.  I need to have the master mediate this.  the master
-  // will not launch the next remote job until this one says it is done
-  char *syncfile = make_filename (CATDIR, regionHosts->hosts[myHost].hostname, REGION_HOST_ID, "loadcat.sync");
-  update_sync_file (syncfile, 1);
-  
   // generate tables go from catID,objID -> catSeq,objSeq
   indexCatalogs (catalog, Ncatalog);
