20template<
typename T,
typename I>
23 T ** array =
new T*[m];
24 for(I i = 0; i<m; ++i)
28template<
typename T,
typename I>
31 for(I i = 0; i<m; ++i)
47template <
int D,
typename T>
48void saxpy(T a, T * __restrict b, T * __restrict c)
50 for(
int i=0; i<
D; ++i)
56template <
int D,
typename T>
57void saxpy_array(T a, tr1::array<T,D> & b, tr1::array<T,D> & c)
59 for(
int i=0; i<
D; ++i)
77 int ** __restrict xx = allocate2D<int>(
ITER,
BETA);
78 int ** __restrict yy = allocate2D<int>(
ITER,
BETA);
80 for (
int i=0; i<
ITER; ++i)
82 for (
int j=0; j<
BETA; ++j)
91 tr1::array<int,BETA> * b =
new tr1::array<int,BETA>[
ITER];
92 tr1::array<int,BETA> * c =
new tr1::array<int,BETA>[
ITER]();
96 gettimeofday(&tim, NULL);
97 double t1=tim.tv_sec+(tim.tv_usec/1000000.0);
100 int * __restrict xxx = xx[index];
101 int * __restrict yyy = yy[index];
103 for(
int i=0; i<
ITER; ++i)
105 saxpy<BETA>(a, xxx, yyy);
108 gettimeofday(&tim, NULL);
109 double t2=tim.tv_sec+(tim.tv_usec/1000000.0);
110 printf(
"%.6lf seconds elapsed for gcc vector extensions\n", t2-t1);
112 copy(yy[0], yy[0]+
BETA, ostream_iterator<float>( cout,
" "));
void saxpy_array(T a, tr1::array< T, D > &b, tr1::array< T, D > &c)
void deallocate2D(T **array, I m)
T ** allocate2D(I m, I n)
void saxpy(T a, T *__restrict b, T *__restrict c)