ISAAC-V2.0: INITIAL COMMIT

This commit is contained in:
philippe
2017-05-07 16:51:51 -07:00
parent 911f1fdb71
commit e99759d3b3
2882 changed files with 73975 additions and 1087661 deletions

View File

@@ -21,52 +21,17 @@
*/
#include "isaac/driver/event.h"
#include "helpers/ocl/infos.hpp"
namespace isaac
{
namespace driver
{
Event::Event(backend_type backend) : backend_(backend), h_(backend_, true)
{
switch(backend_)
{
case CUDA:
dispatch::cuEventCreate(&h_.cu().first, CU_EVENT_DEFAULT);
dispatch::cuEventCreate(&h_.cu().second, CU_EVENT_DEFAULT);
break;
case OPENCL:
break;
default:
throw;
}
}
Event::Event(cl_event const & event, bool take_ownership) : backend_(OPENCL), h_(backend_, take_ownership)
{
h_.cl() = event;
}
long Event::elapsed_time() const
{
switch(backend_)
{
case CUDA:
float time;
dispatch::cuEventElapsedTime(&time, h_.cu().first, h_.cu().second);
return 1e6*time;
case OPENCL:
return static_cast<long>(ocl::info<CL_PROFILING_COMMAND_END>(h_.cl()) - ocl::info<CL_PROFILING_COMMAND_START>(h_.cl()));
default:
throw;
}
}
Event::handle_type const & Event::handle() const
{ return h_; }
float Event::elapsed_time() const{
float time;
dispatch::cuEventElapsedTime(&time, cu_->first, cu_->second);
return time;
}
}
}