PULSAR  1.0.0
Parallel Ultra Light Systolic Array Runtime
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
svg_trace.h File Reference

SVG tracing. More...

#include <stdio.h>
#include <assert.h>
#include <pthread.h>
#include <sys/time.h>
#include <mpi.h>
Include dependency graph for svg_trace.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SVG_TRACE_MAX_CORES   256
 maximum values cores per node, events per core, maximum size of trace file name More...
 
#define SVG_TRACE_MAX_EVENTS   65536
 
#define SVG_TRACE_FILE_NAME_SIZE   64
 

Enumerations

enum  {
  Pink = 0xFFC0CB, LightPink = 0xFFB6C1, HotPink = 0xFF69B4, DeepPink = 0xFF1493,
  PaleVioletRed = 0xDB7093, MediumVioletRed = 0xC71585, LightSalmon = 0xFFA07A, Salmon = 0xFA8072,
  DarkSalmon = 0xE9967A, LightCoral = 0xF08080, IndianRed = 0xCD5C5C, Crimson = 0xDC143C,
  FireBrick = 0xB22222, DarkRed = 0x8B0000, Red = 0xFF0000, OrangeRed = 0xFF4500,
  Tomato = 0xFF6347, Coral = 0xFF7F50, DarkOrange = 0xFF8C00, Orange = 0xFFA500,
  Gold = 0xFFD700, Yellow = 0xFFFF00, LightYellow = 0xFFFFE0, LemonChiffon = 0xFFFACD,
  LightGoldenrodYellow = 0xFAFAD2, PapayaWhip = 0xFFEFD5, Moccasin = 0xFFE4B5, PeachPuff = 0xFFDAB9,
  PaleGoldenrod = 0xEEE8AA, Khaki = 0xF0E68C, DarkKhaki = 0xBDB76B, Cornsilk = 0xFFF8DC,
  BlanchedAlmond = 0xFFEBCD, Bisque = 0xFFE4C4, NavajoWhite = 0xFFDEAD, Wheat = 0xF5DEB3,
  BurlyWood = 0xDEB887, Tan = 0xD2B48C, RosyBrown = 0xBC8F8F, SandyBrown = 0xF4A460,
  Goldenrod = 0xDAA520, DarkGoldenrod = 0xB8860B, Peru = 0xCD853F, Chocolate = 0xD2691E,
  SaddleBrown = 0x8B4513, Sienna = 0xA0522D, Brown = 0xA52A2A, Maroon = 0x800000,
  DarkOliveGreen = 0x556B2F, Olive = 0x808000, OliveDrab = 0x6B8E23, YellowGreen = 0x9ACD32,
  LimeGreen = 0x32CD32, Lime = 0x00FF00, LawnGreen = 0x7CFC00, Chartreuse = 0x7FFF00,
  GreenYellow = 0xADFF2F, SpringGreen = 0x00FF7F, MediumSpringGreen = 0x00FA9A, LightGreen = 0x90EE90,
  PaleGreen = 0x98FB98, DarkSeaGreen = 0x8FBC8F, MediumSeaGreen = 0x3CB371, SeaGreen = 0x2E8B57,
  ForestGreen = 0x228B22, Green = 0x008000, DarkGreen = 0x006400, MediumAquamarine = 0x66CDAA,
  Aqua = 0x00FFFF, Cyan = 0x00FFFF, LightCyan = 0xE0FFFF, PaleTurquoise = 0xAFEEEE,
  Aquamarine = 0x7FFFD4, Turquoise = 0x40E0D0, MediumTurquoise = 0x48D1CC, DarkTurquoise = 0x00CED1,
  LightSeaGreen = 0x20B2AA, CadetBlue = 0x5F9EA0, DarkCyan = 0x008B8B, Teal = 0x008080,
  LightSteelBlue = 0xB0C4DE, PowderBlue = 0xB0E0E6, LightBlue = 0xADD8E6, SkyBlue = 0x87CEEB,
  LightSkyBlue = 0x87CEFA, DeepSkyBlue = 0x00BFFF, DodgerBlue = 0x1E90FF, CornflowerBlue = 0x6495ED,
  SteelBlue = 0x4682B4, RoyalBlue = 0x4169E1, Blue = 0x0000FF, MediumBlue = 0x0000CD,
  DarkBlue = 0x00008B, Navy = 0x000080, MidnightBlue = 0x191970, Lavender = 0xE6E6FA,
  Thistle = 0xD8BFD8, Plum = 0xDDA0DD, Violet = 0xEE82EE, Orchid = 0xDA70D6,
  Fuchsia = 0xFF00FF, Magenta = 0xFF00FF, MediumOrchid = 0xBA55D3, MediumPurple = 0x9370DB,
  BlueViolet = 0x8A2BE2, DarkViolet = 0x9400D3, DarkOrchid = 0x9932CC, DarkMagenta = 0x8B008B,
  Purple = 0x800080, Indigo = 0x4B0082, DarkSlateBlue = 0x483D8B, SlateBlue = 0x6A5ACD,
  MediumSlateBlue = 0x7B68EE, White = 0xFFFFFF, Snow = 0xFFFAFA, Honeydew = 0xF0FFF0,
  MintCream = 0xF5FFFA, Azure = 0xF0FFFF, AliceBlue = 0xF0F8FF, GhostWhite = 0xF8F8FF,
  WhiteSmoke = 0xF5F5F5, Seashell = 0xFFF5EE, Beige = 0xF5F5DC, OldLace = 0xFDF5E6,
  FloralWhite = 0xFFFAF0, Ivory = 0xFFFFF0, AntiqueWhite = 0xFAEBD7, Linen = 0xFAF0E6,
  LavenderBlush = 0xFFF0F5, MistyRose = 0xFFE4E1, Gainsboro = 0xDCDCDC, LightGray = 0xD3D3D3,
  Silver = 0xC0C0C0, DarkGray = 0xA9A9A9, Gray = 0x808080, DimGray = 0x696969,
  LightSlateGray = 0x778899, SlateGray = 0x708090, DarkSlateGray = 0x2F4F4F, Black = 0x000000
}
 Web colors http://en.wikipedia.org/wiki/Web_colors. More...
 

