Re: [hwloc-devel] signed / unsigned

2009-12-16 Thread Jeff Squyres
On Dec 16, 2009, at 9:03 PM, Jeff Squyres wrote:

> Ok, done.  Please review:
> 
>https://svn.open-mpi.org/trac/hwloc/changeset/1475

I definitely broke something.  :-(

>From my embedding test, I make a trivial app that does the following:


mytest_hwloc_topology_init();
mytest_hwloc_topology_load(topology);
depth = mytest_hwloc_topology_get_depth(topology);
printf("Max depth: %u\n", depth);
-

When I run it, it produces an assertion failure:


Assertion failed: (i = (unsigned) hwloc_get_type_depth(topology, obj->type) || 
HWLOC_TYPE_DEPTH_MULTIPLE == hwloc_get_type_depth(topology, obj->type)), 
function mytest_hwloc_topology_check, file topology.c, line 1764.
Abort
-

Here's the full output:

-
[21:47] beezle:~/svn/hwloc/tests/embedded % ./main 
2 procs
1 packages
2 threads per package
package 0 has cpuset 0x0003
2 cores per package
core 0 has cpuset 0x0001
core 1 has cpuset 0x0002
caches 2(3932160kB) 1(32kB) 2(3072kB)
2 cache levels
node 0 has cpuset 0x0003
L1cache 0 has cpuset 0x0001
L1cache 1 has cpuset 0x0002
L2cache 0 has cpuset 0x0003


 * CPU cpusets *

cpu 0 (os 0) has cpuset 0x0001
cpu 1 (os 1) has cpuset 0x0002
System(0KB HP=0*0kB  ) 
0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x
  NUMANode#0(3840MB) 0x0003
Socket#0 0x0003
  L2Cache#0(3072KB) 0x0003
L1Cache#0(32KB) 0x0001
  Core#0 0x0001
P#0 0x0001
L1Cache#1(32KB) 0x0002
  Core#1 0x0002
P#1 0x0002

Computing the system cpuset by ORing all Proc objects
-> 0x0003

Adding it to the complete cpuset
0x0 -> 0x0003

Limiting online cpuset to the complete cpuset
0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x
 -> 0x0003

Limiting allowed cpuset to the complete cpuset
0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x
 -> 0x0003

Removing unauthorized cpuset from system cpuset
0x0003 -> 0x0003

Removing offline cpuset from system cpuset
0x0003 -> 0x0003

Removing disallowed memory according to nodeset 
0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x,0x

Applying the system cpuset to all objects
System(0KB HP=0*0kB  ) 0x0003
  NUMANode#0(3840MB) 0x0003
Socket#0 0x0003
  L2Cache#0(3072KB) 0x0003
L1Cache#0(32KB) 0x0001
  Core#0 0x0001
P#0 0x0001
L1Cache#1(32KB) 0x0002
  Core#1 0x0002
P#1 0x0002

Removing ignored objects
System(0KB HP=0*0kB  ) 0x0003
  NUMANode#0(3840MB) 0x0003
Socket#0 0x0003
  L2Cache#0(3072KB) 0x0003
L1Cache#0(32KB) 0x0001
  Core#0 0x0001
P#0 0x0001
L1Cache#1(32KB) 0x0002
  Core#1 0x0002
P#1 0x0002

Removing empty objects except numa nodes and PCI devices
System(0KB HP=0*0kB  ) 0x0003
  NUMANode#0(3840MB) 0x0003
Socket#0 0x0003
  L2Cache#0(3072KB) 0x0003
L1Cache#0(32KB) 0x0001
  Core#0 0x0001
P#0 0x0001
L1Cache#1(32KB) 0x0002
  Core#1 0x0002
P#1 0x0002

Removing objects whose type has HWLOC_IGNORE_TYPE_KEEP_STRUCTURE and have only 
one child or are the only child
System(0KB HP=0*0kB  ) 0x0003
  NUMANode#0(3840MB) 0x0003
Socket#0 0x0003
  L2Cache#0(3072KB) 0x0003
L1Cache#0(32KB) 0x0001
  Core#0 0x0001
P#0 0x0001
L1Cache#1(32KB) 0x0002
  Core#1 0x0002
P#1 0x0002

Ok, finished tweaking, now connect
System(0KB HP=0*0kB  ) 0x0003 arity 1
  NUMANode#0(3840MB) 0x0003 arity 1
Socket#0 0x0003 arity 1
  L2Cache#0(3072KB) 

Re: [hwloc-devel] signed / unsigned

2009-12-16 Thread Jeff Squyres
Ok, done.  Please review:

https://svn.open-mpi.org/trac/hwloc/changeset/1475

Additionally, there were a whole pile of signed/unsigned comparisons left in 
lstopo-draw.c that I am a bit too tired to figure out -- could you guys resolve 
them?



On Dec 16, 2009, at 4:58 PM, Brice Goglin wrote:

> Jeff Squyres wrote:
> > On Dec 16, 2009, at 3:35 PM, Jeff Squyres wrote:
> >
> >  
> >> While preparing to SVN commit, I made the default for HG checkouts to 
> >> compile with debug and picky modes.  I now see a TRUCKLOAD of 
> >> signed/unsigned comparison warnings.  I'll look into these right now...
> >>
> >
> > A bunch of them were fairly straightforward "using int and unsigned 
> > together" cases that were easy to fix.  But some of them are less clear -- 
> > comparing what should be unsigned values with -1.  This makes me believe 
> > that -1 is being used as a sentinel value in some places -- e.g., in 
> > hwloc_obj_t->os_index.  It's a "signed" field, but many of the comparisons 
> > that are made to it are from "unsigned" variables.  And at least in one or 
> > two places, it is compared against -1.
> >  
> 
> os_index == -1 means that it is unknown (or does not mean anything or
> whatever).
> 
> > Which should be fixed -- make the .os_index field be unsigned (and either 
> > have another boolean indicating whether the .os_index value is valid or 
> > not, or having a sentinel value for invalid (perhaps ((unsigned) -1)?), or 
> > make all the comparison variables be unsigned?
> >  
> 
> (unsigned) -1 is fine with me.
> 
> Brice
> 
> ___
> hwloc-devel mailing list
> hwloc-de...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel
> 


-- 
Jeff Squyres
jsquy...@cisco.com