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
6a989521
Commit
6a989521
authored
Jan 22, 2018
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace throw with CAF_RAISE_ERROR
parent
ff793263
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
16 deletions
+14
-16
libcaf_core/caf/deserializer.hpp
libcaf_core/caf/deserializer.hpp
+1
-1
libcaf_core/caf/serializer.hpp
libcaf_core/caf/serializer.hpp
+1
-1
libcaf_opencl/caf/opencl/actor_facade.hpp
libcaf_opencl/caf/opencl/actor_facade.hpp
+2
-4
libcaf_opencl/caf/opencl/command.hpp
libcaf_opencl/caf/opencl/command.hpp
+1
-1
libcaf_opencl/src/manager.cpp
libcaf_opencl/src/manager.cpp
+7
-7
libcaf_opencl/src/opencl_err.cpp
libcaf_opencl/src/opencl_err.cpp
+1
-1
libcaf_opencl/src/platform.cpp
libcaf_opencl/src/platform.cpp
+1
-1
No files found.
libcaf_core/caf/deserializer.hpp
View file @
6a989521
...
@@ -67,7 +67,7 @@ typename std::enable_if<
...
@@ -67,7 +67,7 @@ typename std::enable_if<
operator
&
(
deserializer
&
source
,
T
&
x
)
{
operator
&
(
deserializer
&
source
,
T
&
x
)
{
auto
e
=
source
.
apply
(
x
);
auto
e
=
source
.
apply
(
x
);
if
(
e
)
if
(
e
)
throw
std
::
runtime_error
(
to_string
(
e
));
CAF_RAISE_ERROR
(
to_string
(
e
));
}
}
template
<
class
T
>
template
<
class
T
>
...
...
libcaf_core/caf/serializer.hpp
View file @
6a989521
...
@@ -67,7 +67,7 @@ operator&(serializer& sink, const T& x) {
...
@@ -67,7 +67,7 @@ operator&(serializer& sink, const T& x) {
// implementations are required to never modify `x` while saving
// implementations are required to never modify `x` while saving
auto
e
=
sink
.
apply
(
const_cast
<
T
&>
(
x
));
auto
e
=
sink
.
apply
(
const_cast
<
T
&>
(
x
));
if
(
e
)
if
(
e
)
throw
std
::
runtime_error
(
to_string
(
e
));
CAF_RAISE_ERROR
(
to_string
(
e
));
}
}
template
<
class
T
>
template
<
class
T
>
...
...
libcaf_opencl/caf/opencl/actor_facade.hpp
View file @
6a989521
...
@@ -89,16 +89,14 @@ public:
...
@@ -89,16 +89,14 @@ public:
Ts
&&
...
xs
)
{
Ts
&&
...
xs
)
{
if
(
range
.
dimensions
().
empty
())
{
if
(
range
.
dimensions
().
empty
())
{
auto
str
=
"OpenCL kernel needs at least 1 global dimension."
;
auto
str
=
"OpenCL kernel needs at least 1 global dimension."
;
CAF_LOG_ERROR
(
str
);
CAF_RAISE_ERROR
(
str
);
throw
std
::
runtime_error
(
str
);
}
}
auto
check_vec
=
[
&
](
const
dim_vec
&
vec
,
const
char
*
name
)
{
auto
check_vec
=
[
&
](
const
dim_vec
&
vec
,
const
char
*
name
)
{
if
(
!
vec
.
empty
()
&&
vec
.
size
()
!=
range
.
dimensions
().
size
())
{
if
(
!
vec
.
empty
()
&&
vec
.
size
()
!=
range
.
dimensions
().
size
())
{
std
::
ostringstream
oss
;
std
::
ostringstream
oss
;
oss
<<
name
<<
" vector is not empty, but "
oss
<<
name
<<
" vector is not empty, but "
<<
"its size differs from global dimensions vector's size"
;
<<
"its size differs from global dimensions vector's size"
;
CAF_LOG_ERROR
(
CAF_ARG
(
oss
.
str
()));
CAF_RAISE_ERROR
(
oss
.
str
());
throw
std
::
runtime_error
(
oss
.
str
());
}
}
};
};
check_vec
(
range
.
offsets
(),
"offsets"
);
check_vec
(
range
.
offsets
(),
"offsets"
);
...
...
libcaf_opencl/caf/opencl/command.hpp
View file @
6a989521
...
@@ -197,7 +197,7 @@ private:
...
@@ -197,7 +197,7 @@ private:
events
.
data
(),
&
events
.
back
());
events
.
data
(),
&
events
.
back
());
if
(
err
!=
CL_SUCCESS
)
{
if
(
err
!=
CL_SUCCESS
)
{
this
->
deref
();
// failed to enqueue command
this
->
deref
();
// failed to enqueue command
throw
std
::
runtime_error
(
"clEnqueueReadBuffer: "
+
opencl_error
(
err
));
CAF_RAISE_ERROR
(
"clEnqueueReadBuffer: "
+
opencl_error
(
err
));
}
}
pos
+=
1
;
pos
+=
1
;
}
}
...
...
libcaf_opencl/src/manager.cpp
View file @
6a989521
...
@@ -53,7 +53,7 @@ void manager::init(actor_system_config&) {
...
@@ -53,7 +53,7 @@ void manager::init(actor_system_config&) {
std
::
vector
<
cl_platform_id
>
platform_ids
(
num_platforms
);
std
::
vector
<
cl_platform_id
>
platform_ids
(
num_platforms
);
v2callcl
(
CAF_CLF
(
clGetPlatformIDs
),
num_platforms
,
platform_ids
.
data
());
v2callcl
(
CAF_CLF
(
clGetPlatformIDs
),
num_platforms
,
platform_ids
.
data
());
if
(
platform_ids
.
empty
())
if
(
platform_ids
.
empty
())
throw
std
::
runtime_error
(
"no OpenCL platform found"
);
CAF_RAISE_ERROR
(
"no OpenCL platform found"
);
// initialize platforms (device discovery)
// initialize platforms (device discovery)
unsigned
current_device_id
=
0
;
unsigned
current_device_id
=
0
;
for
(
auto
&
pl_id
:
platform_ids
)
{
for
(
auto
&
pl_id
:
platform_ids
)
{
...
@@ -100,7 +100,7 @@ program_ptr manager::create_program_from_file(const char* path,
...
@@ -100,7 +100,7 @@ program_ptr manager::create_program_from_file(const char* path,
ostringstream
oss
;
ostringstream
oss
;
oss
<<
"No file at '"
<<
path
<<
"' found."
;
oss
<<
"No file at '"
<<
path
<<
"' found."
;
CAF_LOG_ERROR
(
CAF_ARG
(
oss
.
str
()));
CAF_LOG_ERROR
(
CAF_ARG
(
oss
.
str
()));
throw
runtime_error
(
oss
.
str
());
CAF_RAISE_ERROR
(
oss
.
str
());
}
}
return
create_program
(
kernel_source
.
c_str
(),
options
,
device_id
);
return
create_program
(
kernel_source
.
c_str
(),
options
,
device_id
);
}
}
...
@@ -113,7 +113,7 @@ program_ptr manager::create_program(const char* kernel_source,
...
@@ -113,7 +113,7 @@ program_ptr manager::create_program(const char* kernel_source,
ostringstream
oss
;
ostringstream
oss
;
oss
<<
"No device with id '"
<<
device_id
<<
"' found."
;
oss
<<
"No device with id '"
<<
device_id
<<
"' found."
;
CAF_LOG_ERROR
(
CAF_ARG
(
oss
.
str
()));
CAF_LOG_ERROR
(
CAF_ARG
(
oss
.
str
()));
throw
runtime_error
(
oss
.
str
());
CAF_RAISE_ERROR
(
oss
.
str
());
}
}
return
create_program
(
kernel_source
,
options
,
*
dev
);
return
create_program
(
kernel_source
,
options
,
*
dev
);
}
}
...
@@ -134,7 +134,7 @@ program_ptr manager::create_program_from_file(const char* path,
...
@@ -134,7 +134,7 @@ program_ptr manager::create_program_from_file(const char* path,
ostringstream
oss
;
ostringstream
oss
;
oss
<<
"No file at '"
<<
path
<<
"' found."
;
oss
<<
"No file at '"
<<
path
<<
"' found."
;
CAF_LOG_ERROR
(
CAF_ARG
(
oss
.
str
()));
CAF_LOG_ERROR
(
CAF_ARG
(
oss
.
str
()));
throw
runtime_error
(
oss
.
str
());
CAF_RAISE_ERROR
(
oss
.
str
());
}
}
return
create_program
(
kernel_source
.
c_str
(),
options
,
dev
);
return
create_program
(
kernel_source
.
c_str
(),
options
,
dev
);
}
}
...
@@ -176,7 +176,7 @@ program_ptr manager::create_program(const char* kernel_source,
...
@@ -176,7 +176,7 @@ program_ptr manager::create_program(const char* kernel_source,
#endif
#endif
oss
<<
endl
<<
ss
.
str
();
oss
<<
endl
<<
ss
.
str
();
}
}
throw
runtime_error
(
oss
.
str
());
CAF_RAISE_ERROR
(
oss
.
str
());
}
}
cl_uint
number_of_kernels
=
0
;
cl_uint
number_of_kernels
=
0
;
clCreateKernelsInProgram
(
pptr
.
get
(),
0u
,
nullptr
,
&
number_of_kernels
);
clCreateKernelsInProgram
(
pptr
.
get
(),
0u
,
nullptr
,
&
number_of_kernels
);
...
@@ -188,7 +188,7 @@ program_ptr manager::create_program(const char* kernel_source,
...
@@ -188,7 +188,7 @@ program_ptr manager::create_program(const char* kernel_source,
if
(
err
!=
CL_SUCCESS
)
{
if
(
err
!=
CL_SUCCESS
)
{
ostringstream
oss
;
ostringstream
oss
;
oss
<<
"clCreateKernelsInProgram: "
<<
opencl_error
(
err
);
oss
<<
"clCreateKernelsInProgram: "
<<
opencl_error
(
err
);
throw
runtime_error
(
oss
.
str
());
CAF_RAISE_ERROR
(
oss
.
str
());
}
}
for
(
cl_uint
i
=
0
;
i
<
number_of_kernels
;
++
i
)
{
for
(
cl_uint
i
=
0
;
i
<
number_of_kernels
;
++
i
)
{
size_t
len
;
size_t
len
;
...
@@ -200,7 +200,7 @@ program_ptr manager::create_program(const char* kernel_source,
...
@@ -200,7 +200,7 @@ program_ptr manager::create_program(const char* kernel_source,
ostringstream
oss
;
ostringstream
oss
;
oss
<<
"clGetKernelInfo (CL_KERNEL_FUNCTION_NAME): "
oss
<<
"clGetKernelInfo (CL_KERNEL_FUNCTION_NAME): "
<<
opencl_error
(
err
);
<<
opencl_error
(
err
);
throw
runtime_error
(
oss
.
str
());
CAF_RAISE_ERROR
(
oss
.
str
());
}
}
detail
::
raw_kernel_ptr
kernel
;
detail
::
raw_kernel_ptr
kernel
;
kernel
.
reset
(
move
(
kernels
[
i
]));
kernel
.
reset
(
move
(
kernels
[
i
]));
...
...
libcaf_opencl/src/opencl_err.cpp
View file @
6a989521
...
@@ -27,7 +27,7 @@ void throwcl(const char* fname, cl_int err) {
...
@@ -27,7 +27,7 @@ void throwcl(const char* fname, cl_int err) {
std
::
string
errstr
=
fname
;
std
::
string
errstr
=
fname
;
errstr
+=
": "
;
errstr
+=
": "
;
errstr
+=
opencl_error
(
err
);
errstr
+=
opencl_error
(
err
);
throw
std
::
runtime_error
(
std
::
move
(
errstr
));
CAF_RAISE_ERROR
(
std
::
move
(
errstr
));
}
}
}
}
...
...
libcaf_opencl/src/platform.cpp
View file @
6a989521
...
@@ -66,7 +66,7 @@ platform_ptr platform::create(cl_platform_id platform_id,
...
@@ -66,7 +66,7 @@ platform_ptr platform::create(cl_platform_id platform_id,
if
(
device_information
.
empty
())
{
if
(
device_information
.
empty
())
{
string
errstr
=
"no devices for the platform found"
;
string
errstr
=
"no devices for the platform found"
;
CAF_LOG_ERROR
(
CAF_ARG
(
errstr
));
CAF_LOG_ERROR
(
CAF_ARG
(
errstr
));
throw
runtime_error
(
move
(
errstr
));
CAF_RAISE_ERROR
(
move
(
errstr
));
}
}
auto
name
=
platform_info
(
platform_id
,
CL_PLATFORM_NAME
);
auto
name
=
platform_info
(
platform_id
,
CL_PLATFORM_NAME
);
auto
vendor
=
platform_info
(
platform_id
,
CL_PLATFORM_VENDOR
);
auto
vendor
=
platform_info
(
platform_id
,
CL_PLATFORM_VENDOR
);
...
...
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