IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35401


Ignore:
Timestamp:
Apr 16, 2013, 6:21:45 AM (13 years ago)
Author:
eugene
Message:

modify mmatch to provide host information needed to spawn jobs only on the appropriate machines

Location:
branches/eam_branches/ipp-20130307/Ohana/src/opihi/dvo
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130307/Ohana/src/opihi/dvo/mmatch.c

    r35327 r35401  
    106106  RAvec  = NULL;
    107107  DECvec = NULL;
    108   if (PARALLEL && !HOST_ID) {
    109 
    110     // We need to copy the args to a temp array and modify them so that we send the
    111     // correct set to the remote client.  The args list looks like this:
    112     // if (!CoordsFile) : mmatch (RA) (DEC) (RADIUS) field, ...
    113     // if ( CoordsFile) : mmatch (RADIUS) field, ... [because we stripped off the -coords filename elements]
    114 
    115     // allocate the temp array and copy all but (RA) (DEC)
    116     int targc = 0;
    117     char **targv = NULL;
    118     ALLOCATE (targv, char *, argc + 2);
    119     for (i = 0; i < argc; i++) {
    120       if (!CoordsFile && (i == 1)) continue;
    121       if (!CoordsFile && (i == 2)) continue;
    122       targv[targc] = strcreate (argv[i]);
    123       targc ++;
    124     }
    125 
    126     // if not specified, create the coords.fits input file
    127     if (!CoordsFile) {
    128       // get vectors corresponding to coordinates of interest
    129       if ((RAvec  = SelectVector (argv[1], ANYVECTOR, TRUE)) == NULL) goto help;
    130       if ((DECvec = SelectVector (argv[2], ANYVECTOR, TRUE)) == NULL) goto help;
    131      
    132       ALLOCATE (vec, Vector *, 2);
    133       vec[0] = RAvec;
    134       vec[1] = DECvec;
    135 
    136       CoordsFile = abspath("coords.fits", 1024);
    137       int status = WriteVectorTableFITS (CoordsFile, "COORDS", vec, 2, FALSE, NULL);
    138       if (!status) goto escape;
    139     }
    140 
    141     // add the coords file to the args list
    142     targv[targc+0] = strcreate ("-coords");
    143     targv[targc+1] = CoordsFile; // this gets freed with targv
    144     targc += 2;
    145    
    146     // if needed, add the index vector to the args list
    147     if (IDXvec) {
    148       REALLOCATE (targv, char *, targc + 2);
    149       targv[targc+0] = strcreate ("-index");
    150       targv[targc+1] = strcreate (IDXvec[0].name);
    151       targc += 2;
    152     }     
    153 
    154     if (loadImages) {
    155       Image *image;
    156       off_t Nimage;
    157       if ((image = LoadImagesDVO (&Nimage)) == NULL) goto escape;
    158 
    159       char *filename = abspath("image.metadata.fits", DVO_MAX_PATH);
    160       ImageMetadataSave (filename, image, Nimage);
    161 
    162       REALLOCATE (targv, char *, targc + 2);
    163       targv[targc+0] = strcreate ("-image-metadata");
    164       targv[targc+1] = strcreate (filename);
    165       targc += 2;
    166     }
    167 
    168     // call the remote client
    169     int status = HostTableParallelOps (skylist, targc, targv, RESULT_FILE, TRUE, 0, VERBOSE);
    170     if (vec) free (vec);
    171    
    172     // free up targv
    173     for (i = 0; i < targc; i++) {
    174       free (targv[i]);
    175     }
    176     free (targv);
    177 
    178     return status;
    179   }
    180108
    181109  // get vectors corresponding to coordinates of interest
     
    193121    remove_argument (1, &argc, argv);
    194122  }
     123
     124  /* load regions which contain all supplied RA,DEC coordinates */
     125  if ((skylist = SelectRegionsByCoordVectors (RAvec, DECvec)) == NULL) goto escape;
     126
     127  if (PARALLEL && !HOST_ID) {
     128
     129    // We need to copy the args to a temp array and modify them so that we send the
     130    // correct set to the remote client.  The args list looks like this:
     131    // if (!CoordsFile) : mmatch (RADIUS) field, ... [we removed RA & DEC above]
     132    // if ( CoordsFile) : mmatch (RADIUS) field, ... [because we stripped off the -coords filename elements]
     133
     134    // allocate the temp array and copy all but (RA) (DEC)
     135    int targc = 0;
     136    char **targv = NULL;
     137    ALLOCATE (targv, char *, argc + 2);
     138    for (i = 0; i < argc; i++) {
     139      targv[targc] = strcreate (argv[i]);
     140      targc ++;
     141    }
     142
     143    // if not specified, create the coords.fits input file
     144    // NOTE: RAvec, DECvec were set above
     145    if (!CoordsFile) {
     146      ALLOCATE (vec, Vector *, 2);
     147      vec[0] = RAvec;
     148      vec[1] = DECvec;
     149
     150      // XXX this is now set for both cases...
     151      CoordsFile = abspath("coords.fits", 1024);
     152      int status = WriteVectorTableFITS (CoordsFile, "COORDS", vec, 2, FALSE, NULL);
     153      if (!status) goto escape;
     154    }
     155
     156    // add the coords file to the args list
     157    targv[targc+0] = strcreate ("-coords");
     158    targv[targc+1] = CoordsFile; // this gets freed with targv
     159    targc += 2;
     160   
     161    // if needed, add the index vector to the args list
     162    if (IDXvec) {
     163      REALLOCATE (targv, char *, targc + 2);
     164      targv[targc+0] = strcreate ("-index");
     165      targv[targc+1] = strcreate (IDXvec[0].name);
     166      targc += 2;
     167    }     
     168
     169    if (loadImages) {
     170      Image *image;
     171      off_t Nimage;
     172      if ((image = LoadImagesDVO (&Nimage)) == NULL) goto escape;
     173
     174      char *filename = abspath("image.metadata.fits", DVO_MAX_PATH);
     175      ImageMetadataSave (filename, image, Nimage);
     176
     177      REALLOCATE (targv, char *, targc + 2);
     178      targv[targc+0] = strcreate ("-image-metadata");
     179      targv[targc+1] = strcreate (filename);
     180      targc += 2;
     181    }
     182
     183    // call the remote client
     184    int status = HostTableParallelOps (skylist, targc, targv, RESULT_FILE, TRUE, 0, VERBOSE);
     185    if (vec) free (vec);
     186   
     187    // free up targv
     188    for (i = 0; i < targc; i++) {
     189      free (targv[i]);
     190    }
     191    free (targv);
     192
     193    return status;
     194  } // END of remote call section
     195
    195196  RADIUS = atof (argv[1]);
    196197  remove_argument (1, &argc, argv);
     
    209210  }
    210211
    211   /* load regions which contain all supplied RA,DEC coordinates */
    212   if ((skylist = SelectRegionsByCoordVectors (RAvec, DECvec)) == NULL) goto escape;
    213212
    214213  /* create output storage vectors */
  • branches/eam_branches/ipp-20130307/Ohana/src/opihi/dvo/remote.c

    r35327 r35401  
    6161  }
    6262
     63  // load the list of hosts
     64  SkyTable *sky = GetSkyTable();
     65  if (!sky) {
     66    gprint (GP_ERR, "failed to load sky table for database\n");
     67    return FALSE;
     68  }
     69  SkyList *skylist = NULL;
     70  ALLOCATE (skylist, SkyList, 1);
     71  skylist[0].Nregions = sky[0].Nregions;
     72  strcpy (skylist[0].hosts, sky[0].hosts);
     73
    6374  // strip of the 'remote' and send the remaining arguments to the remote machine
    64   int status = HostTableParallelOps (NULL, argc - 1, &argv[1], NULL, ReadVectors, 0, VERBOSE);
     75  int status = HostTableParallelOps (skylist, argc - 1, &argv[1], NULL, ReadVectors, 0, VERBOSE);
     76  free (skylist);
    6577  return status;
    6678}
  • branches/eam_branches/ipp-20130307/Ohana/src/opihi/dvo/skyregion.c

    r33662 r35401  
    9898  new[0].Nregions = 0;
    9999  new[0].ownElements = FALSE; // this list is only holding a view to the elements
     100  strcpy (new[0].hosts, sky[0].hosts);
    100101
    101102  // output list
     
    107108  list[0].Nregions = 0;
    108109  list[0].ownElements = FALSE; // this list is only holding a view to the elements
     110  strcpy (list[0].hosts, sky[0].hosts);
    109111
    110112  for (i = 0; i < Npts; i++) {
Note: See TracChangeset for help on using the changeset viewer.