Skip to content

MIOpen should have a miopenGetErrorString method. #43

@Jorghi12

Description

@Jorghi12

In C++, it's not possible to convert enum values back into their corresponding names since all the symbols are discarded in compiling.

Having a method to display the error at run-time seems pretty important.

const char* miopenGetErrorString(miopenStatus_t status) {
    switch (status) {
    case miopenStatusSuccess:
        return "miopenStatusSuccess";

    case miopenStatusNotInitialized:
        return "miopenStatusNotInitialized";

    case miopenStatusInvalidValue:
        return "miopenStatusInvalidValue";

    case miopenStatusBadParm:
        return "miopenStatusBadParm";

    case miopenStatusAllocFailed:
        return "miopenStatusAllocFailed";

    case miopenStatusInternalError:
        return "miopenStatusInternalError";

    case miopenStatusNotImplemented:
        return "miopenStatusNotImplemented";

    case miopenStatusUnknownError:
        return "miopenStatusUnknownError";

    default:
        return "Unrecognized Status Code";
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions