Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
6e57254e
Commit
6e57254e
authored
May 13, 2013
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'unstable' of github.com:Neverlord/libcppa into unstable
parents
536fbf12
123e0d3f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
75 additions
and
32 deletions
+75
-32
cppa/detail/behavior_impl.hpp
cppa/detail/behavior_impl.hpp
+0
-1
cppa/opt.hpp
cppa/opt.hpp
+4
-0
cppa/partial_function.hpp
cppa/partial_function.hpp
+2
-2
src/default_actor_proxy.cpp
src/default_actor_proxy.cpp
+4
-4
src/opencl/program.cpp
src/opencl/program.cpp
+37
-25
unit_testing/test_match.cpp
unit_testing/test_match.cpp
+14
-0
unit_testing/test_opencl.cpp
unit_testing/test_opencl.cpp
+14
-0
No files found.
cppa/detail/behavior_impl.hpp
View file @
6e57254e
...
@@ -133,7 +133,6 @@ class default_behavior_impl : public behavior_impl {
...
@@ -133,7 +133,6 @@ class default_behavior_impl : public behavior_impl {
return
new
default_behavior_impl
<
MatchExpr
,
std
::
function
<
void
()
>
>
(
m_expr
,
tdef
);
return
new
default_behavior_impl
<
MatchExpr
,
std
::
function
<
void
()
>
>
(
m_expr
,
tdef
);
}
}
void
handle_timeout
()
{
m_fun
();
}
void
handle_timeout
()
{
m_fun
();
}
private:
private:
...
...
cppa/opt.hpp
View file @
6e57254e
...
@@ -67,6 +67,10 @@ detail::add_arg_functor<T> add_arg(std::vector<T>& storage) {
...
@@ -67,6 +67,10 @@ detail::add_arg_functor<T> add_arg(std::vector<T>& storage) {
return
{
storage
};
return
{
storage
};
}
}
inline
std
::
function
<
void
()
>
set_flag
(
bool
&
storage
)
{
return
[
&
]
{
storage
=
true
;
};
}
/**
/**
* @brief Stores a help text along with the number of expected arguments.
* @brief Stores a help text along with the number of expected arguments.
*/
*/
...
...
cppa/partial_function.hpp
View file @
6e57254e
...
@@ -107,7 +107,7 @@ class partial_function {
...
@@ -107,7 +107,7 @@ class partial_function {
*/
*/
template
<
typename
...
Ts
>
template
<
typename
...
Ts
>
typename
std
::
conditional
<
typename
std
::
conditional
<
util
::
disjunction
<
Ts
::
may_have_timeout
...
>::
value
,
util
::
disjunction
<
util
::
rm_ref
<
Ts
>::
type
::
may_have_timeout
...
>::
value
,
behavior
,
behavior
,
partial_function
partial_function
>::
type
>::
type
...
@@ -163,7 +163,7 @@ inline bool partial_function::operator()(T&& arg) {
...
@@ -163,7 +163,7 @@ inline bool partial_function::operator()(T&& arg) {
template
<
typename
...
Ts
>
template
<
typename
...
Ts
>
typename
std
::
conditional
<
typename
std
::
conditional
<
util
::
disjunction
<
Ts
::
may_have_timeout
...
>::
value
,
util
::
disjunction
<
util
::
rm_ref
<
Ts
>::
type
::
may_have_timeout
...
>::
value
,
behavior
,
behavior
,
partial_function
partial_function
>::
type
>::
type
...
...
src/default_actor_proxy.cpp
View file @
6e57254e
...
@@ -157,7 +157,7 @@ void default_actor_proxy::link_to(const intrusive_ptr<actor>& other) {
...
@@ -157,7 +157,7 @@ void default_actor_proxy::link_to(const intrusive_ptr<actor>& other) {
if
(
link_to_impl
(
other
))
{
if
(
link_to_impl
(
other
))
{
// causes remote actor to link to (proxy of) other
// causes remote actor to link to (proxy of) other
// receiving peer will call: this->local_link_to(other)
// receiving peer will call: this->local_link_to(other)
forward_msg
(
this
,
make_any_tuple
(
atom
(
"LINK"
),
other
));
forward_msg
(
{
this
,
this
}
,
make_any_tuple
(
atom
(
"LINK"
),
other
));
}
}
}
}
...
@@ -165,7 +165,7 @@ void default_actor_proxy::unlink_from(const intrusive_ptr<actor>& other) {
...
@@ -165,7 +165,7 @@ void default_actor_proxy::unlink_from(const intrusive_ptr<actor>& other) {
CPPA_LOG_TRACE
(
CPPA_MARG
(
other
,
get
));
CPPA_LOG_TRACE
(
CPPA_MARG
(
other
,
get
));
if
(
unlink_from_impl
(
other
))
{
if
(
unlink_from_impl
(
other
))
{
// causes remote actor to unlink from (proxy of) other
// causes remote actor to unlink from (proxy of) other
forward_msg
(
this
,
make_any_tuple
(
atom
(
"UNLINK"
),
other
));
forward_msg
(
{
this
,
this
}
,
make_any_tuple
(
atom
(
"UNLINK"
),
other
));
}
}
}
}
...
@@ -173,7 +173,7 @@ bool default_actor_proxy::establish_backlink(const intrusive_ptr<actor>& other)
...
@@ -173,7 +173,7 @@ bool default_actor_proxy::establish_backlink(const intrusive_ptr<actor>& other)
CPPA_LOG_TRACE
(
CPPA_MARG
(
other
,
get
));
CPPA_LOG_TRACE
(
CPPA_MARG
(
other
,
get
));
if
(
super
::
establish_backlink
(
other
))
{
if
(
super
::
establish_backlink
(
other
))
{
// causes remote actor to unlink from (proxy of) other
// causes remote actor to unlink from (proxy of) other
forward_msg
(
this
,
make_any_tuple
(
atom
(
"LINK"
),
other
));
forward_msg
(
{
this
,
this
}
,
make_any_tuple
(
atom
(
"LINK"
),
other
));
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
@@ -183,7 +183,7 @@ bool default_actor_proxy::remove_backlink(const intrusive_ptr<actor>& other) {
...
@@ -183,7 +183,7 @@ bool default_actor_proxy::remove_backlink(const intrusive_ptr<actor>& other) {
CPPA_LOG_TRACE
(
CPPA_MARG
(
other
,
get
));
CPPA_LOG_TRACE
(
CPPA_MARG
(
other
,
get
));
if
(
super
::
remove_backlink
(
other
))
{
if
(
super
::
remove_backlink
(
other
))
{
// causes remote actor to unlink from (proxy of) other
// causes remote actor to unlink from (proxy of) other
forward_msg
(
this
,
make_any_tuple
(
atom
(
"UNLINK"
),
other
));
forward_msg
(
{
this
,
this
}
,
make_any_tuple
(
atom
(
"UNLINK"
),
other
));
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
...
src/opencl/program.cpp
View file @
6e57254e
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
#include <vector>
#include <vector>
#include <cstring>
#include <cstring>
#include <iostream>
#include "cppa/opencl/program.hpp"
#include "cppa/opencl/program.hpp"
#include "cppa/opencl/command_dispatcher.hpp"
#include "cppa/opencl/command_dispatcher.hpp"
...
@@ -61,34 +62,41 @@ program program::create(const char* kernel_source) {
...
@@ -61,34 +62,41 @@ program program::create(const char* kernel_source) {
// build programm from program object
// build programm from program object
err
=
clBuildProgram
(
pptr
.
get
(),
0
,
nullptr
,
nullptr
,
nullptr
,
nullptr
);
err
=
clBuildProgram
(
pptr
.
get
(),
0
,
nullptr
,
nullptr
,
nullptr
,
nullptr
);
if
(
err
!=
CL_SUCCESS
)
{
if
(
err
!=
CL_SUCCESS
)
{
cl_int
bi_err
{
0
};
device_ptr
device_used
(
cppa
::
detail
::
singleton_manager
::
device_ptr
device_used
(
cppa
::
detail
::
singleton_manager
::
get_command_dispatcher
()
->
get_command_dispatcher
()
->
m_devices
.
front
().
dev_id
);
m_devices
.
front
().
dev_id
);
cl_build_status
build_status
;
cl_build_status
build_status
;
err
=
clGetProgramBuildInfo
(
pptr
.
get
(),
bi_
err
=
clGetProgramBuildInfo
(
pptr
.
get
(),
device_used
.
get
(),
device_used
.
get
(),
CL_PROGRAM_BUILD_STATUS
,
CL_PROGRAM_BUILD_STATUS
,
sizeof
(
cl_build_status
),
sizeof
(
cl_build_status
),
&
build_status
,
&
build_status
,
nullptr
);
nullptr
);
size_t
ret_val_size
;
size_t
ret_val_size
;
err
=
clGetProgramBuildInfo
(
pptr
.
get
(),
bi_err
=
clGetProgramBuildInfo
(
pptr
.
get
(),
device_used
.
get
(),
device_used
.
get
(),
CL_PROGRAM_BUILD_LOG
,
CL_PROGRAM_BUILD_LOG
,
0
,
0
,
nullptr
,
nullptr
,
&
ret_val_size
);
&
ret_val_size
);
std
::
vector
<
char
>
build_log
(
ret_val_size
+
1
);
std
::
vector
<
char
>
build_log
(
ret_val_size
);
err
=
clGetProgramBuildInfo
(
pptr
.
get
(),
bi_err
=
clGetProgramBuildInfo
(
pptr
.
get
(),
device_used
.
get
(),
device_used
.
get
(),
CL_PROGRAM_BUILD_LOG
,
CL_PROGRAM_BUILD_LOG
,
ret_val_size
,
ret_val_size
,
build_log
.
data
(),
build_log
.
data
(),
nullptr
);
nullptr
);
build_log
[
ret_val_size
]
=
'\0'
;
std
::
ostringstream
oss
;
std
::
ostringstream
oss
;
oss
<<
"clBuildProgram: "
<<
get_opencl_error
(
err
)
if
(
ret_val_size
<=
1
)
{
<<
", build log: "
<<
build_log
.
data
();
oss
<<
"clBuildProgram: "
<<
get_opencl_error
(
err
)
<<
" (no build log available)"
;
}
else
{
oss
<<
"clBuildProgram: "
<<
get_opencl_error
(
err
);
build_log
[
ret_val_size
-
1
]
=
'\0'
;
std
::
cerr
<<
build_log
.
data
()
<<
std
::
endl
;
}
CPPA_LOGM_ERROR
(
detail
::
demangle
<
program
>
().
c_str
(),
oss
.
str
());
CPPA_LOGM_ERROR
(
detail
::
demangle
<
program
>
().
c_str
(),
oss
.
str
());
throw
std
::
runtime_error
(
oss
.
str
());
throw
std
::
runtime_error
(
oss
.
str
());
}
}
...
@@ -118,9 +126,13 @@ program program::create(const char* kernel_source) {
...
@@ -118,9 +126,13 @@ program program::create(const char* kernel_source) {
ret_val_size
,
ret_val_size
,
build_log
.
data
(),
build_log
.
data
(),
nullptr
);
nullptr
);
build_log
[
ret_val_size
]
=
'\0'
;
if
(
ret_val_size
>
1
)
{
CPPA_LOGM_DEBUG
(
"program"
,
"clBuildProgram build log: "
CPPA_LOGM_ERROR
(
detail
::
demangle
<
program
>
().
c_str
(),
<<
build_log
.
data
());
"clBuildProgram: error"
);
build_log
[
ret_val_size
-
1
]
=
'\0'
;
std
::
cerr
<<
"clBuildProgram build log:
\n
"
<<
build_log
.
data
()
<<
std
::
endl
;
}
# endif
# endif
}
}
return
{
cptr
,
pptr
};
return
{
cptr
,
pptr
};
...
...
unit_testing/test_match.cpp
View file @
6e57254e
...
@@ -382,5 +382,19 @@ int main() {
...
@@ -382,5 +382,19 @@ int main() {
bhvr_check
(
bhvr1
,
make_any_tuple
(
2.
f
),
true
,
"<float>@2"
);
bhvr_check
(
bhvr1
,
make_any_tuple
(
2.
f
),
true
,
"<float>@2"
);
bhvr_check
(
bhvr1
,
make_any_tuple
(
""
),
true
,
"<*>@4"
);
bhvr_check
(
bhvr1
,
make_any_tuple
(
""
),
true
,
"<*>@4"
);
partial_function
pf11
{
on_arg_match
>>
[
&
](
int
)
{
last_invoked_fun
=
"<int>@1"
;
}
};
partial_function
pf12
{
on_arg_match
>>
[
&
](
int
)
{
last_invoked_fun
=
"<int>@2"
;
},
on_arg_match
>>
[
&
](
float
)
{
last_invoked_fun
=
"<float>@2"
;
}
};
auto
pf13
=
pf11
.
or_else
(
pf12
);
bhvr_check
(
pf13
,
make_any_tuple
(
42
),
true
,
"<int>@1"
);
bhvr_check
(
pf13
,
make_any_tuple
(
42.24
f
),
true
,
"<float>@2"
);
return
CPPA_TEST_RESULT
();
return
CPPA_TEST_RESULT
();
}
}
unit_testing/test_opencl.cpp
View file @
6e57254e
...
@@ -34,6 +34,12 @@ constexpr const char* kernel_source = R"__(
...
@@ -34,6 +34,12 @@ constexpr const char* kernel_source = R"__(
}
}
)__"
;
)__"
;
constexpr
const
char
*
kernel_source_error
=
R"__(
__kernel void matrix_square(__global int*) {
size_t semicolon
}
)__"
;
}
}
template
<
size_t
Size
>
template
<
size_t
Size
>
...
@@ -171,6 +177,14 @@ int main() {
...
@@ -171,6 +177,14 @@ int main() {
}
}
);
);
try
{
program
create_error
=
program
::
create
(
kernel_source_error
);
}
catch
(
const
exception
&
exc
)
{
cout
<<
exc
.
what
()
<<
endl
;
CPPA_CHECK_EQUAL
(
"clBuildProgram: CL_BUILD_PROGRAM_FAILURE"
,
exc
.
what
());
}
cppa
::
await_all_others_done
();
cppa
::
await_all_others_done
();
cppa
::
shutdown
();
cppa
::
shutdown
();
...
...
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