Changeset 33563
- Timestamp:
- Mar 16, 2012, 2:14:22 PM (14 years ago)
- Location:
- branches/eam_branches/ipp-20111122/Ohana/src/opihi
- Files:
-
- 8 edited
-
dvo/avextract.c (modified) (4 diffs)
-
dvo/avmatch.c (modified) (4 diffs)
-
dvo/dvo.c.in (modified) (1 diff)
-
dvo/dvo_client.c (modified) (4 diffs)
-
dvo/dvo_host_utils.c (modified) (4 diffs)
-
dvo/gcat.c (modified) (3 diffs)
-
dvo/mextract.c (modified) (5 diffs)
-
include/dvoshell.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo/avextract.c
r33543 r33563 43 43 } 44 44 45 // dump results directly to fits file (esp for parallel dvo)46 char *ResultFile = NULL;47 if ((N = get_argument (argc, argv, "-result"))) {48 remove_argument (N, &argc, argv);49 ResultFile = strcreate(argv[N]);50 remove_argument (N, &argc, argv);51 }52 53 45 dvo_catalog_init (&catalog, TRUE); 54 46 … … 63 55 print_error(); 64 56 goto escape; 65 }66 67 // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results68 if (PARALLEL && !HOST_ID) {69 // not all parallel ops need to set the region selection...70 if (!SetSkyRegions (selection)) goto escape;71 72 int status = HostTableParallelOps (argc, argv, ResultFile, 0);73 return status;74 57 } 75 58 … … 110 93 /* load region corresponding to selection above */ 111 94 if ((skylist = SelectRegions (selection)) == NULL) goto escape; 95 96 // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results 97 if (PARALLEL && !HOST_ID) { 98 int status = HostTableParallelOps (argc, argv, RESULT_FILE, 0); 99 100 dbFreeFields (fields, Nfields); 101 dbFreeStack (stack, Nstack); 102 free (stack); 103 FreeSkyRegionSelection (selection); 104 dvo_catalog_free (&catalog); 105 106 return status; 107 } 112 108 113 109 /* create output storage vectors */ … … 204 200 205 201 // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere) 206 if (R esultFile) {207 int status = WriteVectorTableFITS (R esultFile, "RESULT", vec, Nreturn, FALSE, NULL);202 if (RESULT_FILE) { 203 int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nreturn, FALSE, NULL); 208 204 if (!status) goto escape; 209 205 } -
branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo/avmatch.c
r33543 r33563 48 48 remove_argument (N, &argc, argv); 49 49 PARALLEL = TRUE; 50 }51 52 // dump results directly to fits file (esp for parallel dvo)53 char *ResultFile = NULL;54 if ((N = get_argument (argc, argv, "-result"))) {55 remove_argument (N, &argc, argv);56 ResultFile = strcreate(argv[N]);57 remove_argument (N, &argc, argv);58 50 } 59 51 … … 98 90 99 91 // I need to pass the RA & DEC vectors to the remote clients... 100 int status = HostTableParallelOps (argc, argv, ResultFile, RAvec->Nelements); 101 if (ResultFile) free (ResultFile); 92 int status = HostTableParallelOps (argc, argv, RESULT_FILE, RAvec->Nelements); 102 93 if (vec) free (vec); 103 94 … … 225 216 // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere) 226 217 // only write the fields which were in a valid catalog 227 if (R esultFile) {218 if (RESULT_FILE) { 228 219 // extend the array by one to hold index array 229 220 REALLOCATE (vec, Vector *, Nfields + 1); … … 271 262 vec[i][0].Nelements = Nfound; 272 263 } 273 int status = WriteVectorTableFITS (R esultFile, "RESULT", vec, Nfields + 1, FALSE, NULL);264 int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nfields + 1, FALSE, NULL); 274 265 free (vec[Nfields]->elements.Int); 275 266 free (vec[Nfields]); -
branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo/dvo.c.in
r33308 r33563 48 48 HOST_ID = 0; 49 49 HOSTDIR = NULL; 50 RESULT_FILE = NULL; 50 51 51 52 return; -
branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo/dvo_client.c
r33313 r33563 1 1 # include "dvoshell.h" 2 3 int input PROTO((int, char **)); 2 4 3 5 /* program-dependent initialization */ … … 39 41 remove_argument (N, argc, argv); 40 42 HOSTDIR = strcreate (argv[N]);; 43 remove_argument (N, argc, argv); 44 } 45 46 RESULT_FILE = NULL; 47 if ((N = get_argument (*argc, argv, "-result"))) { 48 remove_argument (N, argc, argv); 49 RESULT_FILE = strcreate (argv[N]);; 41 50 remove_argument (N, argc, argv); 42 51 } … … 85 94 } 86 95 96 int status = input (2, &argv[0]); 97 if (!status) exit (2); 98 exit (0); 99 100 # if (0) 87 101 // identiy the comm 88 102 Command *cmd = MatchCommand (argv[1], TRUE, TRUE); … … 96 110 if (!status) exit (2); 97 111 exit (0); 112 # endif 98 113 } 99 114 -
branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo/dvo_host_utils.c
r33543 r33563 6 6 # define MAX_PATH_LENGTH 1024 7 7 8 int HostTableLaunchJobs (HostTable *table, char *basecmd ) {8 int HostTableLaunchJobs (HostTable *table, char *basecmd, char *options) { 9 9 10 10 int i; … … 19 19 snprintf (resultFile, MAX_PATH_LENGTH, "%s/dvo.results.fits", table->hosts[i].pathname); 20 20 21 char *commandFile = abspath("dvo_client.command.txt", MAX_PATH_LENGTH); 22 FILE *f = fopen (commandFile, "w"); 23 fprintf (f, "%s\n", basecmd); 24 fclose (f); 25 21 26 char command[1024]; 22 snprintf (command, 1024, "dvo_client %s -result %s -hostID %d -hostdir %s", basecmd, resultFile, table->hosts[i].hostID, table->hosts[i].pathname); 27 snprintf (command, 1024, "dvo_client %s -result %s %s -hostID %d -hostdir %s", commandFile, resultFile, options, table->hosts[i].hostID, table->hosts[i].pathname); 28 free (commandFile); 23 29 24 30 if (DEBUG || PARALLEL_MANUAL) fprintf (stderr, "command: %s\n", command); … … 103 109 104 110 char tmp; 105 char * command= NULL;106 int length = snprintf (&tmp, 0, " %s -D CATDIR %s -time %s %s -skyregion %f %f %f %f", basecmd, CATDIR, TimeRef, TimeFormat, Rmin, Rmax, Dmin, Dmax);111 char *options = NULL; 112 int length = snprintf (&tmp, 0, "-D CATDIR %s -time %s %s -skyregion %f %f %f %f", CATDIR, TimeRef, TimeFormat, Rmin, Rmax, Dmin, Dmax); 107 113 108 ALLOCATE ( command, char, length);109 snprintf ( command, length, "%s -D CATDIR %s -time %s %s -skyregion %f %f %f %f", basecmd, CATDIR, TimeRef, TimeFormat, Rmin, Rmax, Dmin, Dmax);114 ALLOCATE (options, char, length); 115 snprintf (options, length, "-D CATDIR %s -time %s %s -skyregion %f %f %f %f", CATDIR, TimeRef, TimeFormat, Rmin, Rmax, Dmin, Dmax); 110 116 111 117 // launch this command remotely 112 HostTableLaunchJobs (table, command); 113 free (command); 118 HostTableLaunchJobs (table, basecmd, options); 119 free (options); 120 free (basecmd); 114 121 115 122 if (PARALLEL_MANUAL) { … … 158 165 free (vec); 159 166 167 free (table); 160 168 return TRUE; 161 169 } -
branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo/gcat.c
r20535 r33563 3 3 int gcat (int argc, char **argv) { 4 4 5 int i ;5 int i, N; 6 6 struct stat filestat; 7 7 double Ra, Dec, Radius; … … 9 9 SkyList *skylist; 10 10 void *Signal; 11 12 int ShowHost = FALSE; 13 if ((N = get_argument (argc, argv, "-host"))) { 14 remove_argument (N, &argc, argv); 15 ShowHost = TRUE; 16 } 17 int ShowBackup = FALSE; 18 if ((N = get_argument (argc, argv, "-backup"))) { 19 remove_argument (N, &argc, argv); 20 ShowBackup = TRUE; 21 } 22 int ShowFlags = FALSE; 23 if ((N = get_argument (argc, argv, "-flags"))) { 24 remove_argument (N, &argc, argv); 25 ShowFlags = TRUE; 26 } 11 27 12 28 if ((argc != 3) && (argc != 4)) { … … 31 47 32 48 for (i = 0; (i < skylist[0].Nregions) && !interrupt; i++) { 49 gprint (GP_ERR, "%3d %s", i, skylist[0].regions[i][0].name); 33 50 if (stat (skylist[0].filename[i], &filestat) != -1) { 34 gprint (GP_ERR, " %3d %s *\n", i, skylist[0].regions[i][0].name);51 gprint (GP_ERR, " *"); 35 52 } else { 36 gprint (GP_ERR, " %3d %s\n", i, skylist[0].regions[i][0].name);53 gprint (GP_ERR, " "); 37 54 } 55 if (ShowHost) { 56 gprint (GP_ERR, " %3d", skylist[0].regions[i][0].hostID); 57 } else { 58 gprint (GP_ERR, " "); 59 } 60 if (ShowBackup) { 61 gprint (GP_ERR, " %3d", skylist[0].regions[i][0].backupID); 62 } else { 63 gprint (GP_ERR, " "); 64 } 65 if (ShowFlags) { 66 gprint (GP_ERR, " 0x%04x", skylist[0].regions[i][0].hostFlags); 67 } else { 68 gprint (GP_ERR, " "); 69 } 70 gprint (GP_ERR, "\n"); 38 71 set_str_variable ("CATNAME", skylist[0].filename[i]); 39 72 } -
branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo/mextract.c
r33543 r33563 38 38 remove_argument (N, &argc, argv); 39 39 PARALLEL = TRUE; 40 }41 42 // dump results directly to fits file (esp for parallel dvo)43 char *ResultFile = NULL;44 if ((N = get_argument (argc, argv, "-result"))) {45 remove_argument (N, &argc, argv);46 ResultFile = strcreate(argv[N]);47 remove_argument (N, &argc, argv);48 40 } 49 41 … … 63 55 } 64 56 65 // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results66 if (PARALLEL && !HOST_ID) {67 // not all parallel ops need to set the region selection...68 if (!SetSkyRegions (selection)) goto escape;69 70 int status = HostTableParallelOps (argc, argv, ResultFile, 0);71 return status;72 }73 74 57 // init locally static variables (time refs) 75 58 dbExtractMeasuresInit(); … … 112 95 /* load region corresponding to selection above */ 113 96 if ((skylist = SelectRegions (selection)) == NULL) goto escape; 97 98 // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results 99 if (PARALLEL && !HOST_ID) { 100 int status = HostTableParallelOps (argc, argv, RESULT_FILE, 0); 101 102 dbFreeFields (fields, Nfields); 103 dbFreeStack (stack, Nstack); 104 free (stack); 105 FreeSkyRegionSelection (selection); 106 dvo_catalog_free (&catalog); 107 108 return status; 109 } 114 110 115 111 // load image data if needed (for fields listed below) … … 227 223 228 224 // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere) 229 if (R esultFile) {230 int status = WriteVectorTableFITS (R esultFile, "RESULT", vec, Nreturn, FALSE, NULL);225 if (RESULT_FILE) { 226 int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nreturn, FALSE, NULL); 231 227 if (!status) goto escape; 232 228 } … … 243 239 244 240 escape: 245 if (ResultFile) free (ResultFile);246 241 if (vec) free (vec); 247 242 free (values); -
branches/eam_branches/ipp-20111122/Ohana/src/opihi/include/dvoshell.h
r33543 r33563 30 30 int HOST_ID; 31 31 char *HOSTDIR; 32 char *RESULT_FILE; 32 33 33 34 /*** dvo prototypes ***/ … … 98 99 dbValue dbExtractImages PROTO((Image *image, off_t Nimage, off_t N, dbField *field)); 99 100 100 int HostTableLaunchJobs PROTO((HostTable *table, char *basecmd ));101 int HostTableLaunchJobs PROTO((HostTable *table, char *basecmd, char *options)); 101 102 int HostTableParallelOps PROTO((int argc, char **argv, char *ResultFile, int Nelements)); 102 103 # endif
Note:
See TracChangeset
for help on using the changeset viewer.