Functions

void svg_trace_init (int num_cores)
 Initialize tracing. More...
 
void svg_trace_start (int thread_rank)
 Start tracing an event. More...
 
void svg_trace_stop (int thread_rank, int color)
 Stop tracing an event. More...
 
void svg_trace_finish ()
 Finish tracing. Collect traces from all nodes. Write the combined trace to an SVG file. More...
 

Detailed Description

SVG tracing.

Author
Jakub Kurzak

PULSAR Runtime http://icl.eecs.utk.edu/pulsar/ Copyright (C) 2012-2013 University of Tennessee.

Definition in file svg_trace.h.

Macro Definition Documentation

#define SVG_TRACE_FILE_NAME_SIZE   64

Definition at line 31 of file svg_trace.h.

#define SVG_TRACE_MAX_CORES   256

maximum values cores per node, events per core, maximum size of trace file name

Definition at line 29 of file svg_trace.h.

#define SVG_TRACE_MAX_EVENTS   65536

Definition at line 30 of file svg_trace.h.

Enumeration Type Documentation

anonymous enum

Web colors http://en.wikipedia.org/wiki/Web_colors.

Enumerator
Pink 
LightPink 
HotPink 
DeepPink 
PaleVioletRed 
MediumVioletRed 
LightSalmon 
Salmon 
DarkSalmon 
LightCoral 
IndianRed 
Crimson 
FireBrick 
DarkRed 
Red 
OrangeRed 
Tomato 
Coral 
DarkOrange 
Orange 
Gold 
Yellow 
LightYellow 
LemonChiffon 
LightGoldenrodYellow 
PapayaWhip 
Moccasin 
PeachPuff 
PaleGoldenrod 
Khaki 
DarkKhaki 
Cornsilk 
BlanchedAlmond 
Bisque 
NavajoWhite 
Wheat 
BurlyWood 
Tan 
RosyBrown 
SandyBrown 
Goldenrod 
DarkGoldenrod 
Peru 
Chocolate 
SaddleBrown 
Sienna 
Brown 
Maroon 
DarkOliveGreen 
Olive 
OliveDrab 
YellowGreen 
LimeGreen 
Lime 
LawnGreen 
Chartreuse 
GreenYellow 
SpringGreen 
MediumSpringGreen 
LightGreen 
PaleGreen 
DarkSeaGreen 
MediumSeaGreen 
SeaGreen 
ForestGreen 
Green 
DarkGreen 
MediumAquamarine 
Aqua 
Cyan 
LightCyan 
PaleTurquoise 
Aquamarine 
Turquoise 
MediumTurquoise 
DarkTurquoise 
LightSeaGreen 
CadetBlue 
DarkCyan 
Teal 
LightSteelBlue 
PowderBlue 
LightBlue 
SkyBlue 
LightSkyBlue 
DeepSkyBlue 
DodgerBlue 
CornflowerBlue 
SteelBlue 
RoyalBlue 
Blue 
MediumBlue 
DarkBlue 
Navy 
MidnightBlue 
Lavender 
Thistle 
Plum 
Violet 
Orchid 
Fuchsia 
Magenta 
MediumOrchid 
MediumPurple 
BlueViolet 
DarkViolet 
DarkOrchid 
DarkMagenta 
Purple 
Indigo 
DarkSlateBlue 
SlateBlue 
MediumSlateBlue 
White 
Snow 
Honeydew 
MintCream 
Azure 
AliceBlue 
GhostWhite 
WhiteSmoke 
Seashell 
Beige 
OldLace 
FloralWhite 
Ivory 
AntiqueWhite 
Linen 
LavenderBlush 
MistyRose 
Gainsboro 
LightGray 
Silver 
DarkGray 
Gray 
DimGray 
LightSlateGray 
SlateGray 
DarkSlateGray 
Black 

