~ubuntu-branches/ubuntu/vivid/atlas/vivid

« back to all changes in this revision

Viewing changes to results/mergetvecs.c

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot, Sylvestre Ledru, Sébastien Villemot
  • Date: 2013-06-11 15:58:16 UTC
  • mfrom: (1.1.4) (25 sid)
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: package-import@ubuntu.com-20130611155816-8xeeiziu1iml040c
Tags: 3.10.1-1
[ Sylvestre Ledru ]
* New upstream release (Closes: #609287)

[ Sébastien Villemot ]
* Provide architectural defaults (i.e. precomputed timings) for all
  release archs (except armel and mips for the time being, due to slow
  porterboxes). This will make the package build much faster and should
  eliminate transient build failures due to excessive variance in the
  timings.
* Move symlinks for lib{cblas,f77blas,atlas,lapack_atlas} out of the
  libblas.so.3 alternative and make them always present, so that
  software relying on these libs do not break when another alternative
  is selected for BLAS
* ATLAS now has improved ARM support with native asm constructs. This required
  the following tunes:
  + armel-is-v4t.diff: new patch, prevents FTBFS on armel; otherwise,
    ATLAS uses asm constructs too recent for the platform (armel is only v4t)
  + debian/rules: on armhf, define the ATL_ARM_HARDFP flag; otherwise the asm
    constructs use the soft-float ABI for passing floating points
  + on armhf, ensure that -mfloat-abi=softfp and -mcpu=vfpv3 flags are never
    used; this is implemented via a patch (armhf.diff) and by the use of fixed
    archdefs
* The generic package is now built without multi-threading, because otherwise
  the package fails to build on some single-processor machines (this required
  the introduction of a patch: fix-non-threaded-build.diff). As a side effect,
  the build of the custom package gracefully handles non-threaded
  builds. (Closes: #602524)
* Add libblas.a as slave in the libblas.so alternative (Closes: #701921)
* Add symlinks for lib{f77blas,atlas}.a in /usr/lib (Closes: #666203)
* Modify shlibs file of libatlas3-base, such that packages using
  libblas/liblapack depend on any BLAS/LAPACK alternative, while packages
  depending on ATLAS-specific libraries (e.g. libatlas.so) depend specifically
  on libatlas3-base.
* corei1.diff: remove patch, applied upstream
* Use my @debian.org email address
* Remove obsolete DM-Upload-Allowed flag
* Switch VCS to git
* Remove Conflicts/Replaces against pre-squeeze packages
* libatlas-base-dev now provides libblas.so, as libblas-dev
* No longer use -Wa,--noexecstack in CFLAGS, it makes the package FTBFS
* Do not use POWER3 arch for powerpcspe port (Closes: #701068)
* Bump to debhelper compat level 9
* README.Debian: mention that devscripts is needed to compile the custom
  package (Closes: #697431)
* Bump Standards-Version to 3.9.4. As a consequence, add Built-Using
  fields because the package embeds stuff from liblapack-pic

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "atlas_tvec.h"
 
2
 
 
3
void PrintUsage(char *name, char *arg, int i)
 
4
{
 
5
   fprintf(stderr,
 
6
"This routine takes two vector files, and combines a list of named vectors\n");
 
7
   fprintf(stderr,
 
8
"so they form one contiguous range.  The range vector is specified by -r,\n");
 
9
   fprintf(stderr, "and these vectors should not overlap.\n\n");
 
10
   if (i > 0)
 
11
      fprintf(stderr, "BAD ARG '%s' ON %dth FLAG\n", arg, i);
 
12
   fprintf(stderr, "USAGE: %s <flags> ; flags include:\n", name);
 
13
   fprintf(stderr, "   -i1 <file> : (stdin) 1st file wt vecs to combine\n");
 
14
   fprintf(stderr, "   -i2 <file> : (stdin) 2nd file wt vecs to combine\n");
 
15
   fprintf(stderr, "   -o <file>  : (stdout) file for combined vecs\n");
 
16
   fprintf(stderr,
 
17
           "   -r <name>  : (\"N\"): range vector to sort combine on\n");
 
18
   fprintf(stderr, "   -C # <nam1> ... <nam#>: vectors to combine\n");
 
19
   exit (i ? i : -1);
 
20
}
 
21
 
 
22
char **GetFlags         /* RETURNS: array of names to combine */
 
23
(
 
24
   int nargs,
 
25
   char **args,
 
26
   FILE **fp1,          /* 1st input stream */
 
27
   FILE **fp2,          /* 2nd input stream */
 
28
   FILE **fpout,        /* output stream */
 
29
   char **rngv,         /* name of range/sort vector */
 
30
   int *Nc              /* # of vectors to combine using rngv */
 
31
)
 
32
{
 
33
   char **na=NULL, *sp;
 
34
   int i, j, n;
 
35
   FILE *fp;
 
36
 
 
37
   *fp1 = *fp2 = stdin;
 
38
   *fpout = stdout;
 
39
   *rngv = "N";
 
40
   *Nc = 0;
 
41
   for (i=1; i < nargs; i++)
 
42
   {
 
43
      if (args[i][0] != '-')
 
44
         PrintUsage(args[0], "no '-' preceeding flag!", i);
 
45
      switch(args[i][1])
 
46
      {
 
47
      case 'i':    /* -i[1,2] <file> */
 
48
         if (++i >= nargs)
 
49
            PrintUsage(args[0], "out of flags in -i ", i-1);
 
50
         fp = fopen(args[i], "r");
 
51
         assert(fp);
 
52
         if (args[i-1][2] == '1')
 
53
            *fp1 = fp;
 
54
         else
 
55
            *fp2 = fp;
 
56
         break;
 
57
      case 'o':    /* -o <file> */
 
58
         if (++i >= nargs)
 
59
            PrintUsage(args[0], "out of flags in -i ", i-1);
 
60
         fp = fopen(args[i], "w");
 
61
         assert(fp);
 
62
         *fpout = fp;
 
63
         break;
 
64
      case 'r':    /* -r <name> */
 
65
         if (++i >= nargs)
 
66
            PrintUsage(args[0], "out of flags in -i ", i-1);
 
67
         *rngv = args[i];
 
68
         break;
 
69
      case 'C':    /* -C # <nam1> ... <nam#> */
 
70
         if (++i >= nargs)
 
71
            PrintUsage(args[0], "out of flags in -C ", i-1);
 
72
         *Nc = n = atoi(args[i]);
 
73
         assert(n > 0 && n < 2048);
 
74
         na = malloc(sizeof(char*)*n);
 
75
         assert(na);
 
76
         for (j=0; j < n; j++)
 
77
         {
 
78
            if (++i >= nargs)
 
79
               PrintUsage(args[0], "out of flags in -C ", i-1);
 
80
            na[j] = args[i];
 
81
         }
 
82
         break;
 
83
      default :
 
84
         PrintUsage(args[0], args[i], i);
 
85
      }                                         /* end switch over flags */
 
86
   }                                            /* end for over flags */
 
87
   if (*Nc == 0)
 
88
   {
 
89
      *Nc = 1;
 
90
      na = malloc(sizeof(char*));
 
91
      assert(na);
 
92
      na[0] = *rngv;
 
93
   }
 
94
//   assert(*fp1 != *fp2);
 
95
   return(na);
 
96
}
 
97
 
 
98
int main(int nargs, char **args)
 
99
{
 
100
   FILE *fp1, *fp2, *fpout;
 
101
   char *rngv, **combarr, *cmnt;
 
102
   int N, Nc, i, j, RNGINC=0, nrep;
 
103
   ATL_tvec_t *t1, *t2, *tp, *p1, *p2, *r1, *r2, *cb, *cp;
 
104
 
 
105
   combarr = GetFlags(nargs, args, &fp1, &fp2, &fpout, &rngv, &Nc);
 
106
/*
 
107
 * Grab only the vectors to be combined, in order user has specified from
 
108
 * both lists, and free all unused vectors
 
109
 */
 
110
   t1 = ATL_ReadTvecFile(fp1, &cmnt, &N, &nrep);
 
111
   if (fp1 != stdin)
 
112
      fclose(fp1);
 
113
   tp = ATL_PullNamedVecsFromList(Nc, combarr, &t1);
 
114
   if (t1)
 
115
      ATL_KillAllTvecs(t1);
 
116
   t1 = tp;
 
117
 
 
118
   t2 = ATL_ReadTvecFile(fp2, &cmnt, &i, &j);
 
119
   if (fp2 != stdin)
 
120
      fclose(fp2);
 
121
   tp = ATL_PullNamedVecsFromList(Nc, combarr, &t2);
 
122
   if (t2)
 
123
      ATL_KillAllTvecs(t2);
 
124
   t2 = tp;
 
125
/*
 
126
 * Find range vectors
 
127
 */
 
128
   r1 = ATL_FindTvecByName(t1, rngv);
 
129
   r2 = ATL_FindTvecByName(t2, rngv);
 
130
   assert(r1->pre == 'i' && r2->pre == 'i');  /* restriction to fix later */
 
131
/*
 
132
 * Combine all vectors and build new list cb
 
133
 */
 
134
   for (cb=NULL, p1=t1, p2=t2; p1 && p2; p1 = p1->next, p2 = p2->next)
 
135
   {
 
136
      ATL_tvec_t *p;
 
137
 
 
138
      assert(!strcmp(p1->name, p2->name));
 
139
      assert(p1->nrep == p2->nrep);
 
140
      p = ATL_CombineTheseVecsUsingInts(r1, r2, p1, p2);
 
141
      if (cb)
 
142
         cp->next = p;
 
143
      else
 
144
         cb = p;
 
145
      cp = p;
 
146
   }
 
147
   ATL_KillAllTvecs(t1);
 
148
   ATL_KillAllTvecs(t2);
 
149
   ATL_WriteTvecFile(fpout, cmnt, Nc, nrep, cb);
 
150
   ATL_KillAllTvecs(cb);
 
151
   free(cmnt);
 
152
#if 0
 
153
   printf("rngv = '%s'\n", rngv);
 
154
   for (i=0; i < Nc; i++)
 
155
      printf("nam[%d] = '%s'\n", i, combarr[i]);
 
156
#endif
 
157
   if (fpout != stdout && fpout != stderr)
 
158
      fclose(fpout);
 
159
   return(0);
 
160
}