Re: [hwloc-users] linkspeed in hwloc_obj_attr_u::hwloc_pcidev_attr_s struct while traversing topology

2017-10-13 Thread Samuel Thibault
Hello,

TEJASWI k, on ven. 13 oct. 2017 14:44:53 +0530, wrote:
> Thanks I could get the linkspeed when i tried with root user.
> But is there no other way?

See Brice's answer :)

> And what is the reason behind this limitation?

Ask Linux people, not us :)

I can only guess that they are afraid of exposing too much config
information, and thus only whitelist the first part.

Samuel
___
hwloc-users mailing list
hwloc-users@lists.open-mpi.org
https://lists.open-mpi.org/mailman/listinfo/hwloc-users


Re: [hwloc-users] linkspeed in hwloc_obj_attr_u::hwloc_pcidev_attr_s struct while traversing topology

2017-10-13 Thread TEJASWI k
Thanks I could get the linkspeed when i tried with root user.
But is there no other way? And what is the reason behind this limitation?

Thanks & Regards,
Tejaswi K

On 13-Oct-2017 2:30 PM, "Samuel Thibault"  wrote:

Hello,

TEJASWI k, on ven. 13 oct. 2017 14:23:00 +0530, wrote:
> All the other details I am able to query but linkspeed (pciObj->attr->
> bridge.upstream.pci.linkspeed) is always 0.
> Do I need to enable any other flag to get linkspeed or am I going wrong
> somewhere?

You need to run as root for hwloc to be able to read the linkspeed from
Linux.

Samuel
___
hwloc-users mailing list
hwloc-users@lists.open-mpi.org
https://lists.open-mpi.org/mailman/listinfo/hwloc-users

Re: [hwloc-users] linkspeed in hwloc_obj_attr_u::hwloc_pcidev_attr_s struct while traversing topology

2017-10-13 Thread Samuel Thibault
Hello,

TEJASWI k, on ven. 13 oct. 2017 14:23:00 +0530, wrote:
> All the other details I am able to query but linkspeed (pciObj->attr->
> bridge.upstream.pci.linkspeed) is always 0.
> Do I need to enable any other flag to get linkspeed or am I going wrong
> somewhere?

You need to run as root for hwloc to be able to read the linkspeed from
Linux.

Samuel
___
hwloc-users mailing list
hwloc-users@lists.open-mpi.org
https://lists.open-mpi.org/mailman/listinfo/hwloc-users


Re: [hwloc-users] linkspeed in hwloc_obj_attr_u::hwloc_pcidev_attr_s struct while traversing topology

2017-10-13 Thread Brice Goglin
Hello

On Linux, the PCI linkspeed requires root privileges unfortunately
(except for the uplink above NVIDIA GPUs where we have another way to
find it).
The only way to workaround this is to dump the topology as XML as root
and then reload it at runtime (e.g. with HWLOC_XMLFILE) :/

Brice



Le 13/10/2017 10:53, TEJASWI k a écrit :
> I am trying to traverse the topology using hwloc APIs starting from a
> PCI device till Host Bridge
>
> My code snippet:
>
> unsigned long flags = HWLOC_TOPOLOGY_FLAG_IO_DEVICES |
> HWLOC_TOPOLOGY_FLAG_IO_BRIDGES;
>
> retval = hwloc_topology_init();
> retval = hwloc_topology_set_flags(topology, flags);
> retval = hwloc_topology_load(topology);
>
> pciObj = hwloc_get_pcidev_by_busidstring(topology, "");
> while(pciObj) {
> pciObj = pciObj->parent;
>
> if (pciObj->attr->bridge.upstream_type !=
> HWLOC_OBJ_BRIDGE_HOST)
> {
>   //Get all the required information about
> intermediate bridges like
>  
> // pciObj->attr->bridge.downstream.pci.secondary_bus, 
> pciObj->attr->bridge.upstream.pci.domain
>   // pciObj->attr->bridge.upstream.pci.bus,
> *_pciObj->attr->bridge.upstream.pci.linkspeed_*
> }
> }
>
> All the other details I am able to query but linkspeed
> (*_pciObj->attr->bridge.upstream.pci.linkspeed_*) is always 0.
> Do I need to enable any other flag to get linkspeed or am I going
> wrong somewhere?
>
> I want to get the PCI Bridges' generation or linkspeed for my usecase.
> Is there any other way to get this information?
>
>
> Thanks & Regards,
> Tejaswi K
>
>
> ___
> hwloc-users mailing list
> hwloc-users@lists.open-mpi.org
> https://lists.open-mpi.org/mailman/listinfo/hwloc-users

___
hwloc-users mailing list
hwloc-users@lists.open-mpi.org
https://lists.open-mpi.org/mailman/listinfo/hwloc-users