Re: [hwloc-devel] lstopo --top

2013-08-12 Thread Brice Goglin
Le 21/06/2013 18:22, Brice Goglin a écrit :
> Le 21/06/2013 17:59, Jiri Hladky a écrit :
>> Hi Brice,
>>
>> this would be useful feature for me and I believe also for others!
>> Currently
> The attached patch puts Misc object in Orange. See how I modified
> lstopo.c, you'll see what you have to do. I can easily add the same
> check to other types.

Jiri,
Does this still matter for you? If you want things to be added in v1.8,
please let me know :)
The attached patch lets you force the lstopo color of any object in the
topology (see the header of the patch). It could be extended to changing
the color of an entire level from the lstopo command-line.
Brice

commit 26caff4ea5f9f50f5442646625ab2797305db22a
Author: Brice Goglin 
List-Post: hwloc-devel@lists.open-mpi.org
Date:   Tue Jun 25 15:28:27 2013 +0200

lstopo: add a lstopoColor info attribute to change colors

This attribute must be "xx:yy:zz" sets the object RGB color.
If it ends with another ",xx:yy:zz", it sets the additional object color
(currently only NUMA node memory box color).

Numbers are truncated to [0-255]

Suggested by Jirka Hladky.

diff --git a/utils/lstopo-draw.c b/utils/lstopo-draw.c
index cc582c5..6f27549 100644
--- a/utils/lstopo-draw.c
+++ b/utils/lstopo-draw.c
@@ -416,6 +416,151 @@ lstopo_obj_snprintf(char *text, size_t textlen, hwloc_obj_t obj, int logical)
 return snprintf(text, textlen, "%s%s", typestr, indexstr);
 }

