7 Replies Latest reply on Apr 11, 2013 10:04 AM by 6bolt

    Find Device Topology on Windows

    6bolt

      When will the 'CL_DEVICE_TOPOLOGY_AMD' be available on a Windows machine? I am writing code for multiple GPUs and need to map the GPUs to the PCIe bus numbers. It looks like it is impossible on a Windows machine. On a Linux you can do a 'clGetDeviceInfo' call and get the topology of the device.

       

      I tried it on a Windows machine for fun, and it returns a -30, which is a 'CL_INVALID_VALUE'.

       

      So, can anyone tell me when 'CL_DEVICE_TOPOLOGY_AMD'  will be available on Windows? Or does anyone now how to map GPUs to PCIe bus numbers using OpenCL?

       

      Thanks.

        • Re: Find Device Topology on Windows
          himanshu.gautam

          From AMD Programming Guide:

          This query enables the developer to get a description of the topology used to

          connect the device to the host. Currently, this query works only in Linux.

           

          Anyways I will take this opportunity and raise this feature request.

            • Re: Find Device Topology on Windows
              nou

              This should be too hard. When you open property windows of some card in windows HW manager you can see something like PCI bus: 0, device 3, function 0. So there may be some API to query this information.

                • Re: Find Device Topology on Windows
                  6bolt

                  I can use AMD ADL SDK to get the PCIe bus number, but the problem is mapping them to the OpenCL device. The only way I can think of doing it is by watching the activity and/or temperature on the card. For example, I could load up a kernel that can max out the activity on the GPU, and then go search the activity registers using the AMD ADL function calls. This is not the best way of doing it, but it looks like the only way for a Windows machine currently.

                   

                  I am programming a Windows Bitcoin mining program. People that mine; usually have multiple AMD cards in their system. A popular configuration is to have 4-6 5850 cars in one computer. With all being the same cards, it is impossible to map or correlate the OpenCL device to a PCIe bus number; therefore I cannot map the OpenCL device to the AMD ADL device. I looked at multiple ways, and hope that I could figure out the PCIe bus number with OpenCL memory transfers, but I cannot do that.

                   

                  Also, miners like to overclock their cards, so having the AMD ADL with the mining program or in a separate program is a must. It is weird that the AMD ADL can find the PCIe bus number and OpenCL cannot find it on a Windows machine. If I could map/correlate the two, it would be awesome. Then I could easily get the max performance and find more Bitcoins with my program. Having 6 5850 cards in one computer causes a massive amount of heat, and then add in overclocking compounds the problem. So mapping/correlating AMD ADL to OpenCL is unquestionably mandatory.

                    • Re: Find Device Topology on Windows
                      himanshu.gautam

                      okay, Here is probably a clumsy way of doing this if your device supports CL_MEM_PERSISTENT_MEM_AMD extension...

                       

                      1. Create a CL_MEM_PERSISTENT_MEM_AMD cl_mem object

                      2. MAP this object (clEnqueueMapBuffer) and get a Host Pointer

                      3. This pointer is virtual address -- which directly points inside the card.

                          i.e. if you write into this pointer, it will generate a PCIe write into the card.

                      4. The physical address of this pointer -- will directly be owned by the PCIe card.

                      5. Find out which device owns this physical address.

                        • Re: Find Device Topology on Windows
                          6bolt

                          Thanks Himanshu, I will give that a try. Another thing I might try is to use DirectX to get the available memory of the video cards. Then I can allocate memory in OpenCL, and then see what video card memory changed. I am pretty sure I can get the PCIe Bus numbers using DirectX. I am just looking into this method. Luckily, the DirectX SDK has an example of getting video card memory.

                           

                          Thanks for all the help. It means a lot to a former AMD engineer. I would still be at AMD if I haven’t become disabled.