Skip to content

Adding an external device after a Manager is created causes segmentation faults #1728

Closed

Description

@pavanky

The following code shows the failure occurring in MemoryManager, but it can happen in other managers that depend on deviceId.

TEST(OCLExtContext, set)
{
    cl_device_id deviceId = NULL;
    cl_context context = NULL;
    cl_command_queue queue = NULL;

    af_print(af::randu(5,5)); // Remove this line and code works
    getExternals(deviceId, context, queue);
    afcl::addDevice(deviceId, context, queue);
    afcl::setDevice(deviceId, context);
    af::info();

    const int x = 5;
    const int y = 5;
    const int s = x * y;
    af::array a = af::constant(1, x, y);
    vector<float> host(s);
    a.host((void*)host.data());
    for (int i=0; i<s; ++i)
        ASSERT_EQ(host[i], 1.0f);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions