Exemplo n.º 1
0
CLContext::CLContext() {
  cl_int         result;
  PlatformVector allPlatforms;

  result = cl::Platform::get(&allPlatforms);
  throwOnError("cl::Platform::get", result);

  if(allPlatforms.size() == 0) {
    throw std::runtime_error("No platforms available");
  }

  platform_ = allPlatforms[0];

  //printValue("Platform", platform_.getInfo<CL_PLATFORM_NAME>());

  // Create context
  cl_context_properties cps[3] = {
    CL_CONTEXT_PLATFORM,
    (cl_context_properties)(platform_)(),
    0
  };

  context_ = cl::Context(CL_DEVICE_TYPE_GPU, cps, NULL, NULL, &result);
  throwOnError("cl::Context", result);

  DeviceVector allDevices = context_.getInfo<CL_CONTEXT_DEVICES>();

  if(allDevices.size() == 0) {
    throw std::runtime_error("No devices available");
  }

  device_ = allDevices[0];

  //printValue("Device", device_.getInfo<CL_DEVICE_NAME>());
}
Exemplo n.º 2
0
void File::throwOnNotFound(const NotFoundInfo &info)
{
    throwOnError(info);
    const std::string message
        = formatString("File '%s' does not exist or is not accessible.\n%s",
                       info.filename, info.message);
    GMX_THROW_WITH_ERRNO(InvalidInputError(message), info.call, info.err);
}
Exemplo n.º 3
0
void JumpSeat::PreparedStatement::setDouble(const int index, const double value) {
    throwOnError(sqlite3_bind_double(stmt_, index, value),
            "error setting double");
}
Exemplo n.º 4
0
void JumpSeat::PreparedStatement::setInt(const int index, const int value) {
    throwOnError(sqlite3_bind_int(stmt_, index, value),
            "error setting int");
}
Exemplo n.º 5
0
void JumpSeat::PreparedStatement::setText(const int index, const std::string& value) {
    throwOnError(sqlite3_bind_text(stmt_, index, value.c_str(), -1, SQLITE_TRANSIENT),
            "error setting text");
}
Exemplo n.º 6
0
void JumpSeat::PreparedStatement::setNull(const int index) {
    throwOnError(sqlite3_bind_null(stmt_, index),
            "error setting null");
}
Exemplo n.º 7
0
void JumpSeat::PreparedStatement::reset() {
    throwOnError(sqlite3_reset(stmt_),
            "error reseting statement");
}
Exemplo n.º 8
0
JumpSeat::PreparedStatement::PreparedStatement(DB& db, const std::string& sql) {
    throwOnError(sqlite3_prepare_v2(db.db_, sql.c_str(), -1, &stmt_, NULL),
            "error preparing statement");
}
Exemplo n.º 9
0
void Context::suspend()
{
	throwOnError(_context->Suspend());
}
Exemplo n.º 10
0
void Context::abort()
{
	throwOnError(_context->Abort());
}
Exemplo n.º 11
0
void Context::execute()
{
	throwOnError(_context->Execute());
}
Exemplo n.º 12
0
void Context::prepare(Function::Ptr function)
{
	throwOnError(_context->Prepare(function->function()));
}