Commit 4d0fa3d6 authored by Nicolas Denoyelle's avatar Nicolas Denoyelle Committed by Swann Perarnau
Browse files

[refactor] redesign areas

parent 36bc84c1
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
SUBDIRS = jemalloc src include tests SUBDIRS = src include tests
if ADD_BENCHMARKS if ADD_BENCHMARKS
SUBDIRS += benchmarks SUBDIRS += benchmarks
...@@ -8,12 +8,4 @@ endif ...@@ -8,12 +8,4 @@ endif
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = aml.pc pkgconfig_DATA = aml.pc
# remove jemalloc tests from make check
check-recursive:
$(MAKE) -C tests check
install-recursive:
$(MAKE) -C src install
$(MAKE) install-am
EXTRA_DIST = autogen.sh aml.pc README.markdown EXTRA_DIST = autogen.sh aml.pc README.markdown
#!/bin/sh #!/bin/sh
set -ex set -ex
# jemalloc
(cd jemalloc; ./autogen.sh)
# aml # aml
mkdir -p build-aux mkdir -p build-aux
aclocal -I m4 aclocal -I m4
autoheader autoreconf -fi
libtoolize
automake --add-missing --copy
autoconf
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
*******************************************************************************/ *******************************************************************************/
#include "aml.h" #include "aml.h"
#include "aml/area/linux.h"
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <mkl.h> #include <mkl.h>
...@@ -22,35 +23,27 @@ ...@@ -22,35 +23,27 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
AML_ARENA_JEMALLOC_DECL(arns); struct aml_area *slow, *fast;
AML_ARENA_JEMALLOC_DECL(arnf); struct aml_bitmap slowb, fastb;
AML_AREA_LINUX_DECL(slow);
AML_AREA_LINUX_DECL(fast);
struct bitmask *slowb, *fastb;
struct timespec start, stop; struct timespec start, stop;
double *a, *b, *c; double *a, *b, *c;
aml_init(&argc, &argv); aml_init(&argc, &argv);
assert(argc == 4); assert(argc == 4);
fastb = numa_parse_nodestring_all(argv[1]); assert(aml_bitmap_from_string(&fastb, argv[1]) == 0);
slowb = numa_parse_nodestring_all(argv[2]); assert(aml_bitmap_from_string(&slowb, argv[2]) == 0);
long int N = atol(argv[3]); long int N = atol(argv[3]);
unsigned long memsize = sizeof(double)*N*N; unsigned long memsize = sizeof(double)*N*N;
assert(!aml_arena_jemalloc_init(&arns, AML_ARENA_JEMALLOC_TYPE_REGULAR)); slow = aml_area_linux_create(AML_AREA_LINUX_MMAP_FLAG_PRIVATE,
assert(!aml_area_linux_init(&slow, &slowb, AML_AREA_LINUX_BINDING_FLAG_BIND);
AML_AREA_LINUX_MANAGER_TYPE_SINGLE, assert(slow != NULL);
AML_AREA_LINUX_MBIND_TYPE_REGULAR, fast = aml_area_linux_create(AML_AREA_LINUX_MMAP_FLAG_PRIVATE,
AML_AREA_LINUX_MMAP_TYPE_ANONYMOUS, &fastb, AML_AREA_LINUX_BINDING_FLAG_BIND);
&arns, MPOL_BIND, slowb->maskp)); assert(fast != NULL);
assert(!aml_arena_jemalloc_init(&arnf, AML_ARENA_JEMALLOC_TYPE_REGULAR));
assert(!aml_area_linux_init(&fast, a = aml_area_mmap(slow, NULL, memsize);
AML_AREA_LINUX_MANAGER_TYPE_SINGLE, b = aml_area_mmap(slow, NULL, memsize);
AML_AREA_LINUX_MBIND_TYPE_REGULAR, c = aml_area_mmap(fast, NULL, memsize);
AML_AREA_LINUX_MMAP_TYPE_ANONYMOUS,
&arnf, MPOL_BIND, fastb->maskp));
a = aml_area_malloc(&slow, memsize);
b = aml_area_malloc(&slow, memsize);
c = aml_area_malloc(&fast, memsize);
assert(a != NULL && b != NULL && c != NULL); assert(a != NULL && b != NULL && c != NULL);
double alpha = 1.0, beta = 1.0; double alpha = 1.0, beta = 1.0;
...@@ -69,11 +62,11 @@ int main(int argc, char *argv[]) ...@@ -69,11 +62,11 @@ int main(int argc, char *argv[])
double flops = (2.0*N*N*N)/(time/1e9); double flops = (2.0*N*N*N)/(time/1e9);
/* print the flops in GFLOPS */ /* print the flops in GFLOPS */
printf("dgemm-mkl: %llu %lld %lld %f\n", N, memsize, time, flops/1e9); printf("dgemm-mkl: %llu %lld %lld %f\n", N, memsize, time, flops/1e9);
aml_area_free(&slow, a); aml_area_munmap(slow, a, memsize);
aml_area_free(&slow, b); aml_area_munmap(slow, b, memsize);
aml_area_free(&fast, c); aml_area_munmap(fast, c, memsize);
aml_area_linux_destroy(&slow); aml_area_linux_destroy(slow);
aml_area_linux_destroy(&fast); aml_area_linux_destroy(fast);
aml_finalize(); aml_finalize();
return 0; return 0;
} }
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
*******************************************************************************/ *******************************************************************************/
#include "aml.h" #include "aml.h"
#include "aml/area/linux.h"
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <mkl.h> #include <mkl.h>
...@@ -21,9 +22,7 @@ ...@@ -21,9 +22,7 @@
AML_TILING_2D_ROWMAJOR_DECL(tiling_row); AML_TILING_2D_ROWMAJOR_DECL(tiling_row);
AML_TILING_2D_COLMAJOR_DECL(tiling_col); AML_TILING_2D_COLMAJOR_DECL(tiling_col);
AML_AREA_LINUX_DECL(slow); struct aml_area *slow, *fast;
AML_AREA_LINUX_DECL(fast);
size_t memsize, tilesize, N, T; size_t memsize, tilesize, N, T;
double *a, *b, *c; double *a, *b, *c;
struct timespec start, stop; struct timespec start, stop;
...@@ -59,13 +58,11 @@ void do_work() ...@@ -59,13 +58,11 @@ void do_work()
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
AML_ARENA_JEMALLOC_DECL(arns); struct aml_bitmap slowb, fastb;
AML_ARENA_JEMALLOC_DECL(arnf);
struct bitmask *slowb, *fastb;
aml_init(&argc, &argv); aml_init(&argc, &argv);
assert(argc == 5); assert(argc == 5);
fastb = numa_parse_nodestring_all(argv[1]); assert(aml_bitmap_from_string(&fastb, argv[1]) == 0);
slowb = numa_parse_nodestring_all(argv[2]); assert(aml_bitmap_from_string(&slowb, argv[2]) == 0);
N = atol(argv[3]); N = atol(argv[3]);
T = atol(argv[4]); T = atol(argv[4]);
/* let's not handle messy tile sizes */ /* let's not handle messy tile sizes */
...@@ -79,22 +76,17 @@ int main(int argc, char* argv[]) ...@@ -79,22 +76,17 @@ int main(int argc, char* argv[])
assert(!aml_tiling_init(&tiling_col, AML_TILING_TYPE_2D_COLMAJOR, assert(!aml_tiling_init(&tiling_col, AML_TILING_TYPE_2D_COLMAJOR,
tilesize, memsize, N/T , N/T)); tilesize, memsize, N/T , N/T));
assert(!aml_arena_jemalloc_init(&arns, AML_ARENA_JEMALLOC_TYPE_REGULAR)); slow = aml_area_linux_create(AML_AREA_LINUX_MMAP_FLAG_PRIVATE,
assert(!aml_area_linux_init(&slow, &slowb, AML_AREA_LINUX_BINDING_FLAG_BIND);
AML_AREA_LINUX_MANAGER_TYPE_SINGLE, assert(slow != NULL);
AML_AREA_LINUX_MBIND_TYPE_REGULAR, fast = aml_area_linux_create(AML_AREA_LINUX_MMAP_FLAG_PRIVATE,
AML_AREA_LINUX_MMAP_TYPE_ANONYMOUS, &fastb, AML_AREA_LINUX_BINDING_FLAG_BIND);
&arns, MPOL_BIND, slowb->maskp)); assert(fast != NULL);
assert(!aml_arena_jemalloc_init(&arnf, AML_ARENA_JEMALLOC_TYPE_REGULAR));
assert(!aml_area_linux_init(&fast,
AML_AREA_LINUX_MANAGER_TYPE_SINGLE,
AML_AREA_LINUX_MBIND_TYPE_REGULAR,
AML_AREA_LINUX_MMAP_TYPE_ANONYMOUS,
&arnf, MPOL_BIND, fastb->maskp));
/* allocation */ /* allocation */
a = aml_area_malloc(&slow, memsize); a = aml_area_mmap(slow, NULL, memsize);
b = aml_area_malloc(&slow, memsize); b = aml_area_mmap(slow, NULL, memsize);
c = aml_area_malloc(&fast, memsize); c = aml_area_mmap(fast, NULL, memsize);
assert(a != NULL && b != NULL && c != NULL); assert(a != NULL && b != NULL && c != NULL);
size_t ntilerows, ntilecols, tilerowsize, tilecolsize, rowsize, colsize; size_t ntilerows, ntilecols, tilerowsize, tilecolsize, rowsize, colsize;
...@@ -158,11 +150,11 @@ int main(int argc, char* argv[]) ...@@ -158,11 +150,11 @@ int main(int argc, char* argv[])
/* print the flops in GFLOPS */ /* print the flops in GFLOPS */
printf("dgemm-noprefetch: %llu %lld %lld %f\n", N, memsize, time, printf("dgemm-noprefetch: %llu %lld %lld %f\n", N, memsize, time,
flops/1e9); flops/1e9);
aml_area_free(&slow, a); aml_area_munmap(slow, a, memsize);
aml_area_free(&slow, b); aml_area_munmap(slow, b, memsize);
aml_area_free(&fast, c); aml_area_munmap(fast, c, memsize);
aml_area_linux_destroy(&slow); aml_area_linux_destroy(slow);
aml_area_linux_destroy(&fast); aml_area_linux_destroy(fast);
aml_tiling_destroy(&tiling_row, AML_TILING_TYPE_2D_ROWMAJOR); aml_tiling_destroy(&tiling_row, AML_TILING_TYPE_2D_ROWMAJOR);
aml_tiling_destroy(&tiling_col, AML_TILING_TYPE_2D_ROWMAJOR); aml_tiling_destroy(&tiling_col, AML_TILING_TYPE_2D_ROWMAJOR);
aml_finalize(); aml_finalize();
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
*******************************************************************************/ *******************************************************************************/
#include "aml.h" #include "aml.h"
#include "aml/area/linux.h"
#include "aml/dma/linux-seq.h" #include "aml/dma/linux-seq.h"
#include "aml/scratch/par.h" #include "aml/scratch/par.h"
#include <assert.h> #include <assert.h>
...@@ -24,11 +25,10 @@ ...@@ -24,11 +25,10 @@
AML_TILING_2D_ROWMAJOR_DECL(tiling_row); AML_TILING_2D_ROWMAJOR_DECL(tiling_row);
AML_TILING_2D_COLMAJOR_DECL(tiling_col); AML_TILING_2D_COLMAJOR_DECL(tiling_col);
AML_TILING_1D_DECL(tiling_prefetch); AML_TILING_1D_DECL(tiling_prefetch);
AML_AREA_LINUX_DECL(slow);
AML_AREA_LINUX_DECL(fast);
AML_SCRATCH_PAR_DECL(sa); AML_SCRATCH_PAR_DECL(sa);
AML_SCRATCH_PAR_DECL(sb); AML_SCRATCH_PAR_DECL(sb);
struct aml_area *slow, *fast;
size_t memsize, tilesize, N, T; size_t memsize, tilesize, N, T;
double *a, *b, *c; double *a, *b, *c;
struct timespec start, stop; struct timespec start, stop;
...@@ -81,14 +81,12 @@ void do_work() ...@@ -81,14 +81,12 @@ void do_work()
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
AML_ARENA_JEMALLOC_DECL(arns);
AML_ARENA_JEMALLOC_DECL(arnf);
AML_DMA_LINUX_SEQ_DECL(dma); AML_DMA_LINUX_SEQ_DECL(dma);
struct bitmask *slowb, *fastb; struct aml_bitmap slowb, fastb;
aml_init(&argc, &argv); aml_init(&argc, &argv);
assert(argc == 5); assert(argc == 5);
fastb = numa_parse_nodestring_all(argv[1]); assert(aml_bitmap_from_string(&fastb, argv[1]) == 0);
slowb = numa_parse_nodestring_all(argv[2]); assert(aml_bitmap_from_string(&slowb, argv[2]) == 0);
N = atol(argv[3]); N = atol(argv[3]);
T = atol(argv[4]); T = atol(argv[4]);
/* let's not handle messy tile sizes */ /* let's not handle messy tile sizes */
...@@ -105,25 +103,20 @@ int main(int argc, char* argv[]) ...@@ -105,25 +103,20 @@ int main(int argc, char* argv[])
assert(!aml_tiling_init(&tiling_prefetch, AML_TILING_TYPE_1D, assert(!aml_tiling_init(&tiling_prefetch, AML_TILING_TYPE_1D,
tilesize*(N/T), memsize)); tilesize*(N/T), memsize));
assert(!aml_arena_jemalloc_init(&arns, AML_ARENA_JEMALLOC_TYPE_REGULAR)); slow = aml_area_linux_create(AML_AREA_LINUX_MMAP_FLAG_PRIVATE,
assert(!aml_area_linux_init(&slow, &slowb, AML_AREA_LINUX_BINDING_FLAG_BIND);
AML_AREA_LINUX_MANAGER_TYPE_SINGLE, assert(slow != NULL);
AML_AREA_LINUX_MBIND_TYPE_REGULAR, fast = aml_area_linux_create(AML_AREA_LINUX_MMAP_FLAG_PRIVATE,
AML_AREA_LINUX_MMAP_TYPE_ANONYMOUS, &fastb, AML_AREA_LINUX_BINDING_FLAG_BIND);
&arns, MPOL_BIND, slowb->maskp)); assert(fast != NULL);
assert(!aml_arena_jemalloc_init(&arnf, AML_ARENA_JEMALLOC_TYPE_REGULAR));
assert(!aml_area_linux_init(&fast,
AML_AREA_LINUX_MANAGER_TYPE_SINGLE,
AML_AREA_LINUX_MBIND_TYPE_REGULAR,
AML_AREA_LINUX_MMAP_TYPE_ANONYMOUS,
&arnf, MPOL_BIND, fastb->maskp));
assert(!aml_dma_linux_seq_init(&dma, 2)); 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(&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_scratch_par_init(&sb, &fast, &slow, &dma, &tiling_prefetch, (size_t)2, (size_t)2));
/* allocation */ /* allocation */
a = aml_area_malloc(&slow, memsize); a = aml_area_mmap(slow, NULL, memsize);
b = aml_area_malloc(&slow, memsize); b = aml_area_mmap(slow, NULL, memsize);
c = aml_area_malloc(&fast, memsize); c = aml_area_mmap(fast, NULL, memsize);
assert(a != NULL && b != NULL && c != NULL); assert(a != NULL && b != NULL && c != NULL);
size_t ntilerows, ntilecols, tilerowsize, tilecolsize, rowsize, colsize; size_t ntilerows, ntilecols, tilerowsize, tilecolsize, rowsize, colsize;
...@@ -190,11 +183,11 @@ int main(int argc, char* argv[]) ...@@ -190,11 +183,11 @@ int main(int argc, char* argv[])
aml_scratch_par_destroy(&sa); aml_scratch_par_destroy(&sa);
aml_scratch_par_destroy(&sb); aml_scratch_par_destroy(&sb);
aml_dma_linux_seq_destroy(&dma); aml_dma_linux_seq_destroy(&dma);
aml_area_free(&slow, a); aml_area_munmap(slow, a, memsize);
aml_area_free(&slow, b); aml_area_munmap(slow, b, memsize);
aml_area_free(&fast, c); aml_area_munmap(fast, c, memsize);
aml_area_linux_destroy(&slow); aml_area_linux_destroy(slow);
aml_area_linux_destroy(&fast); aml_area_linux_destroy(fast);
aml_tiling_destroy(&tiling_row, AML_TILING_TYPE_2D_ROWMAJOR); aml_tiling_destroy(&tiling_row, AML_TILING_TYPE_2D_ROWMAJOR);
aml_tiling_destroy(&tiling_col, AML_TILING_TYPE_2D_ROWMAJOR); aml_tiling_destroy(&tiling_col, AML_TILING_TYPE_2D_ROWMAJOR);
aml_tiling_destroy(&tiling_prefetch, AML_TILING_TYPE_1D); aml_tiling_destroy(&tiling_prefetch, AML_TILING_TYPE_1D);
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <errno.h> #include <errno.h>
#include <omp.h> #include <omp.h>
#include "aml.h" #include "aml.h"
#include "aml/area/linux.h"
#include <stdlib.h> #include <stdlib.h>
#define ITER 10 #define ITER 10
...@@ -35,10 +36,7 @@ int main(int argc, char *argv[]) ...@@ -35,10 +36,7 @@ int main(int argc, char *argv[])
/* we want to back our array on the slow node and use the fast node as /* we want to back our array on the slow node and use the fast node as
* a faster buffer. * a faster buffer.
*/ */
struct aml_area slow, fast; struct aml_area *slow = &aml_area_linux, *fast = aml_area_linux;
int type = AML_AREA_TYPE_REGULAR;
assert(!aml_area_from_nodestring(&slow, type, "all"));
assert(!aml_area_from_nodestring(&fast, type, "all"));
struct aml_dma dma; struct aml_dma dma;
assert(!aml_dma_init(&dma, 0)); assert(!aml_dma_init(&dma, 0));
...@@ -55,9 +53,9 @@ int main(int argc, char *argv[]) ...@@ -55,9 +53,9 @@ int main(int argc, char *argv[])
chunk_msz = MEMSIZE/(numthreads*CHUNKING); chunk_msz = MEMSIZE/(numthreads*CHUNKING);
esz = chunk_msz/sizeof(unsigned long); esz = chunk_msz/sizeof(unsigned long);
} }
a = aml_area_malloc(&slow, MEMSIZE); a = aml_area_mmap(slow, NULL, MEMSIZE);
b = aml_area_malloc(&slow, MEMSIZE); b = aml_area_mmap(slow, NULL, MEMSIZE);
c = aml_area_malloc(&slow, MEMSIZE); c = aml_area_mmap(fast, NULL, MEMSIZE);
assert(a != NULL && b != NULL && c != NULL); assert(a != NULL && b != NULL && c != NULL);
/* create virtually accessible address range, backed by slow memory */ /* create virtually accessible address range, backed by slow memory */
...@@ -98,11 +96,9 @@ int main(int argc, char *argv[]) ...@@ -98,11 +96,9 @@ int main(int argc, char *argv[])
assert(wc[i] == esize); assert(wc[i] == esize);
} }
aml_area_free(&slow, a); aml_area_munmap(slow, a, MEMSIZE);
aml_area_free(&slow, b); aml_area_munmap(slow, b, MEMSIZE);
aml_area_free(&slow, c); aml_area_munmap(fast, c, MEMSIZE);
aml_area_destroy(&slow);
aml_area_destroy(&fast);
aml_dma_destroy(&dma); aml_dma_destroy(&dma);
aml_finalize(); aml_finalize();
return 0; return 0;
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
*******************************************************************************/ *******************************************************************************/
#include "aml.h" #include "aml.h"
#include "aml/area/linux.h"
#include "aml/dma/linux-par.h" #include "aml/dma/linux-par.h"
#include "aml/scratch/seq.h" #include "aml/scratch/seq.h"
#include <assert.h> #include <assert.h>
...@@ -26,8 +27,7 @@ ...@@ -26,8 +27,7 @@
size_t numthreads, tilesz, esz; size_t numthreads, tilesz, esz;
unsigned long *a, *b, *c; unsigned long *a, *b, *c;
AML_TILING_1D_DECL(tiling); AML_TILING_1D_DECL(tiling);
AML_AREA_LINUX_DECL(slow); struct aml_area *slow, *fast;
AML_AREA_LINUX_DECL(fast);
AML_SCRATCH_SEQ_DECL(sa); AML_SCRATCH_SEQ_DECL(sa);
AML_SCRATCH_SEQ_DECL(sb); AML_SCRATCH_SEQ_DECL(sb);
...@@ -41,16 +41,14 @@ int kernel(unsigned long *a, unsigned long *b, unsigned long *c, size_t n) ...@@ -41,16 +41,14 @@ int kernel(unsigned long *a, unsigned long *b, unsigned long *c, size_t n)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
AML_ARENA_JEMALLOC_DECL(arns);
AML_ARENA_JEMALLOC_DECL(arnf);
AML_DMA_LINUX_PAR_DECL(dma); AML_DMA_LINUX_PAR_DECL(dma);
struct bitmask *slowb, *fastb; struct aml_bitmap slowb, fastb;
aml_init(&argc, &argv); aml_init(&argc, &argv);
assert(argc == 4); assert(argc == 4);
log_init(argv[0]); log_init(argv[0]);
fastb = numa_parse_nodestring_all(argv[1]); assert(aml_bitmap_from_string(&fastb, argv[1]) == 0);
slowb = numa_parse_nodestring_all(argv[2]); assert(aml_bitmap_from_string(&slowb, argv[2]) == 0);
unsigned long memsize = 1UL << atoi(argv[3]); unsigned long memsize = 1UL << atoi(argv[3]);
/* use openmp env to figure out how many threads we want /* use openmp env to figure out how many threads we want
...@@ -65,19 +63,12 @@ int main(int argc, char *argv[]) ...@@ -65,19 +63,12 @@ int main(int argc, char *argv[])
/* initialize all the supporting struct */ /* initialize all the supporting struct */
assert(!aml_tiling_init(&tiling, AML_TILING_TYPE_1D, tilesz, memsize)); assert(!aml_tiling_init(&tiling, AML_TILING_TYPE_1D, tilesz, memsize));
slow = aml_area_linux_create(AML_AREA_LINUX_MMAP_FLAG_PRIVATE,
assert(!aml_arena_jemalloc_init(&arns, AML_ARENA_JEMALLOC_TYPE_REGULAR)); &slowb, AML_AREA_LINUX_BINDING_FLAG_BIND);
assert(!aml_area_linux_init(&slow, assert(slow != NULL);
AML_AREA_LINUX_MANAGER_TYPE_SINGLE, fast = aml_area_linux_create(AML_AREA_LINUX_MMAP_FLAG_PRIVATE,
AML_AREA_LINUX_MBIND_TYPE_REGULAR, &fastb, AML_AREA_LINUX_BINDING_FLAG_BIND);
AML_AREA_LINUX_MMAP_TYPE_ANONYMOUS, assert(fast != NULL);
&arns, MPOL_BIND, slowb->maskp));
assert(!aml_arena_jemalloc_init(&arnf, AML_ARENA_JEMALLOC_TYPE_REGULAR));
assert(!aml_area_linux_init(&fast,
AML_AREA_LINUX_MANAGER_TYPE_SINGLE,
AML_AREA_LINUX_MBIND_TYPE_REGULAR,
AML_AREA_LINUX_MMAP_TYPE_ANONYMOUS,
&arnf, MPOL_BIND, fastb->maskp));
assert(!aml_dma_linux_par_init(&dma, numthreads*2, numthreads)); assert(!aml_dma_linux_par_init(&dma, numthreads*2, numthreads));
assert(!aml_scratch_seq_init(&sa, &fast, &slow, &dma, &tiling, assert(!aml_scratch_seq_init(&sa, &fast, &slow, &dma, &tiling,
(size_t)2*numthreads, (size_t)1)); (size_t)2*numthreads, (size_t)1));
...@@ -85,9 +76,9 @@ int main(int argc, char *argv[]) ...@@ -85,9 +76,9 @@ int main(int argc, char *argv[])
(size_t)2*numthreads, (size_t)1)); (size_t)2*numthreads, (size_t)1));
/* allocation */ /* allocation */
a = aml_area_malloc(&slow, memsize); a = aml_area_mmap(slow, NULL, memsize);
b = aml_area_malloc(&slow, memsize); b = aml_area_mmap(slow, NULL, memsize);
c = aml_area_malloc(&fast, memsize); c = aml_area_mmap(fast, NULL, memsize);
assert(a != NULL && b != NULL && c != NULL); assert(a != NULL && b != NULL && c != NULL);
unsigned long esize = memsize/sizeof(unsigned long); unsigned long esize = memsize/sizeof(unsigned long);
...@@ -129,11 +120,11 @@ int main(int argc, char *argv[]) ...@@ -129,11 +120,11 @@ int main(int argc, char *argv[])
aml_scratch_seq_destroy(&sa); aml_scratch_seq_destroy(&sa);
aml_scratch_seq_destroy(&sb); aml_scratch_seq_destroy(&sb);
aml_dma_linux_par_destroy(&dma); aml_dma_linux_par_destroy(&dma);
aml_area_free(&slow, a); aml_area_munmap(slow, a, memsize);
aml_area_free(&slow, b); aml_area_munmap(slow, b, memsize);
aml_area_free(&slow, c); aml_area_munmap(fast, c, memsize);
aml_area_linux_destroy(&slow); aml_area_linux_destroy(slow);
aml_area_linux_destroy(&fast); aml_area_linux_destroy(fast);
aml_tiling_destroy(&tiling, AML_TILING_TYPE_1D); aml_tiling_destroy(&tiling, AML_TILING_TYPE_1D);
aml_finalize(); aml_finalize();
return 0; return 0;
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
*******************************************************************************/ *******************************************************************************/
#include "aml.h" #include "aml.h"
#include "aml/area/linux.h"
#include "aml/dma/linux-seq.h" #include "aml/dma/linux-seq.h"
#include "aml/scratch/par.h" #include "aml/scratch/par.h"
#include <assert.h> #include <assert.h>
...@@ -25,8 +26,7 @@ ...@@ -25,8 +26,7 @@
size_t numthreads, tilesz, esz; size_t numthreads, tilesz, esz;
unsigned long *a, *b, *c; unsigned long *a, *b, *c;
AML_TILING_1D_DECL(tiling); AML_TILING_1D_DECL(tiling);
AML_AREA_LINUX_DECL(slow); struct aml_area *slow, *fast;
AML_AREA_LINUX_DECL(fast);
AML_SCRATCH_PAR_DECL(sa); AML_SCRATCH_PAR_DECL(sa);
AML_SCRATCH_PAR_DECL(sb); AML_SCRATCH_PAR_DECL(sb);
...@@ -71,16 +71,14 @@ void do_work(unsigned long tid) ...@@ -71,16 +71,14 @@ void do_work(unsigned long tid)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
AML_ARENA_JEMALLOC_DECL(arns);
AML_ARENA_JEMALLOC_DECL(arnf);
AML_DMA_LINUX_SEQ_DECL(dma); AML_DMA_LINUX_SEQ_DECL(dma);
struct bitmask *slowb, *fastb; struct aml_bitmap slowb, fastb;
aml_init(&argc, &argv); aml_init(&argc, &argv);
assert(argc == 4); assert(argc == 4);
log_init(argv[0]);