Definition at line 37 of file svg_trace.h.

37  {
38  Pink = 0xFFC0CB,
39  LightPink = 0xFFB6C1,
40  HotPink = 0xFF69B4,
41  DeepPink = 0xFF1493,
42  PaleVioletRed = 0xDB7093,
43  MediumVioletRed = 0xC71585,
44  LightSalmon = 0xFFA07A,
45  Salmon = 0xFA8072,
46  DarkSalmon = 0xE9967A,
47  LightCoral = 0xF08080,
48  IndianRed = 0xCD5C5C,
49  Crimson = 0xDC143C,
50  FireBrick = 0xB22222,
51  DarkRed = 0x8B0000,
52  Red = 0xFF0000,
53  OrangeRed = 0xFF4500,
54  Tomato = 0xFF6347,
55  Coral = 0xFF7F50,
56  DarkOrange = 0xFF8C00,
57  Orange = 0xFFA500,
58  Gold = 0xFFD700,
59  Yellow = 0xFFFF00,
60  LightYellow = 0xFFFFE0,
61  LemonChiffon = 0xFFFACD,
62  LightGoldenrodYellow = 0xFAFAD2,
63  PapayaWhip = 0xFFEFD5,
64  Moccasin = 0xFFE4B5,
65  PeachPuff = 0xFFDAB9,
66  PaleGoldenrod = 0xEEE8AA,
67  Khaki = 0xF0E68C,
68  DarkKhaki = 0xBDB76B,
69  Cornsilk = 0xFFF8DC,
70  BlanchedAlmond = 0xFFEBCD,
71  Bisque = 0xFFE4C4,
72  NavajoWhite = 0xFFDEAD,
73  Wheat = 0xF5DEB3,
74  BurlyWood = 0xDEB887,
75  Tan = 0xD2B48C,
76  RosyBrown = 0xBC8F8F,
77  SandyBrown = 0xF4A460,
78  Goldenrod = 0xDAA520,
79  DarkGoldenrod = 0xB8860B,
80  Peru = 0xCD853F,
81  Chocolate = 0xD2691E,
82  SaddleBrown = 0x8B4513,
83  Sienna = 0xA0522D,
84  Brown = 0xA52A2A,
85  Maroon = 0x800000,
86  DarkOliveGreen = 0x556B2F,
87  Olive = 0x808000,
88  OliveDrab = 0x6B8E23,
89  YellowGreen = 0x9ACD32,
90  LimeGreen = 0x32CD32,
91  Lime = 0x00FF00,
92  LawnGreen = 0x7CFC00,
93  Chartreuse = 0x7FFF00,
94  GreenYellow = 0xADFF2F,
95  SpringGreen = 0x00FF7F,
96  MediumSpringGreen = 0x00FA9A,
97  LightGreen = 0x90EE90,
98  PaleGreen = 0x98FB98,
99  DarkSeaGreen = 0x8FBC8F,
100  MediumSeaGreen = 0x3CB371,
101  SeaGreen = 0x2E8B57,
102  ForestGreen = 0x228B22,
103  Green = 0x008000,
104  DarkGreen = 0x006400,
105  MediumAquamarine = 0x66CDAA,
106  Aqua = 0x00FFFF,
107  Cyan = 0x00FFFF,
108  LightCyan = 0xE0FFFF,
109  PaleTurquoise = 0xAFEEEE,
110  Aquamarine = 0x7FFFD4,
111  Turquoise = 0x40E0D0,
112  MediumTurquoise = 0x48D1CC,
113  DarkTurquoise = 0x00CED1,
114  LightSeaGreen = 0x20B2AA,
115  CadetBlue = 0x5F9EA0,
116  DarkCyan = 0x008B8B,
117  Teal = 0x008080,
118  LightSteelBlue = 0xB0C4DE,
119  PowderBlue = 0xB0E0E6,
120  LightBlue = 0xADD8E6,
121  SkyBlue = 0x87CEEB,
122  LightSkyBlue = 0x87CEFA,
123  DeepSkyBlue = 0x00BFFF,
124  DodgerBlue = 0x1E90FF,
125  CornflowerBlue = 0x6495ED,
126  SteelBlue = 0x4682B4,
127  RoyalBlue = 0x4169E1,
128  Blue = 0x0000FF,
129  MediumBlue = 0x0000CD,
130  DarkBlue = 0x00008B,
131  Navy = 0x000080,
132  MidnightBlue = 0x191970,
133  Lavender = 0xE6E6FA,
134  Thistle = 0xD8BFD8,
135  Plum = 0xDDA0DD,
136  Violet = 0xEE82EE,
137  Orchid = 0xDA70D6,
138  Fuchsia = 0xFF00FF,
139  Magenta = 0xFF00FF,
140  MediumOrchid = 0xBA55D3,
141  MediumPurple = 0x9370DB,
142  BlueViolet = 0x8A2BE2,
143  DarkViolet = 0x9400D3,
144  DarkOrchid = 0x9932CC,
145  DarkMagenta = 0x8B008B,
146  Purple = 0x800080,
147  Indigo = 0x4B0082,
148  DarkSlateBlue = 0x483D8B,
149  SlateBlue = 0x6A5ACD,
150  MediumSlateBlue = 0x7B68EE,
151  White = 0xFFFFFF,
152  Snow = 0xFFFAFA,
153  Honeydew = 0xF0FFF0,
154  MintCream = 0xF5FFFA,
155  Azure = 0xF0FFFF,
156  AliceBlue = 0xF0F8FF,
157  GhostWhite = 0xF8F8FF,
158  WhiteSmoke = 0xF5F5F5,
159  Seashell = 0xFFF5EE,
160  Beige = 0xF5F5DC,
161  OldLace = 0xFDF5E6,
162  FloralWhite = 0xFFFAF0,
163  Ivory = 0xFFFFF0,
164  AntiqueWhite = 0xFAEBD7,
165  Linen = 0xFAF0E6,
166  LavenderBlush = 0xFFF0F5,
167  MistyRose = 0xFFE4E1,
168  Gainsboro = 0xDCDCDC,
169  LightGray = 0xD3D3D3,
170  Silver = 0xC0C0C0,
171  DarkGray = 0xA9A9A9,
172  Gray = 0x808080,
173  DimGray = 0x696969,
174  LightSlateGray = 0x778899,
175  SlateGray = 0x708090,
176  DarkSlateGray = 0x2F4F4F,
177  Black = 0x000000
178 };
Definition: svg_trace.h:58
Definition: svg_trace.h:38
Definition: svg_trace.h:80
Definition: svg_trace.h:52
Definition: svg_trace.h:75
Definition: svg_trace.h:91