+static struct draw_methods getmax_draw_methods;
+
+static void
+lstopo_set_object_color(struct draw_methods *methods, hwloc_topology_t topology,
+			hwloc_obj_t obj, int arg, /* PU status (0=normal, 1=running, 2=forbidden, 3=offline)
+		   * Machine status (0=normal, 1=displayed as a root/System) */
+			int *r, int *g, int *b, /* main object colors */
+			int *r2, int *g2, int *b2 /* optional object colors, e.g. NUMA node memory box */)
+{
+  int forcer, forceg, forceb;
+  const char *color, *comma;
+
+  /* no need to deal with colors when computing max sizes */
+  if (methods == _draw_methods)
+return;
+
+  switch (obj->type) {
+
+  case HWLOC_OBJ_MACHINE:
+if (arg == 0) {
+  *r = MACHINE_R_COLOR;
+  *g = MACHINE_G_COLOR;
+  *b = MACHINE_B_COLOR;
+  break;
+}
+assert(arg == 1); /* Machine printed as a System (when root) */
+/* fallthrough */
+  case HWLOC_OBJ_SYSTEM:
+*r = SYSTEM_R_COLOR;
+*g = SYSTEM_G_COLOR;
+*b = SYSTEM_B_COLOR;
+break;
+
+  case HWLOC_OBJ_GROUP:
+*r = MISC_R_COLOR;
+*g = MISC_G_COLOR;
+*b = MISC_B_COLOR;
+break;
+
+  case HWLOC_OBJ_MISC:
+*r = MISC_R_COLOR;
+*g = MISC_G_COLOR;
+*b = MISC_B_COLOR;
+break;
+
+  case HWLOC_OBJ_NODE:
+*r = NODE_R_COLOR;
+*g = NODE_G_COLOR;
+*b = NODE_B_COLOR;
+assert(r2);
+assert(g2);
+assert(b2);
+*r2 = MEMORY_R_COLOR;
+*g2 = MEMORY_G_COLOR;
+*b2 = MEMORY_B_COLOR;
+break;
+
+  case HWLOC_OBJ_SOCKET:
+*r = SOCKET_R_COLOR;
+*g = SOCKET_G_COLOR;
+*b = SOCKET_B_COLOR;
+break;
+
+  case HWLOC_OBJ_CORE:
+*r = CORE_R_COLOR;
+*g = CORE_G_COLOR;
+*b = CORE_B_COLOR;
+break;
+
+  case HWLOC_OBJ_CACHE:
+*r = CACHE_R_COLOR;
+*g = CACHE_G_COLOR;
+*b = CACHE_B_COLOR;
+break;
+
+  case HWLOC_OBJ_PU:
+switch (arg) {
+case 0:
+  *r = THREAD_R_COLOR;
+  *g = THREAD_G_COLOR;
+  *b = THREAD_B_COLOR;
+  break;
+case 1:
+  *r = RUNNING_R_COLOR;
+  *g = RUNNING_G_COLOR;
+  *b = RUNNING_B_COLOR;
+  break;
+case 2:
+  *r = FORBIDDEN_R_COLOR;
+  *g = FORBIDDEN_G_COLOR;
+  *b = FORBIDDEN_B_COLOR;
+  break;
+case 3:
+  *r = OFFLINE_R_COLOR;
+  *g = OFFLINE_G_COLOR;
+  *b = OFFLINE_B_COLOR;
+  break;
+default:
+  assert(0);
+}
+break;
+
+  case HWLOC_OBJ_BRIDGE:
+*r = BRIDGE_R_COLOR;
+*g = BRIDGE_G_COLOR;
+*b = BRIDGE_B_COLOR;
+break;
+
+  case HWLOC_OBJ_PCI_DEVICE:
+*r = PCI_DEVICE_R_COLOR;
+*g = PCI_DEVICE_G_COLOR;
+*b = PCI_DEVICE_B_COLOR;
+break;
+
+  case HWLOC_OBJ_OS_DEVICE:
+*r = OS_DEVICE_R_COLOR;
+*g = OS_DEVICE_G_COLOR;
+*b = OS_DEVICE_B_COLOR;
+break;
+
+  default:
+assert(0);
+  }
+
+  /* "xx:yy:zz" force the main object color.
+   * Optional suffix ",xx:yy:zz" forces the additional object color (e.g. NUMA node memory box).
+   * Number are truncated to [0-255].
+   */
+  color = hwloc_obj_get_info_by_name(obj, "lstopoColor");
+  if (color) {
+if (sscanf(color, "%x:%x:%x", , , ) == 3) {
+  *r = forcer & 255;
+  *g = forceg & 255;
+  *b = forceb & 255;
+}
+comma = strchr(color, ',');
+if (comma)
+  if (sscanf(comma+1, "%x:%x:%x", , , ) == 3) {
+	*r2 = forcer & 255;
+	*g2 = forceg & 255;
+	*b2 = forceb & 255;
+  }
+  }
+}
+
 static void
 pci_device_draw(hwloc_topology_t topology __hwloc_attribute_unused, struct draw_methods *methods, int logical, hwloc_obj_t level, void *output, 

Re: [hwloc-devel] lstopo --top

2013-06-24 Thread Brice Goglin
Le 21/06/2013 17:50, Jiri Hladky a écrit :
> I have now changed it to
> hwloc_obj[0] = hwloc_get_first_largest_obj_inside_cpuset(topology,
> cpuset);
> hwloc_obj[1] = hwloc_obj[0]->parent;
> and tried both
> hwloc_topology_insert_misc_object_by_parent (topology,  hwloc_obj[0],
> data);
> hwloc_topology_insert_misc_object_by_parent (topology,  hwloc_obj[1],
> data);
>
> but lstopo will core dump with the XML file
> $lstopo --input /tmp/a.xml 
> lstopo: topology.c:1128: add_default_object_sets: Assertion
> `obj->cpuset' failed.
> Aborted (core dumped)
>

Should be fixed with the attached patch (already applied to trunk and
stable branches).
Things were totally buggy, looks like you were the very first one to
play with this and XML :)
thanks
Brice

commit c2d0c5c455c147276f364acf7e92a40d53f66f55
Author: bgoglin 
List-Post: hwloc-devel@lists.open-mpi.org
Date:   Mon Jun 24 09:59:38 2013 +

core: fix support for Misc objects added by parent

Looks like nobody ever tried to load a XML that contains a Misc
added by parent, it has been broken for ever.

When added by cpuset, Misc get a cpuset as any object. Nothing to do.
When added by parent, they become a new leaf, so they need either empty
or NULL sets. Empty sets require lots of hacks to be properly handled by
the core (so that they don't get ignored). So we keep using NULL sets
instead and just fix a couple places to properly handle them (like I/O).

By the way, cleanup the addition of default object sets.

Thanks to Jirka Hladky for the report.



git-svn-id: https://svn.open-mpi.org/svn/hwloc/trunk@5710 4b44e086-7f34-40ce-a3bd-00e031736276

diff --git a/src/topology.c b/src/topology.c
index e48bb81..8fad8dc 100644
--- a/src/topology.c
+++ b/src/topology.c
@@ -1205,11 +1205,18 @@ add_default_object_sets(hwloc_obj_t obj, int parent_has_sets)
   if (hwloc_obj_type_is_io(obj->type))
 return;

-  if (parent_has_sets || obj->cpuset) {
-/* if the parent has non-NULL sets, or if the object has non-NULL cpusets,
- * it must have non-NULL nodesets
- */
+  if (parent_has_sets && obj->type != HWLOC_OBJ_MISC) {
+/* non-MISC object must have cpuset if parent has one. */
 assert(obj->cpuset);
+  }
+
+  /* other sets must be consistent with main cpuset:
+   * check cpusets and add nodesets if needed.
+   *
+   * MISC may have no sets at all (if added by parent), or usual ones (if added by cpuset),
+   * but that's not easy to detect, so just make sure sets are consistent as usual.
+   */
+  if (obj->cpuset) {
 assert(obj->online_cpuset);
 assert(obj->complete_cpuset);
 assert(obj->allowed_cpuset);
@@ -1220,9 +1227,9 @@ add_default_object_sets(hwloc_obj_t obj, int parent_has_sets)
 if (!obj->allowed_nodeset)
   obj->allowed_nodeset = hwloc_bitmap_alloc_full();
   } else {
-/* parent has no sets and object has NULL cpusets,
- * it must have NULL nodesets
- */
+assert(!obj->online_cpuset);
+assert(!obj->complete_cpuset);
+assert(!obj->allowed_cpuset);
 assert(!obj->nodeset);
 assert(!obj->complete_nodeset);
 assert(!obj->allowed_nodeset);
@@ -1516,7 +1523,7 @@ remove_empty(hwloc_topology_t topology, hwloc_obj_t *pobj)

   if (obj->type != HWLOC_OBJ_NODE
   && !obj->first_child /* only remove if all children were removed above, so that we don't remove parents of NUMAnode */
-  && !hwloc_obj_type_is_io(obj->type)
+  && !hwloc_obj_type_is_io(obj->type) && obj->type != HWLOC_OBJ_MISC
   && obj->cpuset /* don't remove if no cpuset at all, there's likely a good reason why it's different from having an empty cpuset */
   && hwloc_bitmap_iszero(obj->cpuset)) {
 /* Remove empty children */


Re: [hwloc-devel] lstopo --top

2013-06-21 Thread Brice Goglin
Le 21/06/2013 17:59, Jiri Hladky a écrit :
> Hi Brice,
>
> this would be useful feature for me and I believe also for others!
> Currently

The attached patch puts Misc object in Orange. See how I modified
lstopo.c, you'll see what you have to do. I can easily add the same
check to other types.

>
> hwloc_topology_insert_misc_object_by_cpuset
>
> is quite dump. BTW, would it be possible to display the Misc objects
> in the order they were added? Inspecting XML file
> => hwloc_topology_insert_misc_object_by_cpuset will sort the objects

They are sorted by name from I see in the code, I don't remember why.
Quick guess would be that we need a deterministic order, and sorting by
name is one choice.
Anyway you should change your Misc object names by adding 0 characters
as prefix, it should work.

> =>hwloc_topology_insert_misc_object_by_parent does NOT sort the object
> but XML is not parsable by lstopo

I need to dig into that.

Brice

diff --git a/utils/lstopo-draw.c b/utils/lstopo-draw.c
index cc582c5..e1a6cb0 100644
--- a/utils/lstopo-draw.c
+++ b/utils/lstopo-draw.c
@@ -826,6 +826,8 @@ misc_draw(hwloc_topology_t topology, struct draw_methods *methods, int logical,
   unsigned mywidth = 0, totwidth;
   unsigned textwidth = level->name ? strlen(level->name) * fontsize : 6*fontsize;
   int vert = prefer_vert(topology, logical, level, output, depth, x, y, gridsize);
+  unsigned rcolor, gcolor, bcolor;
+  const char *color;

   DYNA_CHECK();

@@ -834,7 +836,13 @@ misc_draw(hwloc_topology_t topology, struct draw_methods *methods, int logical,
   else
 RECURSE_HORIZ(level, _draw_methods, gridsize, 0);

-  methods->box(output, MISC_R_COLOR, MISC_G_COLOR, MISC_B_COLOR, depth, x, totwidth, y, boxheight);
+  rcolor = MISC_R_COLOR;
+  gcolor = MISC_G_COLOR;
+  bcolor = MISC_B_COLOR;
+  color = hwloc_obj_get_info_by_name(level, "lstopoColor");
+  if (color)
+sscanf(color, "%x:%x:%x", , , );
+  methods->box(output, rcolor, gcolor, bcolor, depth, x, totwidth, y, totheight);

   if (fontsize) {
 if (level->name) {
diff --git a/utils/lstopo.c b/utils/lstopo.c
index 7c2d6d6..727ec17 100644
--- a/utils/lstopo.c
+++ b/utils/lstopo.c
@@ -73,6 +73,7 @@ static hwloc_obj_t insert_task(hwloc_topology_t topology, hwloc_cpuset_t cpuset,

   /* try to insert at exact position */
   obj = hwloc_topology_insert_misc_object_by_cpuset(topology, cpuset, name);
+  hwloc_obj_add_info(obj, "lstopoColor", "ff:88:00");
   if (!obj) {
 /* try to insert in a larger parent */
 char *s;


Re: [hwloc-devel] lstopo --top

2013-06-21 Thread Jiri Hladky
I have checked API of hwloc_topology_insert_misc_object_by_parent and there
is no support for color:


hwloc_obj_t hwloc_topology_insert_misc_object_by_cpuset (hwloc_topology_t
topology, hwloc_const_cpuset_t cpuset, const char *name)
  Add a MISC object to the topology.
hwloc_obj_t hwloc_topology_insert_misc_object_by_parent (hwloc_topology_t
topology, hwloc_obj_t parent, const char *name)
  Add a MISC object as a leaf of the topology.

Nevertheless I gave it a try but i cannot get it running. Original code
(using cpuset) was

hwloc_bitmap_zero(cpuset);
hwloc_bitmap_set(cpuset, d->lines[j]->cpu[i]);
snprintf(data, 128, "%d: %d", i, d->lines[j]->cpu[0]);
hwloc_topology_insert_misc_object_by_cpuset(topology, cpuset, data);

I have now changed it to
hwloc_obj[0] = hwloc_get_first_largest_obj_inside_cpuset(topology, cpuset);
hwloc_obj[1] = hwloc_obj[0]->parent;
and tried both
hwloc_topology_insert_misc_object_by_parent (topology,  hwloc_obj[0], data);
hwloc_topology_insert_misc_object_by_parent (topology,  hwloc_obj[1], data);

but lstopo will core dump with the XML file
$lstopo --input /tmp/a.xml
lstopo: topology.c:1128: add_default_object_sets: Assertion `obj->cpuset'
failed.
Aborted (core dumped)

I have attached
- source code
- input file data
- out /tmp/a.xml

Commands to reproduce the problem;
gcc -Wall -Wextra -o parse parse.c -lhwloc
./parse data
lstopo --input /tmp/a.xml

Any idea what's wrong?

Thanks
Jirka


On Fri, Jun 21, 2013 at 2:20 PM, Samuel Thibault
wrote:

> Jiri Hladky, le Thu 20 Jun 2013 22:08:03 +0200, a écrit :
> > lstopo has obviously some logic how to sort the data inserted
> > by hwloc_topology_insert_misc_object_by_cpuset. Could be data displayed
> in the
> > same order as inserted?
>
> hwloc_topology_insert_misc_object_by_parent probably does that, you just
> need to replace the cpuset with an hwloc object.
>
> Samuel
> ___
> hwloc-devel mailing list
> hwloc-de...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel
>
/* vim: set expandtab cindent fdm=marker ts=2 sw=2: */

/*
gcc -Wall -Wextra -o parse parse.c -lhwloc
See also
hwloc-calc -p --hierarchical socket.core.PU pu:3
*/

#include 
#include 
#include 
#include 
#include 

FILE *util_Fopen (const char *path, const char *mode) {
  FILE *f;
  errno = 0;
  f = fopen (path, mode);
  if (f == NULL) {
fprintf (stdout, "\nOpening of %s failed: %s\n\n",
path, strerror (errno));
exit (EXIT_FAILURE);
return NULL; /* to eliminate a warning from the compiler */
  } else
return f;
}

int util_Fclose (FILE * f)
{
  int s;
  if (f == NULL)
return 0;
  errno = 0;
  s = fclose (f);
  if (s != 0)
fprintf (stdout, "\nClosing of file failed: %s\n\n", strerror (errno));
  return s;
}

int util_GetLine (FILE *infile, char *Line, char c) {
  size_t j;

  while (NULL != fgets (Line, 1024, infile)) { /* Not EOF and no error */
/* Find first non-white character in Line */
j = strspn (Line, " \t\r\f\v");
/* Discard blank lines and lines whose first non-white character is c */
if (Line[j] == '\n' ||  Line[j] == c) 
  continue;
else {
  char *p;
  /* If the character c appears, delete the rest of the line*/
  if ((p = strchr (Line, c)))
*p = '\0';

  else {
/* Remove the \n char at the end of line */
j = strlen (Line);
if (Line[j - 1] == '\n')
  Line[j - 1] = '\0';
  }
  return 0;
}
  }

  util_Fclose (infile);
  return -1;
  /*  util_Error ("GetLine: an error has occurred on reading"); */
}



//

void *util_Malloc (size_t size) {
  void *p;
  errno = 0;
  p = malloc (size);
  if (p == NULL) {
fprintf (stdout, "\nmalloc failed: %s\n\n", strerror (errno));
exit (EXIT_FAILURE);
return NULL; /* to eliminate a warning from the compiler */
  } else
return p;
}

void *util_Calloc (size_t count, size_t esize) {
  void *p;
  errno = 0;/* vim: set expandtab cindent fdm=marker ts=2 sw=2: */
  p = calloc (count, esize);
  if (p == NULL) {
fprintf (stdout, "\ncalloc failed: %s\n\n", strerror (errno));
exit (EXIT_FAILURE);
return NULL; /* to eliminate a warning from the compiler */
  } else
return p;
}

void *util_Realloc (void *ptr, size_t size) {
  void *p;
  errno = 0;
  p = realloc (ptr, size);
  if ((p == NULL) && (size != 0)) {
fprintf (stdout, "\nrealloc failed: %s\n\n", strerror (errno));
exit (EXIT_FAILURE);
return ptr;  /* to eliminate a warning from the compiler */
  } else
return p;

}

void *util_Free (void *p) {
  if (p == NULL)
return NULL;
  free (p);
  return NULL;
}

typedef struct {
  unsigned int *cpu;
  size_t used;
  size_t size;
} Line_t;

Line_t* initLine(size_t initialSize) {
  Line_t* l;
  l = (Line_t*) util_Malloc(sizeof(Line_t));
  l->cpu = (unsigned int 

Re: [hwloc-devel] lstopo --top

2013-06-21 Thread Samuel Thibault
Jiri Hladky, le Thu 20 Jun 2013 22:08:03 +0200, a écrit :
> lstopo has obviously some logic how to sort the data inserted
> by hwloc_topology_insert_misc_object_by_cpuset. Could be data displayed in the
> same order as inserted?

hwloc_topology_insert_misc_object_by_parent probably does that, you just
need to replace the cpuset with an hwloc object.

Samuel


Re: [hwloc-devel] lstopo --top

2013-06-21 Thread Brice Goglin
I don't think there's currently any way to do that. Coloring Misc
objects with user-given colors shouldn't be hard to do, assuming we have
a real need to put that feature in the official hwloc?

Brice


Le 20/06/2013 21:33, Jiri Hladky a écrit :
>
>
> On Tue, Jun 18, 2013 at 5:32 PM, Samuel Thibault
> > wrote:
>
> Hello,
>
> Jiri Hladky, le Tue 18 Jun 2013 17:18:15 +0200, a écrit :
> > I would like to check the possibilities to visualize the results
> to the output
> > similar to lstopo --top (see the attachment). I would like to
> write a simple
> > utility which will
> >  * parse the above file
> >  * foreach timestep create an output similar to lstopo --top
> output showing,
> > where each job was running
>
> It should be easy to do: create a program which
>
> - detects the topology as usual
> - for each of these lines:
> PID #CPU #CPU #CPU #CPU
> PID #CPU #CPU #CPU
> call hwloc_topology_insert_misc_object_by_cpuset(topology, cpuset,
> PID)
> - export the topology as xml file.
>
> and then for each job output, run it and run lstopo on the
> generated xml
> file.
>
> Samuel
> ___
> hwloc-devel mailing list
> hwloc-de...@open-mpi.org 
> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel
>
>
> Hi Samuel,
>
> thanks for the advice, I got it working! :-) It's a little bit
> overhead with a XML file but the C program is really short and easy.
>
> Now comes a hard question - can the background color of the created
> box in lstopo output be easily changed? The idea is to have time axes
> color coded. So for the format
>
> PID #CPU #CPU #CPU #CPU
> PID #CPU #CPU #CPU
>
> For time=1 use color red
> For time=2 use color blue
>
> and so on. The idea is to display the file above in one PNG picture so
> that you can easily see if more jobs were running on the same CPU
> simultaneously.
>
> Thanks
> Jirka
>
>
> ___
> hwloc-devel mailing list
> hwloc-de...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel



Re: [hwloc-devel] lstopo --top

2013-06-20 Thread Jiri Hladky
Hi Samuel,

lstopo has obviously some logic how to sort the data inserted
by hwloc_topology_insert_misc_object_by_cpuset. Could be data displayed in
the same order as inserted?

While parsing
245 0 0 0 0 0 1 1 3 0 0
246 1 1 1 1 1 2 2 3 1 1

I'm trying to display the data in lstopo in format
time: PID

However, data are inserted in the different order. See attached png.

I have called hwloc_topology_insert_misc_object_by_cpuset in this
chronological order:
1: 245
1: 246
2: 245
2: 246
3: 245
3: 246
4: 245
4: 246
5: 245
5: 246
6: 245
6: 246
7: 245
7: 246
8: 245
8: 246
9: 245
9: 246
10: 245
10: 246

Thanks
Jirka

On Thu, Jun 20, 2013 at 9:33 PM, Jiri Hladky  wrote:

>
>
> On Tue, Jun 18, 2013 at 5:32 PM, Samuel Thibault  > wrote:
>
>> Hello,
>>
>> Jiri Hladky, le Tue 18 Jun 2013 17:18:15 +0200, a écrit :
>> > I would like to check the possibilities to visualize the results to the
>> output
>> > similar to lstopo --top (see the attachment). I would like to write a
>> simple
>> > utility which will
>> >  * parse the above file
>> >  * foreach timestep create an output similar to lstopo --top output
>> showing,
>> > where each job was running
>>
>> It should be easy to do: create a program which
>>
>> - detects the topology as usual
>> - for each of these lines:
>> PID #CPU #CPU #CPU #CPU
>> PID #CPU #CPU #CPU
>> call hwloc_topology_insert_misc_object_by_cpuset(topology, cpuset, PID)
>> - export the topology as xml file.
>>
>> and then for each job output, run it and run lstopo on the generated xml
>> file.
>>
>> Samuel
>> ___
>> hwloc-devel mailing list
>> hwloc-de...@open-mpi.org
>> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel
>>
>
> Hi Samuel,
>
> thanks for the advice, I got it working! :-) It's a little bit overhead
> with a XML file but the C program is really short and easy.
>
> Now comes a hard question - can the background color of the created box in
> lstopo output be easily changed? The idea is to have time axes color coded.
> So for the format
>
> PID #CPU #CPU #CPU #CPU
> PID #CPU #CPU #CPU
>
> For time=1 use color red
> For time=2 use color blue
>
> and so on. The idea is to display the file above in one PNG picture so
> that you can easily see if more jobs were running on the same CPU
> simultaneously.
>
> Thanks
> Jirka
>



  
























  
  
  

  

  

  

  

  

  

  

  

  
  

  

  

  

  

  

  

  

  

  

  


  

  

  

  
  

  

  

  

  

  



Re: [hwloc-devel] lstopo --top

2013-06-20 Thread Jiri Hladky
On Tue, Jun 18, 2013 at 5:32 PM, Samuel Thibault
wrote:

> Hello,
>
> Jiri Hladky, le Tue 18 Jun 2013 17:18:15 +0200, a écrit :
> > I would like to check the possibilities to visualize the results to the
> output
> > similar to lstopo --top (see the attachment). I would like to write a
> simple
> > utility which will
> >  * parse the above file
> >  * foreach timestep create an output similar to lstopo --top output
> showing,
> > where each job was running
>
> It should be easy to do: create a program which
>
> - detects the topology as usual
> - for each of these lines:
> PID #CPU #CPU #CPU #CPU
> PID #CPU #CPU #CPU
> call hwloc_topology_insert_misc_object_by_cpuset(topology, cpuset, PID)
> - export the topology as xml file.
>
> and then for each job output, run it and run lstopo on the generated xml
> file.
>
> Samuel
> ___
> hwloc-devel mailing list
> hwloc-de...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel
>

Hi Samuel,

thanks for the advice, I got it working! :-) It's a little bit overhead
with a XML file but the C program is really short and easy.

Now comes a hard question - can the background color of the created box in
lstopo output be easily changed? The idea is to have time axes color coded.
So for the format

PID #CPU #CPU #CPU #CPU
PID #CPU #CPU #CPU

For time=1 use color red
For time=2 use color blue

and so on. The idea is to display the file above in one PNG picture so that
you can easily see if more jobs were running on the same CPU simultaneously.

Thanks
Jirka


Re: [hwloc-devel] lstopo --top

2013-06-18 Thread Samuel Thibault
Hello,

Jiri Hladky, le Tue 18 Jun 2013 17:18:15 +0200, a écrit :
> I would like to check the possibilities to visualize the results to the output
> similar to lstopo --top (see the attachment). I would like to write a simple
> utility which will
>  * parse the above file
>  * foreach timestep create an output similar to lstopo --top output showing,
> where each job was running

It should be easy to do: create a program which

- detects the topology as usual
- for each of these lines:
PID #CPU #CPU #CPU #CPU
PID #CPU #CPU #CPU
call hwloc_topology_insert_misc_object_by_cpuset(topology, cpuset, PID)
- export the topology as xml file.

and then for each job output, run it and run lstopo on the generated xml
file.

Samuel