Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tapasco
tapasco
Commits
32bde4df
Commit
32bde4df
authored
Jul 06, 2017
by
Jaco Hofmann
Browse files
Fixes memcheck example
parent
a6a8b210
Changes
4
Hide whitespace changes
Inline
Side-by-side
examples/examples.cmake
View file @
32bde4df
...
...
@@ -31,7 +31,7 @@ set(FF_ROOT "$ENV{FF_ROOT}")
endif
(
${
REQUIRES_FASTFLOW
}
)
# link_directories(${TAPASCO_HOME}/arch/lib/${ARCH} ${TAPASCO_HOME}/arch/lib/${ARCH}/static ${TAPASCO_HOME}/platform/lib/${ARCH} ${TAPASCO_HOME}/platform/lib/${ARCH}/static)
link_directories
(
${
TAPASCO_HOME
}
/arch/lib/
${
ARCH
}
/static
${
TAPASCO_HOME
}
/platform/lib/
${
ARCH
}
/static
)
link_directories
(
${
TAPASCO_HOME
}
/arch/lib/
${
ARCH
}
${
TAPASCO_HOME
}
/platform/lib/
${
ARCH
}
)
include_directories
(
${
TAPASCO_HOME
}
/arch/common/include
${
TAPASCO_HOME
}
/platform/common/include
${
FF_ROOT
}
)
examples/memcheck/memcheck-mt-ff.cc
View file @
32bde4df
...
...
@@ -82,7 +82,8 @@ static int runTest(int const s)
assert
(
rarr
!=
NULL
);
// get tapasco handle
tapasco_handle_t
h
=
tapasco_device_alloc
(
dev
,
arr_szs
[
s
]
*
sizeof
(
int
),
0
);
tapasco_handle_t
h
;
tapasco_device_alloc
(
dev
,
&
h
,
arr_szs
[
s
]
*
sizeof
(
int
),
0
);
std
::
cout
<<
s
<<
": handle = 0x"
<<
std
::
hex
<<
std
::
setfill
(
'0'
)
<<
std
::
setw
(
8
)
<<
static_cast
<
uint32_t
>
(
h
)
<<
", size = "
<<
arr_szs
[
s
]
*
sizeof
(
int
)
<<
" bytes"
...
...
@@ -112,7 +113,7 @@ static int runTest(int const s)
merr
+=
1
;
}
__sync_add_and_fetch
(
&
errs
,
merr
);
tapasco_device_free
(
dev
,
h
);
tapasco_device_free
(
dev
,
h
,
0
);
if
(
!
merr
)
std
::
cout
<<
s
<<
": Array size "
<<
arr_szs
[
s
]
<<
" ("
...
...
@@ -167,7 +168,7 @@ int main(int argc, char **argv)
std
::
vector
<
ff_node
*>
f
;
for
(
int
i
=
0
;
i
<
sysconf
(
_SC_NPROCESSORS_CONF
);
++
i
)
f
.
push_back
(
new
Worker
);
Emitter
e
;
Collector
c
;
ff_farm
<>
farm
(
f
,
&
e
,
&
c
);
...
...
@@ -176,7 +177,7 @@ int main(int argc, char **argv)
farm
.
cleanup_workers
();
farm
.
run_and_wait_end
();
if
(
!
errs
)
if
(
!
errs
)
std
::
cout
<<
"SUCCESS!"
<<
std
::
endl
;
else
std
::
cerr
<<
"FAILURE"
<<
std
::
endl
;
...
...
examples/memcheck/memcheck-mt.c
View file @
32bde4df
...
...
@@ -75,7 +75,7 @@ static void *test_thread(void *p)
long
int
s
;
while
((
s
=
__atomic_sub_fetch
(
&
runs
,
1
,
__ATOMIC_SEQ_CST
))
>
0
)
{
s
=
s
%
sc
;
//printf("%ld: Checking array size %zd (%zd byte) ...\n",
//printf("%ld: Checking array size %zd (%zd byte) ...\n",
// s, arr_szs[s], arr_szs[s] * sizeof(int));
// allocate and fill array
int
*
arr
=
(
int
*
)
malloc
(
arr_szs
[
s
]
*
sizeof
(
int
));
...
...
@@ -86,7 +86,8 @@ static void *test_thread(void *p)
assert
(
rarr
!=
NULL
);
// get tapasco handle
tapasco_handle_t
h
=
tapasco_device_alloc
(
dev
,
arr_szs
[
s
]
*
sizeof
(
int
),
0
);
tapasco_handle_t
h
;
tapasco_device_alloc
(
dev
,
&
h
,
arr_szs
[
s
]
*
sizeof
(
int
),
0
);
// printf("%ld: handle = 0x%08lx, size = %zd bytes\n", s,
// (unsigned long)h, arr_szs[s] * sizeof(int));
assert
((
unsigned
long
)
h
>
0
);
...
...
@@ -113,7 +114,7 @@ static void *test_thread(void *p)
merr
+=
1
;
}
__atomic_add_fetch
(
&
errs
,
merr
,
__ATOMIC_SEQ_CST
);
tapasco_device_free
(
dev
,
h
);
tapasco_device_free
(
dev
,
h
,
0
);
if
(
!
merr
)
/*printf("%ld: Array size %zd (%zd byte) ok!\n",
...
...
@@ -157,7 +158,7 @@ int main(int argc, char **argv) {
pthread_join
(
thrds
[
s
],
NULL
);
}
if
(
!
errs
)
if
(
!
errs
)
printf
(
"
\n
SUCCESS
\n
"
);
else
fprintf
(
stderr
,
"
\n
FAILURE
\n
"
);
...
...
examples/memcheck/memcheck.c
View file @
32bde4df
...
...
@@ -73,7 +73,7 @@ int main(int argc, char **argv) {
check_fpga
(
tapasco_create_device
(
ctx
,
0
,
&
dev
,
0
));
for
(
int
s
=
0
;
s
<
sizeof
(
arr_szs
)
/
sizeof
(
*
arr_szs
)
&&
errs
==
0
;
++
s
)
{
printf
(
"Checking array size %zd (%zd byte) ...
\n
"
,
printf
(
"Checking array size %zd (%zd byte) ...
\n
"
,
arr_szs
[
s
],
arr_szs
[
s
]
*
sizeof
(
int
));
// allocate and fill array
int
*
arr
=
(
int
*
)
malloc
(
arr_szs
[
s
]
*
sizeof
(
int
));
...
...
@@ -83,7 +83,8 @@ int main(int argc, char **argv) {
int
*
rarr
=
(
int
*
)
malloc
(
arr_szs
[
s
]
*
sizeof
(
int
));
// get fpga handle
tapasco_handle_t
h
=
tapasco_device_alloc
(
dev
,
arr_szs
[
s
]
*
sizeof
(
int
),
0
);
tapasco_handle_t
h
;
tapasco_device_alloc
(
dev
,
&
h
,
arr_szs
[
s
]
*
sizeof
(
int
),
0
);
printf
(
"handle = 0x%08lx
\n
"
,
(
unsigned
long
)
h
);
check
((
unsigned
long
)
h
);
...
...
@@ -92,7 +93,7 @@ int main(int argc, char **argv) {
check_fpga
(
tapasco_device_copy_to
(
dev
,
arr
,
h
,
arr_szs
[
s
]
*
sizeof
(
int
),
0
));
check_fpga
(
tapasco_device_copy_from
(
dev
,
h
,
rarr
,
arr_szs
[
s
]
*
sizeof
(
int
),
0
));
tapasco_device_free
(
dev
,
h
);
tapasco_device_free
(
dev
,
h
,
0
);
int
merr
=
compare_arrays
(
arr
,
rarr
,
arr_szs
[
s
]);
errs
=+
merr
;
...
...
@@ -108,7 +109,7 @@ int main(int argc, char **argv) {
free
(
rarr
);
}
if
(
!
errs
)
if
(
!
errs
)
printf
(
"
\n
SUCCESS
\n
"
);
else
fprintf
(
stderr
,
"
\n
FAILURE
\n
"
);
...
...
Jens Korinth
@jk
mentioned in commit
a831b501
·
Jul 14, 2017
mentioned in commit
a831b501
mentioned in commit a831b5015df6bd8f8d23ddd334a3b1159392de92
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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