Skip to content

Commit

Permalink
set profiling queue property for dpc++ tests
Browse files Browse the repository at this point in the history
  • Loading branch information
upsj committed May 23, 2023
1 parent 0c7fa28 commit b77bad0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
18 changes: 17 additions & 1 deletion test/base/timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,23 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "test/utils/executor.hpp"


class Timer : public CommonTestFixture {};
class Timer : public CommonTestFixture {
#ifdef GKO_COMPILING_DPCPP
Timer()
{
// require profiling capability
const auto property = dpcpp_queue_property::in_order |
dpcpp_queue_property::enable_profiling;
if (gko::DpcppExecutor::get_num_devices("gpu") > 0) {
exec = gko::DpcppExecutor::create(0, ref, "gpu", property);
} else if (gko::DpcppExecutor::get_num_devices("cpu") > 0) {
exec = gko::DpcppExecutor::create(0, ref, "cpu", property);
} else {
throw std::runtime_error{"No suitable DPC++ devices"};
}
}
#endif
};


TEST_F(Timer, WorksAsync)
Expand Down
18 changes: 17 additions & 1 deletion test/log/profiler_hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,23 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "test/utils/executor.hpp"


class ProfilerHook : public CommonTestFixture {};
class ProfilerHook : public CommonTestFixture {
#ifdef GKO_COMPILING_DPCPP
ProfilerHook()
{
// require profiling capability
const auto property = dpcpp_queue_property::in_order |
dpcpp_queue_property::enable_profiling;
if (gko::DpcppExecutor::get_num_devices("gpu") > 0) {
exec = gko::DpcppExecutor::create(0, ref, "gpu", property);
} else if (gko::DpcppExecutor::get_num_devices("cpu") > 0) {
exec = gko::DpcppExecutor::create(0, ref, "cpu", property);
} else {
throw std::runtime_error{"No suitable DPC++ devices"};
}
}
#endif
};


void call_ranges_unique(std::shared_ptr<gko::log::ProfilerHook> logger)
Expand Down

0 comments on commit b77bad0

Please sign in to comment.