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

« back to all changes in this revision

Viewing changes to tune/blas/level1/iamaxtime.c

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot
  • Date: 2013-06-11 15:58:16 UTC
  • mfrom: (1.1.3 upstream)
  • mto: (2.2.21 experimental)
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: package-import@ubuntu.com-20130611155816-b72z8f621tuhbzn0
Tags: upstream-3.10.1
Import upstream version 3.10.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include <stdio.h>
2
2
#include <stdlib.h>
3
3
#include <assert.h>
 
4
double ATL_flushcache(long long size);
 
5
 
4
6
 
5
7
int FAx=0, MAx=0, FAy=0, MAy=0;
6
8
#include <stdio.h>
27
29
   int n, i;
28
30
   const int malign = align >= misalign ? align : misalign;
29
31
 
30
 
   n = size + align + malign;
 
32
   n = size + align + align + malign;
31
33
   i = (n >> 3)<<3;
32
34
   if (n != i)
33
35
      n += n - i;
41
43
   ap->memA = align ? (void*) ((((size_t) cp)/align)*align + align) : cp;
42
44
/*
43
45
 * Misalign to misalign
 
46
 * We often need to make sure to unaligned addresses share the same modulo
 
47
 * so that they have the *same* degree of misalignment (so that their alignment
 
48
 * can be fixed by simple peeling), and so in this case force the address
 
49
 * modulo the misalign to be the exact align value.
44
50
 */
45
51
   if (misalign)
46
 
   {
47
 
      if (((size_t)ap->memA)%misalign == 0)
48
 
         ap->memA = ((char*)ap->memA) + align;
49
 
   }
 
52
      ap->memA = (void*)((((size_t)ap->memA)/malign)*malign + malign + align);
50
53
   ap->next = next;
51
54
   return(ap);
52
55
}
117
120
         for (ap=allocQ; ap && ap->memA != ptr; ap = ap->next) prev = ap;
118
121
         if (!ap)
119
122
         {
120
 
            fprintf(stderr, "Couldn't find mem=%ld\nmemQ=\n", ptr);
 
123
            fprintf(stderr, "Couldn't find mem=%ld\nmemQ=\n", (size_t)ptr);
121
124
            for (ap=allocQ; ap; ap = ap->next)
122
 
               fprintf(stderr, "   %ld, %ld\n", ap->memA, ap->mem);
 
125
               fprintf(stderr, "   %ld, %ld\n", (size_t)ap->memA,
 
126
                       (size_t)ap->mem);
123
127
         }
124
128
         assert(ap);
125
129
         if (ap == allocQ)
511
515
   MAy = MAx;
512
516
}
513
517
 
514
 
main(int nargs, char **args)
 
518
int main(int nargs, char **args)
515
519
{
516
520
   int nN, nkflops, cachesize, incX;
517
521
   int *Ns;
519
523
   GetFlags(nargs, args, &nN, &Ns, &nkflops, &cachesize, &fout, &incX);
520
524
   DoTimings(nN, Ns, nkflops, cachesize, fout, incX);
521
525
   free(Ns);
522
 
   exit(0);
 
526
   return(0);
523
527
}