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>()); }
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); }
void JumpSeat::PreparedStatement::setDouble(const int index, const double value) { throwOnError(sqlite3_bind_double(stmt_, index, value), "error setting double"); }
void JumpSeat::PreparedStatement::setInt(const int index, const int value) { throwOnError(sqlite3_bind_int(stmt_, index, value), "error setting int"); }
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"); }
void JumpSeat::PreparedStatement::setNull(const int index) { throwOnError(sqlite3_bind_null(stmt_, index), "error setting null"); }
void JumpSeat::PreparedStatement::reset() { throwOnError(sqlite3_reset(stmt_), "error reseting statement"); }
JumpSeat::PreparedStatement::PreparedStatement(DB& db, const std::string& sql) { throwOnError(sqlite3_prepare_v2(db.db_, sql.c_str(), -1, &stmt_, NULL), "error preparing statement"); }
void Context::suspend() { throwOnError(_context->Suspend()); }
void Context::abort() { throwOnError(_context->Abort()); }
void Context::execute() { throwOnError(_context->Execute()); }
void Context::prepare(Function::Ptr function) { throwOnError(_context->Prepare(function->function())); }