Skip to content

Commit

Permalink
PG: Set Benchmark flags
Browse files Browse the repository at this point in the history
  • Loading branch information
drizhina committed Oct 25, 2024
1 parent 8b419e0 commit f6b546b
Showing 1 changed file with 48 additions and 43 deletions.
91 changes: 48 additions & 43 deletions packages/PowerGrid/src/tests/webgpu-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,66 @@ import * as grok from 'datagrok-api/grok';
import * as DG from 'datagrok-api/dg';

import {awaitCheck, category, expect, expectArray, test, testEvent} from '@datagrok-libraries/utils/src/test';
import {getGPUDevice} from '@datagrok-libraries/math/src/webGPU/getGPUDevice';

const sizes = [10000, 1000000, 10000000];
const types = ['dot', 'circle'];
const consecutiveLaunches = 3;

category('webgpu', () => {
category('webgpu', async () => {
const render = DG.Func.find({tags: ['scWebGPURender']})[0];
const hitTest = DG.Func.find({tags: ['scWebGPUPointHitTest']})[0];
// const gpuDevice = await getGPUDevice();
// if (!gpuDevice || !DG.Test.isInBenchmark)
// return;

types.forEach((t) => {
sizes.forEach((s) => {
test(`GPURender: ${s / 1000000.0}m ${t}s`, async () => {
const view = grok.shell.addTableView(grok.data.demo.randomWalk(s, 2));
const sp: DG.ScatterPlotViewer = view.scatterPlot();
sp.props.markerType = t;
for (let i = 1; i <= consecutiveLaunches; ++i) {
await DG.timeAsync(`Render Call #${i}`, async() => {
await render.apply([sp, true]);
});
}
}, {benchmarkTimeout: 10000});
test(`GPURender: ${s / 1000000.0}m ${t}s`, async () => {
const view = grok.shell.addTableView(grok.data.demo.randomWalk(s, 2));
const sp: DG.ScatterPlotViewer = view.scatterPlot();
sp.props.markerType = t;
for (let i = 1; i <= consecutiveLaunches; ++i) {
await DG.timeAsync(`Render Call #${i}`, async () => {
await render.apply([sp, true]);
});
}
}, {benchmarkTimeout: 10000, benchmark: true});

test(`GPURender Color: ${s / 1000000.0}m ${t}s`, async () => {
const view = grok.shell.addTableView(grok.data.demo.randomWalk(s, 2));
const sp: DG.ScatterPlotViewer = view.scatterPlot();
sp.props.markerType = t;
sp.props.sizeColumnName = '#1';
for (let i = 1; i <= consecutiveLaunches; ++i) {
await DG.timeAsync(`Render Call #${i}`, async() => {
await render.apply([sp, true]);
});
}
}, {benchmarkTimeout: 10000});
test(`GPURender Color: ${s / 1000000.0}m ${t}s`, async () => {
const view = grok.shell.addTableView(grok.data.demo.randomWalk(s, 2));
const sp: DG.ScatterPlotViewer = view.scatterPlot();
sp.props.markerType = t;
sp.props.sizeColumnName = '#1';
for (let i = 1; i <= consecutiveLaunches; ++i) {
await DG.timeAsync(`Render Call #${i}`, async () => {
await render.apply([sp, true]);
});
}
}, {benchmarkTimeout: 10000, benchmark: true});

test(`GPURender Size: ${s / 1000000.0}m ${t}s`, async () => {
const view = grok.shell.addTableView(grok.data.demo.randomWalk(s, 2));
const sp: DG.ScatterPlotViewer = view.scatterPlot();
sp.props.markerType = t;
sp.props.colorColumnName = '#0';
for (let i = 1; i <= consecutiveLaunches; ++i) {
await DG.timeAsync(`Render Call #${i}`, async() => {
await render.apply([sp, true]);
});
}
}, {benchmarkTimeout: 10000});
test(`GPURender Size: ${s / 1000000.0}m ${t}s`, async () => {
const view = grok.shell.addTableView(grok.data.demo.randomWalk(s, 2));
const sp: DG.ScatterPlotViewer = view.scatterPlot();
sp.props.markerType = t;
sp.props.colorColumnName = '#0';
for (let i = 1; i <= consecutiveLaunches; ++i) {
await DG.timeAsync(`Render Call #${i}`, async () => {
await render.apply([sp, true]);
});
}
}, {benchmarkTimeout: 10000, benchmark: true});

test(`GPUHitTest: ${s / 1000000.0}m ${t}s`, async () => {
const view = grok.shell.addTableView(grok.data.demo.randomWalk(s, 2));
const sp: DG.ScatterPlotViewer = view.scatterPlot();
sp.props.markerType = t;
for (let i = 1; i <= consecutiveLaunches; ++i) {
await DG.timeAsync(`GPU HitTest call #${i}`, async() => {
await hitTest.apply([sp, new DG.Point(0, 0)]);
});
}
}, {benchmarkTimeout: 10000});
test(`GPUHitTest: ${s / 1000000.0}m ${t}s`, async () => {
const view = grok.shell.addTableView(grok.data.demo.randomWalk(s, 2));
const sp: DG.ScatterPlotViewer = view.scatterPlot();
sp.props.markerType = t;
for (let i = 1; i <= consecutiveLaunches; ++i) {
await DG.timeAsync(`GPU HitTest call #${i}`, async () => {
await hitTest.apply([sp, new DG.Point(0, 0)]);
});
}
}, {benchmarkTimeout: 10000, benchmark: true});
});
});
}, {benchmarks: true});

0 comments on commit f6b546b

Please sign in to comment.