cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

6bolt
Journeyman III

Find Device Topology on Windows

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.

0 Likes
7 Replies
himanshu_gautam
Grandmaster

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.

0 Likes

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.

6bolt
Journeyman III

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.

0 Likes

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.

0 Likes

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.

0 Likes

Most welcome 6Bolt....! The DirectX idea looks cool. Can you please share your findings in this post? There are others as well who have been asking around for PCIe enumerations. Your postings could be very helpful to them.

Just like DirectX, Will OpenGL work too? Any ideas?

0 Likes

Sure will Himanshu. I did look into OpenGL a little bit. I know that it you can get available video card memory too. Once I go through the data and write some code, I will post back my finding and hopefully I can help out some people. 

0 Likes