-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathOccupancyChart.cpp
587 lines (469 loc) · 22 KB
/
OccupancyChart.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
//==============================================================================
// Copyright (c) 2015 Advanced Micro Devices, Inc. All rights reserved.
/// \author AMD Developer Tools Team
/// \file
/// \brief This file generate occupancy charts
//==============================================================================
// std
#include <iomanip>
#include <fstream>
#include <cmath>
#include <map>
// profiler common
#include <jqPlotChart.h>
#include <FileUtils.h>
#include <Logger.h>
// CL common
#include <CLCUInfoBase.h>
#include "OccupancyChart.h"
#include "OccupancyUtils.h"
using namespace std;
#define CHART_WIDTH "100%"
#define TABLE_WIDTH "100%"
#define TABLE_HEIGHT "300px"
static const unsigned int LDS_TABLE_NBR_BINS = 320;
static const size_t BYTE_2_KBYTE_CONVERSION = 1024;
void GenerateVGPRLimitedWFTables(CLCUInfoBase* cuDevice, jqPlotChart& chart, const OccupancyUtils::OccupancyParams& params)
{
cuDevice->SetCUParam(CU_PARAMS_LDS_USED, params.m_nUsedLDS);
if (params.m_gen >= GDT_HW_GENERATION_SOUTHERNISLAND && params.m_gen < GDT_HW_GENERATION_LAST)
{
cuDevice->SetCUParam(CU_PARAMS_SCALAR_GPRS_USED, params.m_nUsedSGPRS);
}
int stride = 4;
size_t prevNumWaves = 0;
size_t nextNumWaves = 0;
// get the value for 0 VGPRs to be used in the first iteration below
cuDevice->SetCUParam(CU_PARAMS_VECTOR_GPRS_USED, 0);
cuDevice->ComputeNumActiveWaves(params.m_nWorkgroupSize, nextNumWaves);
// We have a minimum of 2 wavefronts required on the compute unit, so just show
// the number of VGPR that allows up to 2 wavefronts. Extra VGPR on the x-axis
// is not necessary.
for (unsigned int i = 0; i <= params.m_nMaxVGPRS; i++)
{
size_t nUsedVGPRs = i == 0 ? 1 : i;
// except for the first iteration, the number of waves for the current iteration was
// calculated during the previous iteration (when checking boundaries). For the first
// iteration, is was calculated above, before the for loop.
size_t curNumWaves = nextNumWaves;
// get the value for the next iteration (used in the current iteration for boundary checking)
cuDevice->SetCUParam(CU_PARAMS_VECTOR_GPRS_USED, nUsedVGPRs + 1);
cuDevice->ComputeNumActiveWaves(params.m_nWorkgroupSize, nextNumWaves);
// check to see if the current item is a boundary -- if so always include the
// point, regardless of stride
bool isBoundary = (prevNumWaves != curNumWaves) || (nextNumWaves != curNumWaves);
if (i % stride == 0 || isBoundary)
{
chart.AddData(jqPlotChartData((float)nUsedVGPRs, (float)curNumWaves));
}
prevNumWaves = curNumWaves;
}
}
void GenerateSGPRLimitedWFTables(CLCUInfoBase* cuDevice, jqPlotChart& chart, const OccupancyUtils::OccupancyParams& params)
{
cuDevice->SetCUParam(CU_PARAMS_LDS_USED, params.m_nUsedLDS);
cuDevice->SetCUParam(CU_PARAMS_VECTOR_GPRS_USED, params.m_nUsedVGPRS);
int stride = 2;
size_t prevNumWaves = 0;
size_t nextNumWaves = 0;
// get the value for 0 SGPRs to be used in the first iteration below
cuDevice->SetCUParam(CU_PARAMS_SCALAR_GPRS_USED, 0);
cuDevice->ComputeNumActiveWaves(params.m_nWorkgroupSize, nextNumWaves);
// We have a minimum of 2 wavefronts required on the compute unit, so just show
// the number of SGPR that allows up to 2 wavefronts. Extra SGPR on the x-axis
// is not necessary.
for (unsigned int i = 0; i <= params.m_nMaxSGPRS; i++)
{
size_t nUsedSGPRs = i == 0 ? 1 : i;
// except for the first iteration, the number of waves for the current iteration was
// calculated during the previous iteration (when checking boundaries). For the first
// iteration, is was calculated above, before the for loop.
size_t curNumWaves = nextNumWaves;
// get the value for the next iteration (used in the current iteration for boundary checking)
cuDevice->SetCUParam(CU_PARAMS_SCALAR_GPRS_USED, nUsedSGPRs + 1);
cuDevice->ComputeNumActiveWaves(params.m_nWorkgroupSize, nextNumWaves);
// check to see if the current item is a boundary -- if so always include the
// point, regardless of stride
bool isBoundary = (prevNumWaves != curNumWaves) || (nextNumWaves != curNumWaves);
if (i % stride == 0 || isBoundary)
{
chart.AddData(jqPlotChartData((float)nUsedSGPRs, (float)curNumWaves));
}
prevNumWaves = curNumWaves;
}
}
void GenerateWGLimitedWFTable(CLCUInfoBase* cuDevice, jqPlotChart& chart, const OccupancyUtils::OccupancyParams& params)
{
cuDevice->SetCUParam(CU_PARAMS_LDS_USED, params.m_nUsedLDS);
cuDevice->SetCUParam(CU_PARAMS_VECTOR_GPRS_USED, params.m_nUsedVGPRS);
if (params.m_gen >= GDT_HW_GENERATION_SOUTHERNISLAND && params.m_gen < GDT_HW_GENERATION_LAST)
{
cuDevice->SetCUParam(CU_PARAMS_SCALAR_GPRS_USED, params.m_nUsedSGPRS);
}
for (unsigned int i = 1; i <= params.m_nMaxWGSize; ++i)
{
size_t activeWave;
cuDevice->ComputeNumActiveWaves(i, activeWave);
chart.AddData(jqPlotChartData((float)i, (float)activeWave));
}
}
void GenerateLDSLimitedWFTable(CLCUInfoBase* cuDevice, jqPlotChart& chart, const OccupancyUtils::OccupancyParams& params)
{
cuDevice->SetCUParam(CU_PARAMS_VECTOR_GPRS_USED, params.m_nUsedVGPRS);
unsigned int stride = 1024;
if (params.m_gen >= GDT_HW_GENERATION_SOUTHERNISLAND && params.m_gen < GDT_HW_GENERATION_LAST)
{
cuDevice->SetCUParam(CU_PARAMS_SCALAR_GPRS_USED, params.m_nUsedSGPRS);
}
for (unsigned int i = 0; i <= params.m_nMaxLDS; i += stride)
{
cuDevice->SetCUParam(CU_PARAMS_LDS_USED, i);
size_t activeWave;
cuDevice->ComputeNumActiveWaves(params.m_nWorkgroupSize, activeWave);
chart.AddData(jqPlotChartData(((float)i / BYTE_2_KBYTE_CONVERSION), (float)activeWave));
}
}
void CreateInfoTable(const OccupancyUtils::OccupancyParams& params, ostream& os, const string& strLimitingFactor)
{
string strDeviceName = params.m_strDeviceName;
size_t numCU = params.m_nNbrComputeUnits;
size_t maxWavePerCU = params.m_nMaxWavesPerCU;
size_t waveSize = params.m_nWavefrontSize;
string strKernelName = params.m_strKernelName;
size_t usedLDS = params.m_nUsedLDS;
size_t flattenedGroupWorkSize = params.m_nWorkgroupSize;
size_t flattenedGlobalWorkSize = params.m_nGlobalWorkSize;
size_t numWavePerGroup = params.m_nWavesPerWG;
size_t maxLDS = params.m_nMaxLDS;
size_t maxGroupWorkSize = params.m_nMaxWGSize;
size_t maxGlobalWorkSize = params.m_nMaxGlobalWorkSize;
size_t maxWavePerGroup = params.m_nMaxWavesPerWG;
size_t numWaveLimitedByLDS = params.m_nLDSLimitedWaveCount;
size_t numWaveLimitedByWGS = params.m_nWGLimitedWaveCount;
os << "<table style=\"width:100%;height:" TABLE_HEIGHT ";\">" << endl;
os << "<th>Variable</th> <th>Value</th> <th>Device Limit</th>" << endl;
os << "<tr><td colspan=\"3\" class=\"title_row\">Device Info</td></tr>" << endl;
os << "<tr><td>Device name</td> <td>" << strDeviceName << "</td> <td></td></tr>" << endl;
os << "<tr><td>Number of compute units</td> <td>" << numCU << "</td> <td></td></tr>" << endl;
os << "<tr><td>Max number of waves per compute unit</td> <td>" << maxWavePerCU << "</td> <td></td></tr>" << endl;
os << "<tr><td>Max number of work-groups per compute unit</td> <td>" << params.m_nMaxWGPerCU << "</td> <td></td></tr>" << endl;
os << "<tr><td>Wavefront size</td> <td>" << waveSize << "</td> <td></td></tr>" << endl;
os << "<tr><td colspan = \"3\" class=\"title_row\">Kernel Info</td></tr>" << endl;
os << "<tr><td>Kernel name</td> <td>" << strKernelName << "</td> <td></td></tr>" << endl;
os << "<tr><td>Vector GPR usage per work-item</td> <td>" << params.m_nUsedVGPRS << "</td> <td>" << params.m_nMaxVGPRS << "</td></tr>" << endl;
if (params.m_gen >= GDT_HW_GENERATION_SOUTHERNISLAND && params.m_gen < GDT_HW_GENERATION_LAST)
{
os << "<tr><td>Scalar GPR usage per work-item</td> <td>" << params.m_nUsedSGPRS << "</td> <td>" << params.m_nMaxSGPRS << "</td></tr>" << endl;
}
os << "<tr><td>LDS usage per work-group</td> <td>" << usedLDS << "</td> <td>" << maxLDS << "</td></tr>" << endl;
os << "<tr><td>Flattened work-group size</td> <td>" << flattenedGroupWorkSize << "</td> <td>" << maxGroupWorkSize << "</td></tr>" << endl;
os << "<tr><td>Flattened global work size</td> <td>" << flattenedGlobalWorkSize << "</td> <td>" << maxGlobalWorkSize << "</td></tr>" << endl;
os << "<tr><td>Number of waves per work-group</td> <td>" << numWavePerGroup << "</td> <td>" << maxWavePerGroup << "</td></tr>" << endl;
os << "<tr><td colspan = \"3\" class=\"title_row\">Kernel Occupancy</td></tr>" << endl;
os << "<tr><td>Number of waves limited by Vector GPR and Work-group size</td> <td>" << params.m_nVGPRLimitedWaveCount << "</td> <td>" << maxWavePerCU << "</td></tr>" << endl;
if (params.m_gen >= GDT_HW_GENERATION_SOUTHERNISLAND && params.m_gen < GDT_HW_GENERATION_LAST)
{
os << "<tr><td>Number of waves limited by Scalar GPR and Work-group size</td> <td>" << params.m_nSGPRLimitedWaveCount << "</td> <td>" << maxWavePerCU << "</td></tr>" << endl;
}
os << "<tr><td>Number of waves limited by LDS and Work-group size</td> <td>" << numWaveLimitedByLDS << "</td> <td>" << maxWavePerCU << "</td></tr>" << endl;
os << "<tr><td>Number of waves limited by Work-group size</td> <td>" << numWaveLimitedByWGS << "</td> <td>" << maxWavePerCU << "</td></tr>" << endl;
os << "<tr class=\"hightlight_row\"><td>Limiting factor(s)</b></td> <td>" << strLimitingFactor << "</td> <td></td></tr>" << endl;
os.precision(4);
os << "<tr><td>Estimated occupancy</td> <td>" << params.m_fOccupancy << "%</td> <td></td></tr>" << endl;
os << "</table>" << endl;
}
void AddDisableSelectionCode(ostream& os)
{
const std::string constUserSelectNoneString("-user-select: none;");
os << " ";
os << "style=";
os << "'";
os << "-ms" << constUserSelectNoneString;
os << "-moz" << constUserSelectNoneString;
os << "-webkit" << constUserSelectNoneString;
os << "'";
}
bool GenerateOccupancyChart(const OccupancyUtils::OccupancyParams& params, const string& strFileName, std::string& strError)
{
if (strFileName.empty())
{
strError = "No output file specified";
return false;
}
ofstream fout;
fout.open(strFileName.c_str());
if (fout.fail())
{
strError = "Unable to open output file: " + strFileName;
return false;
}
string outputPath;
if (!FileUtils::GetWorkingDirectory(strFileName, outputPath))
{
strError = "Unable to determine ouput directory";
return false;
}
if (!jqPlotChart::CopyScripts(outputPath))
{
strError = "Unable to copy required files to output directory";
return false;
}
size_t nMaxNumWavefronts = params.m_nMaxWavesPerCU;
CLCUInfoBase* cuDevice = NULL;
if (params.m_gen >= GDT_HW_GENERATION_VOLCANICISLAND && params.m_gen < GDT_HW_GENERATION_LAST)
{
cuDevice = new CLCUInfoVI();
}
else if (params.m_gen == GDT_HW_GENERATION_SOUTHERNISLAND || params.m_gen == GDT_HW_GENERATION_SEAISLAND)
{
cuDevice = new CLCUInfoSI();
}
else
{
return false;
}
cuDevice->SetCUParam(CU_PARAMS_KERNEL_NAME, params.m_strKernelName);
cuDevice->SetCUParam(CU_PARAMS_DEVICE_NAME, params.m_strDeviceName);
cuDevice->SetCUParam(CU_PARAMS_DEVICE_GFXIP_VER, params.m_nDeviceGfxIpVer);
cuDevice->SetCUParam(CU_PARAMS_VECTOR_GPRS_MAX, params.m_nMaxVGPRS);
cuDevice->SetCUParam(CU_PARAMS_SCALAR_GPRS_MAX, params.m_nMaxSGPRS);
cuDevice->SetCUParam(CU_PARAMS_LDS_MAX, params.m_nMaxLDS);
cuDevice->SetCUParam(CU_PARAMS_VECTOR_GPRS_USED, params.m_nUsedVGPRS);
cuDevice->SetCUParam(CU_PARAMS_SCALAR_GPRS_USED, params.m_nUsedSGPRS);
cuDevice->SetCUParam(CU_PARAMS_LDS_USED, params.m_nUsedLDS);
cuDevice->SetCUParam(CU_PARAMS_WG_SIZE_MAX, params.m_nMaxWGSize);
cuDevice->SetCUParam(CU_PARAMS_GLOBAL_SIZE_MAX, params.m_nMaxGlobalWorkSize);
cuDevice->SetCUParam(CU_PARAMS_WAVEFRONT_SIZE, params.m_nWavefrontSize);
cuDevice->SetCUParam(CU_PARAMS_WAVEFRONT_PER_COMPUTE_UNIT, params.m_nMaxWavesPerCU);
cuDevice->SetCUParam(CU_PARAMS_SIMDS_PER_CU, params.m_nSimdsPerCU);
size_t nActiveWaves;
cuDevice->ComputeNumActiveWaves(params.m_nWorkgroupSize, nActiveWaves);
jqPlotChart chart1;
jqPlotChart chart2;
jqPlotChart chart3;
chart1.m_strChartID = "chartVGPR";
chart1.m_strChartName = "Number of waves limited by VGPRs";
chart1.m_strXAxisName = "Number of VGPRs";
chart1.m_strYAxisName = "Number of active wavefronts";
chart1.m_strTooltipFormatString = "VGPR = %s<br/>Wave = %s";
vector<float> ticksVGPR;
ticksVGPR.push_back(0);
ticksVGPR.push_back(64);
ticksVGPR.push_back(128);
ticksVGPR.push_back(192);
ticksVGPR.push_back(256);
chart1.SetXAxisTicks(ticksVGPR);
float fPad = 1.2f;
chart1.m_uiMaxXAxis = (unsigned int)((float)params.m_nMaxVGPRS * fPad);
chart1.m_uiMinXAxis = 0;
chart1.m_uiMaxYAxis = (unsigned int)(fPad * (float)params.m_nMaxWavesPerCU);
chart1.m_uiMinYAxis = 0;
chart1.AddData(jqPlotChartData((float)params.m_nUsedVGPRS, (float)nActiveWaves, true));
jqPlotChart chartSGPR;
if (params.m_gen >= GDT_HW_GENERATION_SOUTHERNISLAND && params.m_gen < GDT_HW_GENERATION_LAST)
{
chartSGPR.m_strChartID = "chartSGPR";
chartSGPR.m_strChartName = "Number of waves limited by SGPRs";
chartSGPR.m_strXAxisName = "Number of SGPRs";
chartSGPR.m_strYAxisName = "Number of active wavefronts";
chartSGPR.m_strTooltipFormatString = "SGPR = %s<br/>Wave = %s";
vector<float> ticksSGPR;
ticksSGPR.push_back(0);
ticksSGPR.push_back(26);
ticksSGPR.push_back(52);
ticksSGPR.push_back(78);
ticksSGPR.push_back(102);
chartSGPR.SetXAxisTicks(ticksSGPR);
chartSGPR.m_uiMaxXAxis = (unsigned int)((float)params.m_nMaxSGPRS * fPad);
chartSGPR.m_uiMinXAxis = 0;
chartSGPR.m_uiMaxYAxis = (unsigned int)(fPad * (float)params.m_nMaxWavesPerCU);
chartSGPR.m_uiMinYAxis = 0;
chartSGPR.AddData(jqPlotChartData((float)params.m_nUsedSGPRS, (float)nActiveWaves, true));
}
// Chart for LDS
chart2.m_strChartID = "chartLDS";
chart2.m_strChartName = "Number of waves limited by LDS";
chart2.m_strXAxisName = "LDS Size ";
chart2.m_strYAxisName = "Number of active wavefronts";
chart2.m_strTooltipFormatString = "LDS = %s <br/>Wave = %s";
chart2.m_uiMaxXAxis = (unsigned int)(fPad * params.m_nMaxLDS / BYTE_2_KBYTE_CONVERSION);
chart2.m_uiMinXAxis = 0;
chart2.m_uiMaxYAxis = (unsigned int)(fPad * (float)nMaxNumWavefronts);
chart2.m_uiMinYAxis = 0;
chart2.AddData(jqPlotChartData(((float)params.m_nUsedLDS / BYTE_2_KBYTE_CONVERSION), (float)nActiveWaves, true));
vector<float> ticksLDS;
ticksLDS.push_back(0.0f);
ticksLDS.push_back(8.0f);
ticksLDS.push_back(16.0f);
ticksLDS.push_back(24.0f);
ticksLDS.push_back(32.0f);
chart2.m_strTickXFormatString = "%4.1fk";
chart2.SetXAxisTicks(ticksLDS);
// Chart for Workgroup size
chart3.m_strChartID = "chartWGS";
chart3.m_strChartName = "Number of waves limited by Work-group size";
chart3.m_strXAxisName = "Work-group size";
chart3.m_strYAxisName = "Number of active wavefronts";
chart3.m_strTooltipFormatString = "Work-group size = %s<br/>Wave = %s";
chart3.m_uiMaxXAxis = (unsigned int)(fPad * params.m_nMaxWGSize);
chart3.m_uiMinXAxis = 0;
chart3.m_uiMaxYAxis = (unsigned int)(fPad * (float)nMaxNumWavefronts);
chart3.m_uiMinYAxis = 0;
chart3.AddData(jqPlotChartData((float)params.m_nWorkgroupSize, (float)nActiveWaves, true));
vector<float> ticksWG;
ticksWG.push_back(0);
ticksWG.push_back(64);
ticksWG.push_back(128);
ticksWG.push_back(192);
ticksWG.push_back(256);
chart3.SetXAxisTicks(ticksWG);
string strLimitingFactor;
strLimitingFactor.clear();
if (params.m_fOccupancy < 100.0f)
{
size_t numLimitingVal = min(min(params.m_nLDSLimitedWaveCount, params.m_nVGPRLimitedWaveCount), params.m_nWGLimitedWaveCount);
if (params.m_gen >= GDT_HW_GENERATION_SOUTHERNISLAND && params.m_gen < GDT_HW_GENERATION_LAST)
{
numLimitingVal = min((size_t)params.m_nSGPRLimitedWaveCount, numLimitingVal);
if (params.m_nUsedSGPRS != 0 && params.m_nSGPRLimitedWaveCount == numLimitingVal)
{
strLimitingFactor += "SGPR";
chartSGPR.m_strTitleColor = "#FF0000";
}
}
if (params.m_nUsedVGPRS != 0 && params.m_nVGPRLimitedWaveCount == numLimitingVal)
{
if (!strLimitingFactor.empty())
{
strLimitingFactor += ", ";
}
strLimitingFactor += "VGPR";
chart1.m_strTitleColor = "#FF0000";
}
if (params.m_nUsedLDS != 0 && params.m_nLDSLimitedWaveCount == numLimitingVal)
{
if (!strLimitingFactor.empty())
{
strLimitingFactor += ", ";
}
strLimitingFactor += "LDS";
chart2.m_strTitleColor = "#FF0000";
}
if (params.m_nWGLimitedWaveCount == numLimitingVal)
{
if (!strLimitingFactor.empty())
{
strLimitingFactor += ", ";
}
strLimitingFactor += "Work-group size";
chart3.m_strTitleColor = "#FF0000";
}
}
else
{
strLimitingFactor = "None";
}
GenerateVGPRLimitedWFTables(cuDevice, chart1, params);
GenerateLDSLimitedWFTable(cuDevice, chart2, params);
GenerateWGLimitedWFTable(cuDevice, chart3, params);
if (params.m_gen >= GDT_HW_GENERATION_SOUTHERNISLAND && params.m_gen < GDT_HW_GENERATION_LAST)
{
GenerateSGPRLimitedWFTables(cuDevice, chartSGPR, params);
}
// IE9 requires this tag to support convas
fout << "<!DOCTYPE html>" << endl;
fout << "<!-- saved from url=(0014)about:internet -->" << endl;
fout << "<!--[if lt IE 9]><script language=\"javascript\" type=\"text/javascript\" src=\"excanvas.min.js\"></script><![endif]-->" << endl;
fout << "<html lang=\"en\">" << endl;
fout << "<head>" << endl;
fout << "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">" << endl;
fout << "<title>Kernel Occupancy</title>" << endl;
// insert style
fout << "<style type=\"text/css\">" << endl;
fout << "th {" << endl;
fout << " font-size:1em;" << endl;
fout << " text-align:left;" << endl;
fout << " padding-top:5px;" << endl;
fout << " padding-bottom:4px;" << endl;
fout << " background-color:#969696;" << endl;
fout << " color:#fff;" << endl;
fout << "}" << endl;
fout << "td, th {" << endl;
fout << " font-size:0.85em;" << endl;
fout << " border:1px solid #969696;" << endl;
fout << " padding:3px 7px 2px 7px;" << endl;
fout << "}" << endl;
fout << "table {" << endl;
fout << " font-family:\"Trebuchet MS\", Arial, Helvetica, sans-serif;" << endl;
fout << " width:" TABLE_WIDTH ";" << endl;
fout << " border-collapse:collapse;" << endl;
fout << " margin-left: auto;" << endl;
fout << " margin-right: auto;" << endl;
fout << "}" << endl;
fout << ".title_row" << endl;
fout << "{" << endl;
fout << " background-color:#C8BBBE;" << endl;
fout << " color:#fff;" << endl;
fout << "}" << endl;
fout << ".hightlight_row" << endl;
fout << "{" << endl;
fout << " color:#FF0000;" << endl;
fout << " font-weight:bold;" << endl;
fout << "}" << endl;
fout << "</style>" << endl;
jqPlotChart::WriteScriptDesc(fout);
fout << "<script class=\"code\" language=\"javascript\" type=\"text/javascript\">" << endl;
fout << "$(document).ready(function(){" << endl;
// insert table here
// Chart for GPR
chart1.WriteToStream(fout);
if (params.m_gen >= GDT_HW_GENERATION_SOUTHERNISLAND && params.m_gen < GDT_HW_GENERATION_LAST)
{
chartSGPR.WriteToStream(fout);
}
chart2.WriteToStream(fout);
chart3.WriteToStream(fout);
fout << "});" << endl;
fout << "</script>" << endl;
fout << "</head>" << endl;
// document body
fout << "<body";
AddDisableSelectionCode(fout);
fout << ">" << endl;
// create table
fout << "<table>" << endl;
int nCells = (params.m_gen >= GDT_HW_GENERATION_SOUTHERNISLAND && params.m_gen < GDT_HW_GENERATION_LAST) ? 4 : 3;
fout << "<tr>" << endl;
// row 0, cell 0
fout << "<td>" << endl;
fout << "<div id=\"chartWGS\" style=\"width:" CHART_WIDTH ";height:" TABLE_HEIGHT ";\"></div>" << endl;
fout << "</td>" << endl;
// row 0, cell 1
fout << "<td>" << endl;
fout << "<div id=\"chartVGPR\" style=\"width:" CHART_WIDTH ";height:" TABLE_HEIGHT ";\"></div>" << endl;
fout << "</td>" << endl;
if (params.m_gen >= GDT_HW_GENERATION_SOUTHERNISLAND && params.m_gen < GDT_HW_GENERATION_LAST)
{
fout << "<td>" << endl;
fout << "<div id=\"chartSGPR\" style=\"width:" CHART_WIDTH ";height:" TABLE_HEIGHT ";\"></div>" << endl;
fout << "</td>" << endl;
}
// row 0, cell 2
fout << "<td>" << endl;
fout << "<div id=\"chartLDS\" style=\"width:" CHART_WIDTH ";height:" TABLE_HEIGHT ";\"></div>" << endl;
fout << "</td>" << endl;
fout << "</tr>" << endl;
// row 1, cell 1
fout << "<tr>" << endl;
fout << "<td colspan=\"" << nCells << "\">" << endl;
CreateInfoTable(params, fout, strLimitingFactor);
fout << "</td>" << endl;
fout << "</tr>" << endl;
fout << "</table>" << endl;
fout << "</body>" << endl;
fout << "</html>" << endl;
fout.close();
strError.clear();
SAFE_DELETE(cuDevice);
return true;
}