Commit 1cd2f29e authored by Swann Perarnau's avatar Swann Perarnau

[fix] benchmarks too

parent ed58580f
Pipeline #8038 failed with stages
in 21 minutes and 22 seconds
......@@ -21,8 +21,8 @@
#include <math.h>
#include <stdlib.h>
AML_TILING_2D_ROWMAJOR_DECL(tiling_row);
AML_TILING_2D_COLMAJOR_DECL(tiling_col);
struct aml_tiling *tiling_row;
struct aml_tiling *tiling_col;
struct aml_area *slow, *fast;
size_t memsize, tilesize, N, T;
double *a, *b, *c;
......@@ -34,7 +34,7 @@ void do_work()
ldb = lda;
ldc = lda;
size_t ndims[2];
aml_tiling_ndims(&tiling_row, &ndims[0], &ndims[1]);
aml_tiling_ndims(tiling_row, &ndims[0], &ndims[1]);
for(int k = 0; k < ndims[1]; k++)
{
......@@ -45,12 +45,12 @@ void do_work()
{
size_t aoff, boff, coff;
double *ap, *bp, *cp;
aoff = aml_tiling_tileid(&tiling_col, i, k);
boff = aml_tiling_tileid(&tiling_row, k, j);
coff = aml_tiling_tileid(&tiling_row, i, j);
ap = aml_tiling_tilestart(&tiling_col, a, aoff);
bp = aml_tiling_tilestart(&tiling_row, b, boff);
cp = aml_tiling_tilestart(&tiling_row, c, coff);
aoff = aml_tiling_tileid(tiling_col, i, k);
boff = aml_tiling_tileid(tiling_row, k, j);
coff = aml_tiling_tileid(tiling_row, i, j);
ap = aml_tiling_tilestart(tiling_col, a, aoff);
bp = aml_tiling_tilestart(tiling_row, b, boff);
cp = aml_tiling_tilestart(tiling_row, c, coff);
cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, ldc, lda, ldb, 1.0, ap, lda, bp, ldb, 1.0, cp, ldc);
}
}
......@@ -72,10 +72,10 @@ int main(int argc, char* argv[])
tilesize = sizeof(double)*T*T;
/* the initial tiling, of 2D square tiles */
assert(!aml_tiling_2d_init(&tiling_row, AML_TILING_TYPE_2D_ROWMAJOR,
tilesize, memsize, N/T , N/T));
assert(!aml_tiling_2d_init(&tiling_col, AML_TILING_TYPE_2D_COLMAJOR,
tilesize, memsize, N/T , N/T));
assert(!aml_tiling_2d_create(&tiling_row, AML_TILING_TYPE_2D_ROWMAJOR,
tilesize, memsize, N/T , N/T));
assert(!aml_tiling_2d_create(&tiling_col, AML_TILING_TYPE_2D_COLMAJOR,
tilesize, memsize, N/T , N/T));
aml_area_linux_create(&slow, AML_AREA_LINUX_MMAP_FLAG_PRIVATE,
&slowb, AML_AREA_LINUX_BINDING_FLAG_BIND);
......@@ -156,8 +156,8 @@ int main(int argc, char* argv[])
aml_area_munmap(fast, c, memsize);
aml_area_linux_destroy(&slow);
aml_area_linux_destroy(&fast);
aml_tiling_2d_fini(&tiling_row);
aml_tiling_2d_fini(&tiling_col);
aml_tiling_2d_destroy(&tiling_row);
aml_tiling_2d_destroy(&tiling_col);
aml_finalize();
return 0;
}
......@@ -24,11 +24,11 @@
#include <math.h>
#include <stdlib.h>
AML_TILING_2D_ROWMAJOR_DECL(tiling_row);
AML_TILING_2D_COLMAJOR_DECL(tiling_col);
AML_TILING_1D_DECL(tiling_prefetch);
AML_SCRATCH_PAR_DECL(sa);
AML_SCRATCH_PAR_DECL(sb);
struct aml_tiling *tiling_row;
struct aml_tiling *tiling_col;
struct aml_tiling *tiling_prefetch;
struct aml_scratch *sa;
struct aml_scratch *sb;
struct aml_area *slow, *fast;
size_t memsize, tilesize, N, T;
......@@ -45,19 +45,19 @@ void do_work()
int ai, bi, oldai, oldbi;
void *abaseptr, *bbaseptr;
struct aml_scratch_request *ar, *br;
aml_tiling_ndims(&tiling_row, &ndims[0], &ndims[1]);
abaseptr = aml_scratch_baseptr(&sa);
bbaseptr = aml_scratch_baseptr(&sb);
prea = aml_tiling_tilestart(&tiling_prefetch, a, 0);
preb = aml_tiling_tilestart(&tiling_prefetch, b, 0);
aml_tiling_ndims(tiling_row, &ndims[0], &ndims[1]);
abaseptr = aml_scratch_baseptr(sa);
bbaseptr = aml_scratch_baseptr(sb);
prea = aml_tiling_tilestart(tiling_prefetch, a, 0);
preb = aml_tiling_tilestart(tiling_prefetch, b, 0);
ai = -1; bi = -1;
for(int k = 0; k < ndims[1]; k++)
{
oldbi = bi;
oldai = ai;
aml_scratch_async_pull(&sa, &ar, abaseptr, &ai, a, k + 1);
aml_scratch_async_pull(&sb, &br, bbaseptr, &bi, b, k + 1);
aml_scratch_async_pull(sa, &ar, abaseptr, &ai, a, k + 1);
aml_scratch_async_pull(sb, &br, bbaseptr, &bi, b, k + 1);
#pragma omp parallel for
for(int i = 0; i < ndims[0]; i++)
{
......@@ -65,25 +65,25 @@ void do_work()
{
size_t coff;
double *ap, *bp, *cp;
ap = aml_tiling_tilestart(&tiling_row, prea, i);
bp = aml_tiling_tilestart(&tiling_row, preb, j);
coff = aml_tiling_tileid(&tiling_row, i, j);
cp = aml_tiling_tilestart(&tiling_row, c, coff);
ap = aml_tiling_tilestart(tiling_row, prea, i);
bp = aml_tiling_tilestart(tiling_row, preb, j);
coff = aml_tiling_tileid(tiling_row, i, j);
cp = aml_tiling_tilestart(tiling_row, c, coff);
cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, ldc, lda, ldb, 1.0, ap, lda, bp, ldb, 1.0, cp, ldc);
}
}
aml_scratch_wait(&sa, ar);
aml_scratch_wait(&sb, br);
prea = aml_tiling_tilestart(&tiling_prefetch, abaseptr, ai);
preb = aml_tiling_tilestart(&tiling_prefetch, bbaseptr, bi);
aml_scratch_release(&sa, oldai);
aml_scratch_release(&sb, oldbi);
aml_scratch_wait(sa, ar);
aml_scratch_wait(sb, br);
prea = aml_tiling_tilestart(tiling_prefetch, abaseptr, ai);
preb = aml_tiling_tilestart(tiling_prefetch, bbaseptr, bi);
aml_scratch_release(sa, oldai);
aml_scratch_release(sb, oldbi);
}
}
int main(int argc, char* argv[])
{
AML_DMA_LINUX_SEQ_DECL(dma);
struct aml_dma *dma;
struct aml_bitmap slowb, fastb;
aml_init(&argc, &argv);
assert(argc == 5);
......@@ -97,13 +97,13 @@ int main(int argc, char* argv[])
tilesize = sizeof(double)*T*T;
/* the initial tiling, 2d grid of tiles */
assert(!aml_tiling_2d_init(&tiling_row, AML_TILING_TYPE_2D_ROWMAJOR,
tilesize, memsize, N/T , N/T));
assert(!aml_tiling_2d_init(&tiling_col, AML_TILING_TYPE_2D_COLMAJOR,
tilesize, memsize, N/T , N/T));
assert(!aml_tiling_2d_create(&tiling_row, AML_TILING_TYPE_2D_ROWMAJOR,
tilesize, memsize, N/T , N/T));
assert(!aml_tiling_2d_create(&tiling_col, AML_TILING_TYPE_2D_COLMAJOR,
tilesize, memsize, N/T , N/T));
/* the prefetch tiling, 1D sequence of columns of tiles */
assert(!aml_tiling_1d_init(&tiling_prefetch,
tilesize*(N/T), memsize));
assert(!aml_tiling_1d_create(&tiling_prefetch,
tilesize*(N/T), memsize));
aml_area_linux_create(&slow, AML_AREA_LINUX_MMAP_FLAG_PRIVATE,
&slowb, AML_AREA_LINUX_BINDING_FLAG_BIND);
......@@ -112,9 +112,9 @@ int main(int argc, char* argv[])
&fastb, AML_AREA_LINUX_BINDING_FLAG_BIND);
assert(fast != NULL);
assert(!aml_dma_linux_seq_init(&dma, 2));
assert(!aml_scratch_par_init(&sa, &fast, &slow, &dma, &tiling_prefetch, (size_t)2, (size_t)2));
assert(!aml_scratch_par_init(&sb, &fast, &slow, &dma, &tiling_prefetch, (size_t)2, (size_t)2));
assert(!aml_dma_linux_seq_create(&dma, 2));
assert(!aml_scratch_par_create(&sa, fast, slow, dma, tiling_prefetch, (size_t)2, (size_t)2));
assert(!aml_scratch_par_create(&sb, fast, slow, dma, tiling_prefetch, (size_t)2, (size_t)2));
/* allocation */
a = aml_area_mmap(slow, NULL, memsize);
b = aml_area_mmap(slow, NULL, memsize);
......@@ -182,17 +182,17 @@ int main(int argc, char* argv[])
/* print the flops in GFLOPS */
printf("dgemm-prefetch: %llu %lld %lld %f\n", N, memsize, time,
flops/1e9);
aml_scratch_par_fini(&sa);
aml_scratch_par_fini(&sb);
aml_dma_linux_seq_fini(&dma);
aml_scratch_par_destroy(&sa);
aml_scratch_par_destroy(&sb);
aml_dma_linux_seq_destroy(&dma);
aml_area_munmap(slow, a, memsize);
aml_area_munmap(slow, b, memsize);
aml_area_munmap(fast, c, memsize);
aml_area_linux_destroy(&slow);
aml_area_linux_destroy(&fast);
aml_tiling_2d_fini(&tiling_row);
aml_tiling_2d_fini(&tiling_col);
aml_tiling_1d_fini(&tiling_prefetch);
aml_tiling_2d_destroy(&tiling_row);
aml_tiling_2d_destroy(&tiling_col);
aml_tiling_1d_destroy(&tiling_prefetch);
aml_finalize();
return 0;
}
......@@ -38,8 +38,8 @@ int main(int argc, char *argv[])
*/
struct aml_area *slow = &aml_area_linux, *fast = aml_area_linux;
struct aml_dma dma;
assert(!aml_dma_init(&dma, 0));
struct aml_dma *dma;
assert(!aml_dma_create(&dma, 0));
void *a, *b, *c;
......@@ -75,19 +75,19 @@ int main(int argc, char *argv[])
{
for(unsigned long i = 0; i < numthreads*CHUNKING; i++) {
#pragma omp task depend(inout: wa[i*esz:esz])
assert(!aml_dma_move(&dma, &fast, &slow, &wa[i*esz], esz));
assert(!aml_dma_move(dma, &fast, &slow, &wa[i*esz], esz));
#pragma omp task depend(inout: wb[i*esz:esz])
assert(!aml_dma_move(&dma, &fast, &slow, &wb[i*esz], esz));
assert(!aml_dma_move(dma, &fast, &slow, &wb[i*esz], esz));
#pragma omp task depend(inout: wc[i*esz:esz])
assert(!aml_dma_move(&dma, &fast, &slow, &wc[i*esz], esz));
assert(!aml_dma_move(dma, &fast, &slow, &wc[i*esz], esz));
#pragma omp task depend(in: wa[i*esz:esz], wb[i*esz:esz]) depend(out: wc[i*esz:esz])
kernel(&wa[i*esz], &wb[i*esz], &wc[i*esz], esz);
#pragma omp task depend(inout: wa[i*esz:esz])
assert(!aml_dma_move(&dma, &slow, &fast, &wa[i*esz], esz));
assert(!aml_dma_move(dma, &slow, &fast, &wa[i*esz], esz));
#pragma omp task depend(inout: wb[i*esz:esz])
assert(!aml_dma_move(&dma, &slow, &fast, &wb[i*esz], esz));
assert(!aml_dma_move(dma, &slow, &fast, &wb[i*esz], esz));
#pragma omp task depend(inout: wc[i*esz:esz])
assert(!aml_dma_move(&dma, &slow, &fast, &wc[i*esz], esz));
assert(!aml_dma_move(dma, &slow, &fast, &wc[i*esz], esz));
}
}
......
......@@ -27,10 +27,10 @@
size_t numthreads, tilesz, esz;
unsigned long *a, *b, *c;
AML_TILING_1D_DECL(tiling);
struct aml_tiling *tiling;
struct aml_area *slow, *fast;
AML_SCRATCH_SEQ_DECL(sa);
AML_SCRATCH_SEQ_DECL(sb);
struct aml_scratch *sa;
struct aml_scratch *sb;
int kernel(unsigned long *a, unsigned long *b, unsigned long *c, size_t n)
{
......@@ -42,7 +42,7 @@ int kernel(unsigned long *a, unsigned long *b, unsigned long *c, size_t n)
int main(int argc, char *argv[])
{
AML_DMA_LINUX_PAR_DECL(dma);
struct aml_dma *dma;
struct aml_bitmap slowb, fastb;
aml_init(&argc, &argv);
assert(argc == 4);
......@@ -63,17 +63,17 @@ int main(int argc, char *argv[])
}
/* initialize all the supporting struct */
assert(!aml_tiling_1d_init(&tiling, tilesz, memsize));
assert(!aml_tiling_1d_create(&tiling, tilesz, memsize));
aml_area_linux_create(&slow, AML_AREA_LINUX_MMAP_FLAG_PRIVATE,
&slowb, AML_AREA_LINUX_BINDING_FLAG_BIND);
assert(slow != NULL);
aml_area_linux_create(&fast, AML_AREA_LINUX_MMAP_FLAG_PRIVATE,
&fastb, AML_AREA_LINUX_BINDING_FLAG_BIND);
assert(fast != NULL);
assert(!aml_dma_linux_par_init(&dma, numthreads*2, numthreads));
assert(!aml_scratch_seq_init(&sa, &fast, &slow, &dma, &tiling,
assert(!aml_dma_linux_par_create(&dma, numthreads*2, numthreads));
assert(!aml_scratch_seq_create(&sa, &fast, &slow, dma, tiling,
(size_t)2*numthreads, (size_t)1));
assert(!aml_scratch_seq_init(&sb, &fast, &slow, &dma, &tiling,
assert(!aml_scratch_seq_create(&sb, &fast, &slow, dma, tiling,
(size_t)2*numthreads, (size_t)1));
/* allocation */
......@@ -93,23 +93,23 @@ int main(int argc, char *argv[])
int i, ai, bi, oldai, oldbi;
unsigned long *ap, *bp;
void *abaseptr, *bbaseptr;
ap = aml_tiling_tilestart(&tiling, a, 0);
bp = aml_tiling_tilestart(&tiling, b, 0);
abaseptr = aml_scratch_baseptr(&sa);
bbaseptr = aml_scratch_baseptr(&sb);
ap = aml_tiling_tilestart(tiling, a, 0);
bp = aml_tiling_tilestart(tiling, b, 0);
abaseptr = aml_scratch_baseptr(sa);
bbaseptr = aml_scratch_baseptr(sb);
ai = -1; bi = -1;
for(i = 0; i < (memsize/tilesz) -1; i++) {
struct aml_scratch_request *ar, *br;
oldai = ai; oldbi = bi;
aml_scratch_async_pull(&sa, &ar, abaseptr, &ai, a, i+1);
aml_scratch_async_pull(&sb, &br, bbaseptr, &bi, b, i+1);
aml_scratch_async_pull(sa, &ar, abaseptr, &ai, a, i+1);
aml_scratch_async_pull(sb, &br, bbaseptr, &bi, b, i+1);
kernel(ap, bp, &c[i*esz], esz);
aml_scratch_wait(&sa, ar);
aml_scratch_wait(&sb, br);
ap = aml_tiling_tilestart(&tiling, abaseptr, ai);
bp = aml_tiling_tilestart(&tiling, bbaseptr, bi);
aml_scratch_release(&sa, oldai);
aml_scratch_release(&sb, oldbi);
aml_scratch_wait(sa, ar);
aml_scratch_wait(sb, br);
ap = aml_tiling_tilestart(tiling, abaseptr, ai);
bp = aml_tiling_tilestart(tiling, bbaseptr, bi);
aml_scratch_release(sa, oldai);
aml_scratch_release(sb, oldbi);
}
kernel(ap, bp, &c[i*esz], esz);
......@@ -118,15 +118,15 @@ int main(int argc, char *argv[])
assert(c[i] == esize);
}
aml_scratch_seq_fini(&sa);
aml_scratch_seq_fini(&sb);
aml_dma_linux_par_fini(&dma);
aml_scratch_seq_destroy(&sa);
aml_scratch_seq_destroy(&sb);
aml_dma_linux_par_destroy(&dma);
aml_area_munmap(slow, a, memsize);
aml_area_munmap(slow, b, memsize);
aml_area_munmap(fast, c, memsize);
aml_area_linux_destroy(&slow);
aml_area_linux_destroy(&fast);
aml_tiling_1d_fini(&tiling);
aml_tiling_1d_destroy(&tiling);
aml_finalize();
return 0;
}
......@@ -26,10 +26,10 @@
size_t numthreads, tilesz, esz;
unsigned long *a, *b, *c;
AML_TILING_1D_DECL(tiling);
struct aml_tiling *tiling;
struct aml_area *slow, *fast;
AML_SCRATCH_PAR_DECL(sa);
AML_SCRATCH_PAR_DECL(sb);
struct aml_scratch *sa;
struct aml_scratch *sb;
int kernel(unsigned long *a, unsigned long *b, unsigned long *c, size_t n)
{
......@@ -47,32 +47,32 @@ void do_work(unsigned long tid)
unsigned long *ap, *bp, *cp;
void *abaseptr, *bbaseptr;
offset = tid*CHUNKING;
ap = aml_tiling_tilestart(&tiling, a, offset);
bp = aml_tiling_tilestart(&tiling, b, offset);
cp = aml_tiling_tilestart(&tiling, c, offset);
abaseptr = aml_scratch_baseptr(&sa);
bbaseptr = aml_scratch_baseptr(&sb);
ap = aml_tiling_tilestart(tiling, a, offset);
bp = aml_tiling_tilestart(tiling, b, offset);
cp = aml_tiling_tilestart(tiling, c, offset);
abaseptr = aml_scratch_baseptr(sa);
bbaseptr = aml_scratch_baseptr(sb);
ai = -1; bi = -1;
for(i = 0; i < CHUNKING-1; i++) {
struct aml_scratch_request *ar, *br;
oldai = ai; oldbi = bi;
aml_scratch_async_pull(&sa, &ar, abaseptr, &ai, a, offset+i+1);
aml_scratch_async_pull(&sb, &br, bbaseptr, &bi, b, offset+i+1);
aml_scratch_async_pull(sa, &ar, abaseptr, &ai, a, offset+i+1);
aml_scratch_async_pull(sb, &br, bbaseptr, &bi, b, offset+i+1);
kernel(ap, bp, cp, esz);
aml_scratch_wait(&sa, ar);
aml_scratch_wait(&sb, br);
ap = aml_tiling_tilestart(&tiling, abaseptr, ai);
bp = aml_tiling_tilestart(&tiling, bbaseptr, bi);
cp = aml_tiling_tilestart(&tiling, c, offset+i+1);
aml_scratch_release(&sa, oldai);
aml_scratch_release(&sb, oldbi);
aml_scratch_wait(sa, ar);
aml_scratch_wait(sb, br);
ap = aml_tiling_tilestart(tiling, abaseptr, ai);
bp = aml_tiling_tilestart(tiling, bbaseptr, bi);
cp = aml_tiling_tilestart(tiling, c, offset+i+1);
aml_scratch_release(sa, oldai);
aml_scratch_release(sb, oldbi);
}
kernel(ap, bp, cp, esz);
}
int main(int argc, char *argv[])
{
AML_DMA_LINUX_SEQ_DECL(dma);
struct aml_dma *dma;
struct aml_bitmap slowb, fastb;
aml_init(&argc, &argv);
assert(argc == 4);
......@@ -93,7 +93,7 @@ int main(int argc, char *argv[])
}
/* initialize all the supporting struct */
assert(!aml_tiling_1d_init(&tiling, tilesz, memsize));
assert(!aml_tiling_1d_create(&tiling, tilesz, memsize));
aml_area_linux_create(&slow, AML_AREA_LINUX_MMAP_FLAG_PRIVATE,
&slowb, AML_AREA_LINUX_BINDING_FLAG_BIND);
......@@ -101,10 +101,10 @@ int main(int argc, char *argv[])
aml_area_linux_create(&fast, AML_AREA_LINUX_MMAP_FLAG_PRIVATE,
&fastb, AML_AREA_LINUX_BINDING_FLAG_BIND);
assert(fast != NULL);
assert(!aml_dma_linux_seq_init(&dma, numthreads*2));
assert(!aml_scratch_par_init(&sa, &fast, &slow, &dma, &tiling,
assert(!aml_dma_linux_seq_create(&dma, numthreads*2));
assert(!aml_scratch_par_create(&sa, &fast, &slow, &dma, &tiling,
2*numthreads, numthreads));
assert(!aml_scratch_par_init(&sb, &fast, &slow, &dma, &tiling,
assert(!aml_scratch_par_create(&sb, &fast, &slow, &dma, &tiling,
2*numthreads, numthreads));
/* allocation */
......@@ -131,15 +131,15 @@ int main(int argc, char *argv[])
assert(c[i] == esize);
}
aml_scratch_par_fini(&sa);
aml_scratch_par_fini(&sb);
aml_dma_linux_seq_fini(&dma);
aml_scratch_par_destroy(&sa);
aml_scratch_par_destroy(&sb);
aml_dma_linux_seq_destroy(&dma);
aml_area_munmap(slow, a, memsize);
aml_area_munmap(slow, b, memsize);
aml_area_munmap(fast, c, memsize);
aml_area_linux_destroy(&slow);
aml_area_linux_destroy(&fast);
aml_tiling_1d_fini(&tiling);
aml_tiling_1d_destroy(&tiling);
aml_finalize();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment