PULSAR  2.0.0
Parallel Ultra-Light Systolic Array Runtime
 All Data Structures Files Functions Typedefs Enumerations Macros Groups
svg_trace.h
Go to the documentation of this file.
1 
11 #ifndef SVG_TRACE_H
12 #define SVG_TRACE_H
13 
14 #include <stdio.h>
15 #include <stdlib.h>
16 #include <assert.h>
17 #include <pthread.h>
18 #include <sys/time.h>
19 
20 #ifdef MPI
21  #include <mpi.h>
22 #else
23  #include "mpi_stubs.h"
24 #endif
25 
26  #ifdef CUDA
27  #include <cuda.h>
28  #include <cuda_runtime.h>
29 #else
30  #include "cuda_stubs.h"
31 #endif
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 // Need to be powers of two.
38 #define SVG_TRACE_MAX_CORES 64
39 #define SVG_TRACE_MAX_DEVICES 16
40 #define SVG_TRACE_MAX_EVENTS 65536
41 #define SVG_TRACE_MAX_MEM_SNAPSHOTS 65536
42 #define SVG_TRACE_FILE_NAME_SIZE 64
43 
48 enum {
49  Pink = 0xFFC0CB,
50  LightPink = 0xFFB6C1,
51  HotPink = 0xFF69B4,
52  DeepPink = 0xFF1493,
53  PaleVioletRed = 0xDB7093,
54  MediumVioletRed = 0xC71585,
55  LightSalmon = 0xFFA07A,
56  Salmon = 0xFA8072,
57  DarkSalmon = 0xE9967A,
58  LightCoral = 0xF08080,
59  IndianRed = 0xCD5C5C,
60  Crimson = 0xDC143C,
61  FireBrick = 0xB22222,
62  DarkRed = 0x8B0000,
63  Red = 0xFF0000,
64  OrangeRed = 0xFF4500,
65  Tomato = 0xFF6347,
66  Coral = 0xFF7F50,
67  DarkOrange = 0xFF8C00,
68  Orange = 0xFFA500,
69  Gold = 0xFFD700,
70  Yellow = 0xFFFF00,
71  LightYellow = 0xFFFFE0,
72  LemonChiffon = 0xFFFACD,
73  LightGoldenrodYellow = 0xFAFAD2,
74  PapayaWhip = 0xFFEFD5,
75  Moccasin = 0xFFE4B5,
76  PeachPuff = 0xFFDAB9,
77  PaleGoldenrod = 0xEEE8AA,
78  Khaki = 0xF0E68C,
79  DarkKhaki = 0xBDB76B,
80  Cornsilk = 0xFFF8DC,
81  BlanchedAlmond = 0xFFEBCD,
82  Bisque = 0xFFE4C4,
83  NavajoWhite = 0xFFDEAD,
84  Wheat = 0xF5DEB3,
85  BurlyWood = 0xDEB887,
86  Tan = 0xD2B48C,
87  RosyBrown = 0xBC8F8F,
88  SandyBrown = 0xF4A460,
89  Goldenrod = 0xDAA520,
90  DarkGoldenrod = 0xB8860B,
91  Peru = 0xCD853F,
92  Chocolate = 0xD2691E,
93  SaddleBrown = 0x8B4513,
94  Sienna = 0xA0522D,
95  Brown = 0xA52A2A,
96  Maroon = 0x800000,
97  DarkOliveGreen = 0x556B2F,
98  Olive = 0x808000,
99  OliveDrab = 0x6B8E23,
100  YellowGreen = 0x9ACD32,
101  LimeGreen = 0x32CD32,
102  Lime = 0x00FF00,
103  LawnGreen = 0x7CFC00,
104  Chartreuse = 0x7FFF00,
105  GreenYellow = 0xADFF2F,
106  SpringGreen = 0x00FF7F,
107  MediumSpringGreen = 0x00FA9A,
108  LightGreen = 0x90EE90,
109  PaleGreen = 0x98FB98,
110  DarkSeaGreen = 0x8FBC8F,
111  MediumSeaGreen = 0x3CB371,
112  SeaGreen = 0x2E8B57,
113  ForestGreen = 0x228B22,
114  Green = 0x008000,
115  DarkGreen = 0x006400,
116  MediumAquamarine = 0x66CDAA,
117  Aqua = 0x00FFFF,
118  Cyan = 0x00FFFF,
119  LightCyan = 0xE0FFFF,
120  PaleTurquoise = 0xAFEEEE,
121  Aquamarine = 0x7FFFD4,
122  Turquoise = 0x40E0D0,
123  MediumTurquoise = 0x48D1CC,
124  DarkTurquoise = 0x00CED1,
125  LightSeaGreen = 0x20B2AA,
126  CadetBlue = 0x5F9EA0,
127  DarkCyan = 0x008B8B,
128  Teal = 0x008080,
129  LightSteelBlue = 0xB0C4DE,
130  PowderBlue = 0xB0E0E6,
131  LightBlue = 0xADD8E6,
132  SkyBlue = 0x87CEEB,
133  LightSkyBlue = 0x87CEFA,
134  DeepSkyBlue = 0x00BFFF,
135  DodgerBlue = 0x1E90FF,
136  CornflowerBlue = 0x6495ED,
137  SteelBlue = 0x4682B4,
138  RoyalBlue = 0x4169E1,
139  Blue = 0x0000FF,
140  MediumBlue = 0x0000CD,
141  DarkBlue = 0x00008B,
142  Navy = 0x000080,
143  MidnightBlue = 0x191970,
144  Lavender = 0xE6E6FA,
145  Thistle = 0xD8BFD8,
146  Plum = 0xDDA0DD,
147  Violet = 0xEE82EE,
148  Orchid = 0xDA70D6,
149  Fuchsia = 0xFF00FF,
150  Magenta = 0xFF00FF,
151  MediumOrchid = 0xBA55D3,
152  MediumPurple = 0x9370DB,
153  BlueViolet = 0x8A2BE2,
154  DarkViolet = 0x9400D3,
155  DarkOrchid = 0x9932CC,
156  DarkMagenta = 0x8B008B,
157  Purple = 0x800080,
158  Indigo = 0x4B0082,
159  DarkSlateBlue = 0x483D8B,
160  SlateBlue = 0x6A5ACD,
161  MediumSlateBlue = 0x7B68EE,
162  White = 0xFFFFFF,
163  Snow = 0xFFFAFA,
164  Honeydew = 0xF0FFF0,
165  MintCream = 0xF5FFFA,
166  Azure = 0xF0FFFF,
167  AliceBlue = 0xF0F8FF,
168  GhostWhite = 0xF8F8FF,
169  WhiteSmoke = 0xF5F5F5,
170  Seashell = 0xFFF5EE,
171  Beige = 0xF5F5DC,
172  OldLace = 0xFDF5E6,
173  FloralWhite = 0xFFFAF0,
174  Ivory = 0xFFFFF0,
175  AntiqueWhite = 0xFAEBD7,
176  Linen = 0xFAF0E6,
177  LavenderBlush = 0xFFF0F5,
178  MistyRose = 0xFFE4E1,
179  Gainsboro = 0xDCDCDC,
180  LightGray = 0xD3D3D3,
181  Silver = 0xC0C0C0,
182  DarkGray = 0xA9A9A9,
183  Gray = 0x808080,
184  DimGray = 0x696969,
185  LightSlateGray = 0x778899,
186  SlateGray = 0x708090,
187  DarkSlateGray = 0x2F4F4F,
188  Black = 0x000000
189 };
190 
191 double get_time_of_day();
192 void svg_trace_init(int num_cores, int num_devices);
193 void svg_trace_start_cpu(int thread_rank);
194 void svg_trace_stop_cpu(int thread_rank, int color);
195 void svg_trace_start_gpu(cudaStream_t stream);
196 void svg_trace_stop_gpu(cudaStream_t stream, int color);
197 void svg_trace_start_dma(cudaStream_t stream);
198 void svg_trace_stop_dma(cudaStream_t stream, int color);
199 void svg_trace_memory_host(long delta);
200 void svg_trace_memory_device(long delta);
201 void svg_trace_finish(int num_cores, int num_devices);
202 
203 #ifdef __cplusplus
204 }
205 #endif
206 
207 #endif /* SVG_TRACE_H */