Function Documentation

void svg_trace_finish ( )

Finish tracing. Collect traces from all nodes. Write the combined trace to an SVG file.

Definition at line 78 of file svg_trace.c.

References SVG_TRACE_FILE_NAME_SIZE, SVG_TRACE_MAX_CORES, and SVG_TRACE_MAX_EVENTS.

79 {
80  int mpi_rank;
81  int mpi_size;
82  MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
83  MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
84 
85  int proc;
86  int core;
87  int event;
88  double max_time = 0.0;
89  for (core = 0; core < SVG_TRACE_MAX_CORES; core++) {
90  double time =
91  eventStopCore [core][eventNumCore[core]-1] -
92  eventStopCore[0][0];
93  if (time > max_time)
94  max_time = time;
95  }
96  double max_time_out;
97  MPI_Reduce(
98  &max_time, &max_time_out, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
99  double hscale = 2000.0 / max_time_out;
100 
101  int max_core_in = 0;
102  for (core = 0; core < SVG_TRACE_MAX_CORES; core++)
103  if (eventNumCore[core] > 1)
104  max_core_in = core;
105  int max_core;
106  MPI_Reduce(
107  &max_core_in, &max_core, 1, MPI_INT, MPI_MAX, 0, MPI_COMM_WORLD);
108  double vscale = 1000.0 / ((max_core+1)*mpi_size);
109 
110  if (mpi_rank == 0) {
111  char trace_file_name[SVG_TRACE_FILE_NAME_SIZE];
112  sprintf(trace_file_name, "trace_%d.svg", (int)(time(NULL)));
113  FILE *trace_file = fopen(trace_file_name, "w");
114  assert(trace_file != NULL);
115  fprintf(trace_file,
116  "<svg width=\"200mm\" height=\"100mm\" viewBox=\"0 0 2000 1000\">\n"
117  " <g>\n");
118 
119  for (proc = 0; proc < mpi_size; proc++) {
120  if (proc > 0) {
121  MPI_Recv(
122  &eventNumCore[0],
123  SVG_TRACE_MAX_CORES*SVG_TRACE_MAX_EVENTS, MPI_INT,
124  proc, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
125  MPI_Recv(
126  &eventStartCore[0][0],
127  SVG_TRACE_MAX_CORES*SVG_TRACE_MAX_EVENTS, MPI_DOUBLE,
128  proc, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
129  MPI_Recv(
130  &eventStopCore[0][0],
131  SVG_TRACE_MAX_CORES*SVG_TRACE_MAX_EVENTS, MPI_DOUBLE,
132  proc, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
133  MPI_Recv(
134  &eventColorCore[0][0],
135  SVG_TRACE_MAX_CORES*SVG_TRACE_MAX_EVENTS, MPI_INT,
136  proc, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
137  }
138  for (core = 0; core < SVG_TRACE_MAX_CORES; core++) {
139  for (event = 0; event < eventNumCore[core]; event++) {
140  double start = eventStartCore[core][event] - eventStopCore[0][0];
141  double stop = eventStopCore [core][event] - eventStopCore[0][0];
142  double width = (stop-start) * hscale;
143  int color = eventColorCore[core][event];
144  int thread = proc*(max_core+1)+core;
145  fprintf(trace_file,
146  " "
147  "<rect x=\"%.2lf\" y=\"%.0lf\" width=\"%.2lf\" height=\"%.0lf\" "
148  "fill=\"#%06x\" stroke=\"#%06x\" stroke-width=\"1\"/>\n",
149  start * hscale,
150  thread * vscale,
151  width < 2.0 ? 2.0 : width,
152  vscale * 0.9,
153  abs(color),
154  color < 0 ? color : 0);
155  }
156  }
157  }
158  fprintf(trace_file,
159  " </g>\n"
160  "</svg>\n");
161  fclose(trace_file);
162  }
163  else {
164  MPI_Send(
165  &eventNumCore[0],
166  SVG_TRACE_MAX_CORES*SVG_TRACE_MAX_EVENTS,
167  MPI_INT, 0, 0, MPI_COMM_WORLD);
168  MPI_Send(
169  &eventStartCore[0][0],
170  SVG_TRACE_MAX_CORES*SVG_TRACE_MAX_EVENTS,
171  MPI_DOUBLE, 0, 0, MPI_COMM_WORLD);
172  MPI_Send(
173  &eventStopCore[0][0],
174  SVG_TRACE_MAX_CORES*SVG_TRACE_MAX_EVENTS,
175  MPI_DOUBLE, 0, 0, MPI_COMM_WORLD);
176  MPI_Send(
177  &eventColorCore[0][0],
178  SVG_TRACE_MAX_CORES*SVG_TRACE_MAX_EVENTS,
179  MPI_INT, 0, 0, MPI_COMM_WORLD);
180  }
181 }
#define SVG_TRACE_MAX_CORES
maximum values cores per node, events per core, maximum size of trace file name
Definition: svg_trace.h:29
#define SVG_TRACE_FILE_NAME_SIZE
Definition: svg_trace.h:31
#define SVG_TRACE_MAX_EVENTS
Definition: svg_trace.h:30

Here is the caller graph for this function:

void svg_trace_init ( int  num_cores)

Initialize tracing.

Parameters
num_cores

Definition at line 38 of file svg_trace.c.

References SVG_TRACE_MAX_CORES, and SVG_TRACE_MAX_EVENTS.

39 {
40  assert(num_cores <= SVG_TRACE_MAX_CORES);
41  assert(__builtin_popcount(SVG_TRACE_MAX_EVENTS) == 0x01);
42 }
#define SVG_TRACE_MAX_CORES
maximum values cores per node, events per core, maximum size of trace file name
Definition: svg_trace.h:29
#define SVG_TRACE_MAX_EVENTS
Definition: svg_trace.h:30

Here is the caller graph for this function:

void svg_trace_start ( int  thread_rank)

Start tracing an event.

Parameters
rankthread rank

Definition at line 50 of file svg_trace.c.

References SVG_TRACE_MAX_CORES.

51 {
52  assert(thread_rank < SVG_TRACE_MAX_CORES);
53  eventStartCore[thread_rank][eventNumCore[thread_rank]] = get_time_of_day();
54 }
#define SVG_TRACE_MAX_CORES
maximum values cores per node, events per core, maximum size of trace file name
Definition: svg_trace.h:29

Here is the caller graph for this function:

void svg_trace_stop ( int  thread_rank,
int  color 
)

Stop tracing an event.

Parameters
rankthread rank
colorRGB color

Definition at line 63 of file svg_trace.c.

References SVG_TRACE_MAX_CORES, and SVG_TRACE_MAX_EVENTS.

64 {
65  assert(thread_rank < SVG_TRACE_MAX_CORES);
66  eventStopCore [thread_rank][eventNumCore[thread_rank]] = get_time_of_day();
67  eventColorCore[thread_rank][eventNumCore[thread_rank]] = color;
68  eventNumCore[thread_rank]++;
69  eventNumCore[thread_rank] &= (SVG_TRACE_MAX_EVENTS-1);
70 }
#define SVG_TRACE_MAX_CORES
maximum values cores per node, events per core, maximum size of trace file name
Definition: svg_trace.h:29
#define SVG_TRACE_MAX_EVENTS
Definition: svg_trace.h:30

Here is the caller graph for this function: