Beispiel #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>());
}
Beispiel #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);
}
Beispiel #3
0
void JumpSeat::PreparedStatement::setDouble(const int index, const double value) {
    throwOnError(sqlite3_bind_double(stmt_, index, value),
            "error setting double");
}
Beispiel #4
0
void JumpSeat::PreparedStatement::setInt(const int index, const int value) {
    throwOnError(sqlite3_bind_int(stmt_, index, value),
            "error setting int");
}
Beispiel #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");
}
Beispiel #6
0
void JumpSeat::PreparedStatement::setNull(const int index) {
    throwOnError(sqlite3_bind_null(stmt_, index),
            "error setting null");
}
Beispiel #7
0
void JumpSeat::PreparedStatement::reset() {
    throwOnError(sqlite3_reset(stmt_),
            "error reseting statement");
}
Beispiel #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");
}
Beispiel #9
0
void Context::suspend()
{
	throwOnError(_context->Suspend());
}
Beispiel #10
0
void Context::abort()
{
	throwOnError(_context->Abort());
}
Beispiel #11
0
void Context::execute()
{
	throwOnError(_context->Execute());
}
Beispiel #12
0
void Context::prepare(Function::Ptr function)
{
	throwOnError(_context->Prepare(function->function()));
}