IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29540


Ignore:
Timestamp:
Oct 25, 2010, 12:50:29 PM (16 years ago)
Author:
eugene
Message:

merge changes from eam_branches/ipp-20100823

Location:
trunk/Ohana/src/opihi
Files:
24 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.astro/coords.c

    r27491 r29540  
    109109  gprint (GP_ERR, " -p : from pixels to ra/dec\n");
    110110  gprint (GP_ERR, " -c : from ra/dec to pixels\n");
     111  gprint (GP_ERR, " coordinates are in degrees\n");
    111112 escape:
    112113  if (MOSAIC != NULL) free (MOSAIC);
  • trunk/Ohana/src/opihi/cmd.basic/fprintf.c

    r9196 r29540  
    4040    switch (*p1) {
    4141      case 'e':
     42      case 'g':
    4243      case 'f':
     44      case 'E':
     45      case 'F':
     46      case 'G':
    4347        sprintf (tmp, fmt, atof(argv[i]));
    4448        break;
     
    4751        break;
    4852      case 'd':
     53      case 'o':
     54      case 'i':
     55      case 'u':
    4956      case 'c':
    5057      case 'x':
     58      case 'X':
    5159        sprintf (tmp, fmt, atoi(argv[i]));
    5260        break;
    5361      default:
    54         gprint (GP_ERR, "syntax error in format (only e,f,s,d,c,x allowed)\n");
     62        gprint (GP_ERR, "syntax error in format (e,f,g,E,F,G,c,s,d,i,o,x,X conversions allowed)\n");
    5563        return (FALSE);
    5664    }
  • trunk/Ohana/src/opihi/cmd.data/Makefile

    r29001 r29540  
    102102$(SRC)/read_vectors.$(ARCH).o   \
    103103$(SRC)/rebin.$(ARCH).o          \
    104 $(SRC)/resize.$(ARCH).o \
     104$(SRC)/reindex.$(ARCH).o        \
     105$(SRC)/resize.$(ARCH).o         \
    105106$(SRC)/relocate.$(ARCH).o       \
    106107$(SRC)/roll.$(ARCH).o           \
  • trunk/Ohana/src/opihi/cmd.data/center.c

    r21060 r29540  
    1616  if (!GetImage (NULL, &kapa, name)) return (FALSE);
    1717  FREE (name);
     18
     19  // XXX need an option to center the image based on the current plot limits
    1820
    1921  if ((argc != 3) && (argc != 4)) {
  • trunk/Ohana/src/opihi/cmd.data/init.c

    r29001 r29540  
    9191int rebin            PROTO((int, char **));
    9292int resize           PROTO((int, char **));
     93int reindex          PROTO((int, char **));
    9394int relocate         PROTO((int, char **));
    9495int roll             PROTO((int, char **));
     
    232233  {1, "read",         read_vectors,     "read vectors from datafile"},
    233234  {1, "rebin",        rebin,            "rebin image data by factor of N"},
     235  {1, "reindex",      reindex,          "create new vector from old vector based on index vector"},
    234236  {1, "resize",       resize,           "set graphics/image window size"},
    235237  {1, "relocate",     relocate,         "set graphics/image window position"},
  • trunk/Ohana/src/opihi/cmd.data/limits.c

    r13479 r29540  
    2424  if (!GetGraph (&graphmode, &kapa, name)) return (FALSE);
    2525  FREE (name);
     26
     27  // XXX need an option to set the limits based on the current image bounds
    2628
    2729  if (argc == 1) {
  • trunk/Ohana/src/opihi/cmd.data/read_vectors.c

    r27435 r29540  
    216216
    217217    while (1) {
    218       if (!gfits_load_header (f, &header)) ESCAPE ("extension not found in file");
     218      if (!gfits_load_header (f, &header)) {
     219        gprint (GP_ERR, "extension %s not found in file\n", extname);
     220        if (CCDKeyword != NULL) free (CCDKeyword);
     221        gfits_free_table  (&table);
     222        gfits_free_header (&header);
     223        return (TRUE); 
     224      }
     225
    219226      Nbytes = gfits_data_size (&header);
    220227
  • trunk/Ohana/src/opihi/cmd.data/svd.c

    r27185 r29540  
    8282      }
    8383
    84 # if 0     
    85       status = svdcmp_bond_raw (Ny, Nx, 1, 1, FLT_EPSILON, 1e-6, a, q, u, v);
     84# if 1     
     85      status = svdcmp_bond_new (Ny, Nx, 1, 1, FLT_EPSILON, 1e-6, a, q, u, v);
    8686      fprintf (stderr, "status: %d\n", status);
    8787# else
  • trunk/Ohana/src/opihi/dvo/LoadImages.c

    r29001 r29540  
    7575    lastModified = getLastModified(filename);
    7676  }
     77
    7778  return (image);
    7879}
  • trunk/Ohana/src/opihi/dvo/badimages.c

    r27435 r29540  
    7070  }
    7171 
     72  FreeImages(image);
    7273  return (TRUE);
    73 
    7474}
  • trunk/Ohana/src/opihi/dvo/imdata.c

    r27435 r29540  
    222222  vec[0].Nelements = N;
    223223  REALLOCATE (vec[0].elements.Flt, opihi_flt, MAX(1,N));
     224  FreeImages(image);
    224225  return (TRUE);
    225226}
  • trunk/Ohana/src/opihi/dvo/imlist.c

    r27435 r29540  
    108108  }
    109109
     110  FreeImages(image);
    110111  free (subset);
    111   free (image);
    112112  return (TRUE);
    113113}
  • trunk/Ohana/src/opihi/dvo/imphot.c

    r27435 r29540  
    9292  }
    9393
    94   free (image);
     94  FreeImages(image);
    9595  free (subset);
    9696  return (TRUE);
  • trunk/Ohana/src/opihi/dvo/imstats.c

    r27435 r29540  
    5858  free (Xvec.elements.Flt);
    5959  free (Yvec.elements.Flt);
     60  FreeImages (image);
    6061  return (TRUE);
    6162}
  • trunk/Ohana/src/opihi/dvo/skycoverage.c

    r27435 r29540  
    179179  PutCoords (&coords, &buf[0].header);
    180180
    181   if ((image = LoadImages (&Nimage)) == NULL) return (FALSE);
     181  image = LoadImages(&Nimage);
     182  if (image == NULL) {
     183      return (FALSE);
     184  }
    182185  BuildChipMatch (image, Nimage);
    183186
     
    251254    }
    252255  }
    253 
    254   free (image);
     256  FreeImages(image);
    255257  return (TRUE);
    256258}
  • trunk/Ohana/src/opihi/dvo/subpix.c

    r27435 r29540  
    147147
    148148  dvo_catalog_free (&catalog);
    149   free (image);
    150149  free (index);
    151150  SkyListFree (skylist);
    152151
     152  FreeImages(image);
    153153  return (TRUE);
    154154}
  • trunk/Ohana/src/opihi/include/data.h

    r27435 r29540  
    9292int svdcmp_bond_raw(int m, int n, int withu, int withv, double eps, double tol, double **a, double *q, double **u, double **v);
    9393
     94/* in svdcmp_bond_new.c */
     95int svdcmp_bond_new(int m, int n, int withu, int withv, double eps, double tol, double **a, double *q, double **u, double **v);
     96
    9497/* mrqmin.c */
    9598opihi_flt mrqcof (opihi_flt *x, opihi_flt *y, opihi_flt *dy, int Npts,
  • trunk/Ohana/src/opihi/include/pcontrol.h

    r28242 r29540  
    115115  char        *hostname;
    116116  char        *realhost;
     117  char       **xhosts;
     118  int          Nxhosts;
    117119  int          exit_status;
    118120  int          Reset;
     
    289291Job   *PullJobByID (IDtype JobID, int *StackID);
    290292Job   *PullJobFromStackByID (int StackID, int ID);
    291 IDtype AddJob (char *hostname, JobMode mode, int timeout, int argc, char **argv);
     293IDtype AddJob (char *hostname, JobMode mode, int timeout, int argc, char **argv, int Nxhosts, char **xhosts);
    292294void   DelJob (Job *job);
    293295Host  *UnlinkJobAndHost (Job *job);
  • trunk/Ohana/src/opihi/lib.data/Makefile

    r27185 r29540  
    2020$(SDIR)/fft.$(ARCH).o                   \
    2121$(SDIR)/svdcmp.$(ARCH).o                \
     22$(SDIR)/svdcmp_bond_new.$(ARCH).o               \
    2223$(SDIR)/convert.$(ARCH).o               \
    2324$(SDIR)/bracket.$(ARCH).o               \
  • trunk/Ohana/src/opihi/pcontrol/CheckIdleHost.c

    r28158 r29540  
    6060    if (strcasecmp (job[0].hostname, host[0].hostname)) continue;
    6161
     62    if (!CheckMachineJobs (host, job)) continue;
     63
    6264    /* we have found an appropriate job; link it to the host and send to StartJob */
    6365    job[0].host = (struct Host *) host;
     
    8082    ASSERT (job[0].hostname != NULL, "WANTHOST hostname missing");
    8183    if (strcasecmp (job[0].hostname, host[0].hostname)) continue;
     84
     85    if (!CheckMachineJobs (host, job)) continue;
    8286
    8387    /* we have found an appropriate job; link it to the host and send to StartJob */
  • trunk/Ohana/src/opihi/pcontrol/JobOps.c

    r28242 r29540  
    195195}
    196196
    197 IDtype AddJob (char *hostname, JobMode mode, int timeout, int argc, char **argv) {
     197IDtype AddJob (char *hostname, JobMode mode, int timeout, int argc, char **argv, int Nxhosts, char **xhosts) {
    198198
    199199  int JobID;
     
    228228  job[0].host     = NULL;
    229229
     230  job[0].xhosts = xhosts;
     231  job[0].Nxhosts = Nxhosts;
     232
    230233  JobID = job[0].JobID;
    231234
     
    257260  FREE (job[0].argv);
    258261
     262  for (i = 0; i < job[0].Nxhosts; i++) {
     263    FREE (job[0].xhosts[i]);
     264  }
     265  FREE (job[0].xhosts);
     266
    259267  FreeIOBuffer (&job[0].stdout_buf.buffer);
    260268  FreeIOBuffer (&job[0].stderr_buf.buffer);
  • trunk/Ohana/src/opihi/pcontrol/MachineOps.c

    r26521 r29540  
    11# include "pcontrol.h"
     2# define DEBUG 0
    23
    34static int MAX_UNWANTED_HOST_JOBS = 5;
     
    107108int AddMachineJob (Host *host, Job *job) {
    108109
     110  int i;
    109111  Machine *machine;
    110112
     
    114116  machine[0].NjobsRealhost ++;
    115117
    116   // skip jobs that do not have a targeted host
    117   if (job[0].hostname == NULL) {
    118     return (TRUE);
     118  // skip jobs that do not have a targeted host or any xhosts
     119  if (!job[0].hostname && !job[0].Nxhosts) {
     120    return (TRUE);
     121  }
     122
     123  for (i = 0; i < job[0].Nxhosts; i++) {
     124    // find machine matching the xhost name (these count against the unwanted host total)
     125    machine = FindMachineByName (job[0].xhosts[i]); // Can this fail?
     126    if (!machine) continue;
     127    machine[0].NjobsWanthost ++;
    119128  }
    120129
     
    134143int DelMachineJob (Host *host, Job *job) {
    135144
     145  int i;
    136146  Machine *machine;
    137147
     
    141151  machine[0].NjobsRealhost --;
    142152
    143   // skip jobs that do not have a targeted host
    144   if (job[0].hostname == NULL) {
    145     return (TRUE);
     153  // skip jobs that do not have a targeted host or any xhosts
     154  if (!job[0].hostname && !job[0].Nxhosts) {
     155    return (TRUE);
     156  }
     157
     158  for (i = 0; i < job[0].Nxhosts; i++) {
     159    // find machine matching the xhost name (these count against the unwanted host total)
     160    machine = FindMachineByName (job[0].xhosts[i]); // Can this fail?
     161    if (!machine) continue;
     162    machine[0].NjobsWanthost --;
    146163  }
    147164
     
    175192int CheckMachineJobs (Host *host, Job *job) {
    176193
     194  int i;
    177195  Machine *machine;
    178196
    179197  machine = FindMachineByName (job[0].hostname);
    180   if (machine == NULL) return (TRUE);
    181   // fprintf (stderr, "wanthost: %s, Ntotal: %d, Nmax: %d\n", job[0].hostname, machine[0].NjobsWanthost + machine[0].NjobsRealhost, machine[0].Nhosts + MAX_UNWANTED_HOST_JOBS);
    182   // if (machine[0].NjobsWanthost + machine[0].NjobsRealhost >= machine[0].Nhosts + MAX_UNWANTED_HOST_JOBS) {
    183   if (machine[0].NjobsWanthost >= MAX_UNWANTED_HOST_JOBS) {
    184     // fprintf (stderr, "too many outstanding jobs wanting host %s, delay job %s for now\n", job[0].hostname, job[0].argv[0]);
    185     return (FALSE);
    186   }
     198  if (machine) {
     199    if (DEBUG) fprintf (stderr, "wanthost: %s, Ntotal: %d, Nmax: %d\n", machine[0].name, machine[0].NjobsWanthost + machine[0].NjobsRealhost, machine[0].Nhosts + MAX_UNWANTED_HOST_JOBS);
     200    if (machine[0].NjobsWanthost >= MAX_UNWANTED_HOST_JOBS) {
     201      if (DEBUG) fprintf (stderr, "too many outstanding jobs wanting host %s, delay job %s for now\n", machine[0].name, job[0].argv[0]);
     202      return (FALSE);
     203    }
     204  }
     205
     206  for (i = 0; i < job[0].Nxhosts; i++) {
     207    machine = FindMachineByName (job[0].xhosts[i]);
     208    if (machine) {
     209      if (DEBUG) fprintf (stderr, "xhost: %s, Ntotal: %d, Nmax: %d\n", machine[0].name, machine[0].NjobsWanthost + machine[0].NjobsRealhost, machine[0].Nhosts + MAX_UNWANTED_HOST_JOBS);
     210      if (machine[0].NjobsWanthost >= MAX_UNWANTED_HOST_JOBS) {
     211        if (DEBUG) fprintf (stderr, "too many outstanding jobs wanting host %s, delay job %s for now\n", machine[0].name, job[0].argv[0]);
     212        return (FALSE);
     213      }
     214    }
     215  }   
    187216
    188217  machine = FindMachineByName (host[0].hostname);
    189   // fprintf (stderr, "realhost: %s, Ntotal: %d, Nmax: %d\n", host[0].hostname, machine[0].NjobsWanthost + machine[0].NjobsRealhost, machine[0].Nhosts + MAX_UNWANTED_HOST_JOBS);
    190   if (machine[0].NjobsWanthost >= MAX_UNWANTED_HOST_JOBS) {
    191     // fprintf (stderr, "too many outstanding jobs wanting host %s, delay job %s for now\n", job[0].hostname, job[0].argv[0]);
    192     return (FALSE);
    193   }
     218  if (machine) {
     219    if (DEBUG) fprintf (stderr, "realhost: %s, Ntotal: %d, Nmax: %d\n", machine[0].name, machine[0].NjobsWanthost + machine[0].NjobsRealhost, machine[0].Nhosts + MAX_UNWANTED_HOST_JOBS);
     220    if (machine[0].NjobsWanthost >= MAX_UNWANTED_HOST_JOBS) {
     221      if (DEBUG) fprintf (stderr, "too many outstanding jobs wanting host %s, delay job %s for now\n", machine[0].name, job[0].argv[0]);
     222      return (FALSE);
     223    }
     224  }
     225
    194226  return (TRUE);
    195227}
  • trunk/Ohana/src/opihi/pcontrol/job.c

    r23586 r29540  
    66  int i, N, Mode, targc, Timeout;
    77  IDtype JobID;
     8  char **xhosts;
     9  int Nxhosts, NXHOSTS;
    810
    911  if (get_argument (argc, argv, "-host") && get_argument (argc, argv, "+host")) {
     
    3941  }
    4042
     43  xhosts = NULL;
     44  Nxhosts = 0;
     45  NXHOSTS = 10;
     46  while ((N = get_argument (argc, argv, "-xhost"))) {
     47    if (xhosts == NULL) {
     48      ALLOCATE (xhosts, char *, NXHOSTS);
     49    }
     50    remove_argument (N, &argc, argv);
     51    xhosts[Nxhosts] = strcreate (argv[N]);
     52    remove_argument (N, &argc, argv);
     53    Nxhosts ++;
     54    if (Nxhosts == NXHOSTS) {
     55      NXHOSTS += 10;
     56      REALLOCATE (xhosts, char *, NXHOSTS);
     57    }
     58  }
     59
    4160  if (argc < 2) {
    4261    FREE (Host);
     
    5170
    5271  // a JobID < 0 mean the job was not accepted
    53   JobID = AddJob (Host, Mode, Timeout, targc, targv);
     72  JobID = AddJob (Host, Mode, Timeout, targc, targv, Nxhosts, xhosts);
    5473  gprint (GP_LOG, "JobID: %d\n", (int) JobID);
    5574  return (TRUE);
     
    5776 usage:
    5877    gprint (GP_ERR, "USAGE: job [options] (arg0) (arg1) ... (argN)\n");
    59     gprint (GP_ERR, "  options: -host, +host, -timeout\n");
     78    gprint (GP_ERR, "  options: -host, +host, -timeout, -xhost (host)\n");
    6079    gprint (GP_ERR, "  arguments of the form @MAX_THREADS@ will be replaced when the job is launched\n");
     80
     81    FREE (Host);
     82    for (i = 0; i < Nxhosts; i++) {
     83      FREE (xhosts[i]);
     84    }
     85    FREE (xhosts);
    6186    return (FALSE);
    6287}
  • trunk/Ohana/src/opihi/pcontrol/test/machines.sh

    r28158 r29540  
    1010  host add ipp022
    1111  host add ipp022
     12  host add ipp002
     13  host off ipp002
    1214
    1315  machines
     
    2325  job -host pikake sleep 10
    2426  job -host pikake sleep 10
     27end
     28
     29macro load.xhost
     30  job -host pikake -xhost ipp002 sleep 10
     31  job -host pikake -xhost ipp002 sleep 10
     32  job -host ipp022 -xhost ipp002 sleep 10
     33  job -host ipp022 -xhost ipp002 sleep 10
     34  job -host pikake -xhost ipp002 sleep 10
     35  job -host pikake -xhost ipp002 sleep 10
     36  job -host ipp022 -xhost ipp002 sleep 10
     37  job -host ipp022 -xhost ipp002 sleep 10
     38end
     39
     40macro load.2xhost
     41  job -host pikake -xhost ipp002 -xhost ipp022 sleep 10
     42  job -host pikake -xhost ipp002 -xhost ipp022 sleep 10
     43  job -host ipp022 -xhost ipp002 -xhost ipp022 sleep 10
     44  job -host ipp022 -xhost ipp002 -xhost ipp022 sleep 10
     45  job -host pikake -xhost ipp002 -xhost ipp022 sleep 10
     46  job -host pikake -xhost ipp002 -xhost ipp022 sleep 10
     47  job -host ipp022 -xhost ipp002 -xhost ipp022 sleep 10
     48  job -host ipp022 -xhost ipp002 -xhost ipp022 sleep 10
    2549end
    2650
Note: See TracChangeset for help on using the changeset viewer.