Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
argo
aml
Commits
0da98aca
Commit
0da98aca
authored
Jul 26, 2018
by
Swann Perarnau
Browse files
[feature] add regular dgemm with custom alloc
Just to be able to test various matrix placements.
parent
4f575f8c
Changes
2
Hide whitespace changes
Inline
Side-by-side
benchmarks/Makefile.am
View file @
0da98aca
...
...
@@ -9,5 +9,6 @@ noinst_PROGRAMS = stream_add_pth_st \
stream_add_omp_st
\
stream_add_omp_mt
\
dgemm_vanilla
\
dgemm_mkl
\
dgemm_prefetch
\
dgemm_noprefetch
benchmarks/dgemm_mkl.c
0 → 100644
View file @
0da98aca
#include
<aml.h>
#include
<assert.h>
#include
<errno.h>
#include
<mkl.h>
#include
<omp.h>
#include
<pthread.h>
#include
<stdio.h>
#include
<time.h>
#include
<math.h>
#include
<stdlib.h>
int
main
(
int
argc
,
char
*
argv
[])
{
AML_ARENA_JEMALLOC_DECL
(
arena
);
AML_AREA_LINUX_DECL
(
slow
);
AML_AREA_LINUX_DECL
(
fast
);
struct
bitmask
*
slowb
,
*
fastb
;
struct
timespec
start
,
stop
;
double
*
a
,
*
b
,
*
c
;
aml_init
(
&
argc
,
&
argv
);
assert
(
argc
==
4
);
fastb
=
numa_parse_nodestring_all
(
argv
[
1
]);
slowb
=
numa_parse_nodestring_all
(
argv
[
2
]);
long
int
N
=
atol
(
argv
[
3
]);
unsigned
long
memsize
=
sizeof
(
double
)
*
N
*
N
;
assert
(
!
aml_arena_jemalloc_init
(
&
arena
,
AML_ARENA_JEMALLOC_TYPE_REGULAR
));
assert
(
!
aml_area_linux_init
(
&
slow
,
AML_AREA_LINUX_MANAGER_TYPE_SINGLE
,
AML_AREA_LINUX_MBIND_TYPE_REGULAR
,
AML_AREA_LINUX_MMAP_TYPE_ANONYMOUS
,
&
arena
,
MPOL_BIND
,
slowb
->
maskp
));
assert
(
!
aml_area_linux_init
(
&
fast
,
AML_AREA_LINUX_MANAGER_TYPE_SINGLE
,
AML_AREA_LINUX_MBIND_TYPE_REGULAR
,
AML_AREA_LINUX_MMAP_TYPE_ANONYMOUS
,
&
arena
,
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
);
double
alpha
=
1
.
0
,
beta
=
1
.
0
;
for
(
unsigned
long
i
=
0
;
i
<
N
*
N
;
i
++
){
a
[
i
]
=
(
double
)
rand
();
b
[
i
]
=
(
double
)
rand
();
c
[
i
]
=
0
.
0
;
}
clock_gettime
(
CLOCK_REALTIME
,
&
start
);
cblas_dgemm
(
CblasRowMajor
,
CblasNoTrans
,
CblasNoTrans
,
N
,
N
,
N
,
alpha
,
a
,
N
,
b
,
N
,
beta
,
c
,
N
);
clock_gettime
(
CLOCK_REALTIME
,
&
stop
);
long
long
int
time
=
0
;
time
=
(
stop
.
tv_nsec
-
start
.
tv_nsec
)
+
1e9
*
(
stop
.
tv_sec
-
start
.
tv_sec
);
double
flops
=
(
2
.
0
*
N
*
N
*
N
)
/
(
time
/
1e9
);
/* print the flops in GFLOPS */
printf
(
"dgemm-mkl: %llu %lld %lld %f
\n
"
,
N
,
memsize
,
time
,
flops
/
1e9
);
aml_area_free
(
&
slow
,
a
);
aml_area_free
(
&
slow
,
b
);
aml_area_free
(
&
fast
,
c
);
aml_area_linux_destroy
(
&
slow
);
aml_area_linux_destroy
(
&
fast
);
aml_finalize
();
return
0
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment