precompiling: CL_CONTEXT_OFFLINE_DEVICES_AMD

Help
Anonymous
2012-11-28
2012-12-21
  • Anonymous - 2012-11-28

    Hey there!

    I'd like to precompile my kernels on a GPU that's not present in my system. For that there's "CL_CONTEXT_OFFLINE_DEVICES_AMD" from what I've heard. Id' like to use Cloo to do this and here's what I've done:

    I've added the following to Enums.cs in Cloo:

    public enum ComputeContextPropertyName : int
        {
            /// <summary> </summary>
            Platform = ComputeContextInfo.Platform,
            /// <summary> </summary>
            CL_GL_CONTEXT_KHR = 0x2008,
            /// <summary> </summary>
            CL_EGL_DISPLAY_KHR = 0x2009,
            /// <summary> </summary>
            CL_GLX_DISPLAY_KHR = 0x200A,
            /// <summary> </summary>
            CL_WGL_HDC_KHR = 0x200B,
            /// <summary> </summary>
            CL_CGL_SHAREGROUP_KHR = 0x200C,
            /// <summary> </summary>
            CL_CONTEXT_OFFLINE_DEVICES_AMD = 0x403F,
        }
    

    And in my project I've got:

                CLProperties = new ComputeContextPropertyList(ComputePlatform.Platforms[0]);
                IntPtr ptr = new IntPtr(1);
                ComputeContextPropertyList list = new ComputeContextPropertyList(new List<ComputeContextProperty>() { new ComputeContextProperty(ComputeContextPropertyName.Platform, ComputePlatform.Platforms[0].Handle.Value), new ComputeContextProperty(ComputeContextPropertyName.CL_CONTEXT_OFFLINE_DEVICES_AMD, ptr) });
                CLContext = new ComputeContext(ComputeDeviceTypes.All, list, null, IntPtr.Zero);
    

    The problem I've got now is that I still can't see any additional devices besides the three I've got installed (CPU, 2xGPU). Any idea why?

     
  • Anonymous - 2012-11-28

    To clarify:
    I've got this sample C++ program from which I can access 20 devices, so it really should work:

    std::vector<Platform> platforms;
    Platform::get(&platforms);
    // Select the default platform and create a context using this platform and the GPU
    cl_context_properties cps[5] = { 
        CL_CONTEXT_PLATFORM, 
        (cl_context_properties)(platforms[0])(),
        CL_CONTEXT_OFFLINE_DEVICES_AMD,
        1,
        0 
    };
    Context context( CL_DEVICE_TYPE_ALL, cps);
    // Get a list of devices on this platform
    std::vector<Device> devices = context.getInfo<CL_CONTEXT_DEVICES>();
    std::cout << "num devices: " << devices.capacity() << std::endl;
    std::cin.ignore();
    
     

Log in to post a comment.