CALresult mwCALShutdown(MWCALInfo* ci)
{
    CALresult err = CAL_RESULT_OK;

    err |= mwDestroyCALInfo(ci);
    err |= calShutdown();
    if (err != CAL_RESULT_OK)
        cal_warn("Failed to shutdown CAL", err);

    return err;
}
/* Init CAL, check device capabilities, and prepare new kernel from workunit parameters */
CALresult separationCALInit(MWCALInfo* ci, const CLRequest* clr)
{
    CALresult err;

    err = calInit();
    if (err != CAL_RESULT_OK)
    {
        cal_warn("Failed to init CAL", err);
        return err;
    }

    err = calExtSupported(0x8009);
    if (err != CAL_RESULT_OK)
    {
        cal_warn("calCtxWaitForEvents not supported\n", err);
        return err;
    }

    err = calExtGetProc((CALextproc*) &mw_calCtxWaitForEvents, 0x8009, "calCtxWaitForEvents");
    if (err != CAL_RESULT_OK)
    {
        cal_warn("Error getting calCtxWaitForEvents", err);
        return err;
    }

    err = mwGetCALInfo(ci, clr->devNum);
    if (err != CAL_RESULT_OK)
    {
        cal_warn("Failed to get CAL info", err);
        calShutdown();
        return err;
    }

    printCALInfo(ci);

    if (!checkDeviceCapabilities(&ci->devAttribs))
    {
        warn("Device failed capability check\n");
        mwCALShutdown(ci);
        return CAL_RESULT_ERROR;
    }

    return CAL_RESULT_OK;
}
示例#3
0
CalInitObject::~CalInitObject()
{
    if (mInitialized) calShutdown();
}