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
584c3a48
Commit
584c3a48
authored
Mar 22, 2013
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved exception handling for command queue init
parent
22c887a2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
57 deletions
+77
-57
libcaf_opencl/src/opencl/command_dispatcher.cpp
libcaf_opencl/src/opencl/command_dispatcher.cpp
+77
-57
No files found.
libcaf_opencl/src/opencl/command_dispatcher.cpp
View file @
584c3a48
...
@@ -132,7 +132,6 @@ void command_dispatcher::initialize() {
...
@@ -132,7 +132,6 @@ void command_dispatcher::initialize() {
/* find gpu devices on our platform */
/* find gpu devices on our platform */
int
pid
{
0
};
int
pid
{
0
};
cl_uint
num_devices
{
0
};
cl_uint
num_devices
{
0
};
// cout << "Currently only looking for cpu devices!" << endl;
cl_device_type
dev_type
{
CL_DEVICE_TYPE_GPU
};
cl_device_type
dev_type
{
CL_DEVICE_TYPE_GPU
};
err
=
clGetDeviceIDs
(
ids
[
pid
],
dev_type
,
0
,
NULL
,
&
num_devices
);
err
=
clGetDeviceIDs
(
ids
[
pid
],
dev_type
,
0
,
NULL
,
&
num_devices
);
if
(
err
==
CL_DEVICE_NOT_FOUND
)
{
if
(
err
==
CL_DEVICE_NOT_FOUND
)
{
...
@@ -170,13 +169,25 @@ void command_dispatcher::initialize() {
...
@@ -170,13 +169,25 @@ void command_dispatcher::initialize() {
device
.
get
(),
device
.
get
(),
CL_QUEUE_PROFILING_ENABLE
,
CL_QUEUE_PROFILING_ENABLE
,
&
err
));
&
err
));
size_t
return_size
{
0
};
if
(
err
!=
CL_SUCCESS
)
{
if
(
err
!=
CL_SUCCESS
)
{
ostringstream
oss
;
static
constexpr
size_t
buf_size
=
128
;
oss
<<
"[!!!] clCreateCommandQueue ("
<<
id
<<
"): '"
char
buf
[
buf_size
];
<<
get_opencl_error
(
err
)
<<
"'."
;
err
=
clGetDeviceInfo
(
device
.
get
(),
CL_DEVICE_NAME
,
buf_size
,
buf
,
&
return_size
);
throw
runtime_error
(
oss
.
str
());
if
(
err
==
CL_SUCCESS
)
{
cout
<<
"**** warning: Could not create command queue for device: "
<<
buf
<<
"."
<<
endl
;
}
}
size_t
return_size
{
0
};
else
{
cout
<<
"Could not create command queue unknown for device."
<<
endl
;
}
// ostringstream oss;
// oss << "[!!!] clCreateCommandQueue (" << id << "): '"
// << get_opencl_error(err) << "'.";
// throw runtime_error(oss.str());
}
else
{
size_t
max_work_group_size
{
0
};
size_t
max_work_group_size
{
0
};
err
=
clGetDeviceInfo
(
device
.
get
(),
err
=
clGetDeviceInfo
(
device
.
get
(),
CL_DEVICE_MAX_WORK_GROUP_SIZE
,
CL_DEVICE_MAX_WORK_GROUP_SIZE
,
...
@@ -227,10 +238,19 @@ void command_dispatcher::initialize() {
...
@@ -227,10 +238,19 @@ void command_dispatcher::initialize() {
move
(
max_work_items_per_dim
)};
move
(
max_work_items_per_dim
)};
m_devices
.
push_back
(
move
(
dev_info
));
m_devices
.
push_back
(
move
(
dev_info
));
}
}
}
if
(
m_devices
.
empty
())
{
ostringstream
oss
;
oss
<<
"[!!!] Could not create a command queue for "
<<
"any of the present devices."
;
throw
runtime_error
(
oss
.
str
());
}
else
{
m_supervisor
=
thread
(
&
command_dispatcher
::
supervisor_loop
,
m_supervisor
=
thread
(
&
command_dispatcher
::
supervisor_loop
,
this
,
this
,
&
m_job_queue
,
&
m_job_queue
,
m_dummy
);
m_dummy
);
}
}
}
void
command_dispatcher
::
destroy
()
{
void
command_dispatcher
::
destroy
()
{
...
...
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