spec: add Bench types for benchmaark instances
This commit is contained in:
36
spec.ts
36
spec.ts
@@ -2,15 +2,16 @@ import * as path from 'path';
|
||||
import * as fs from "fs";
|
||||
import { promisify } from "util";
|
||||
import { SW_AUTOVEC } from "./environment";
|
||||
import { spec } from 'node:test/reporters';
|
||||
|
||||
export interface SPECBench {
|
||||
export interface SPECBenchData {
|
||||
objectNames: string[];
|
||||
num: number;
|
||||
name: string;
|
||||
exe: string;
|
||||
}
|
||||
|
||||
export const pop2: SPECBench = {
|
||||
export const pop2: SPECBenchData = {
|
||||
objectNames: [
|
||||
"netcdf/attr.o",
|
||||
"netcdf/dim.o",
|
||||
@@ -341,16 +342,16 @@ export const pop2: SPECBench = {
|
||||
};
|
||||
|
||||
|
||||
export function benchpath(specdir: string, bench: SPECBench): string {
|
||||
export function benchpath(specdir: string, bench: SPECBenchData): string {
|
||||
return path.join(specdir, 'benchspec', 'CPU', `${bench.num}.${bench.name}`);
|
||||
}
|
||||
|
||||
export function exepath(specdir: string, bench: SPECBench): string {
|
||||
export function exepath(specdir: string, bench: SPECBenchData): string {
|
||||
const benchmarkDir = benchpath(specdir, bench);
|
||||
return path.join(benchmarkDir, 'exe', bench.exe);
|
||||
}
|
||||
|
||||
export function buildpath(specdir: string, bench: SPECBench): string {
|
||||
export function buildpath(specdir: string, bench: SPECBenchData): string {
|
||||
const benchmarkDir = benchpath(specdir, bench);
|
||||
return path.join(benchmarkDir, 'build');
|
||||
}
|
||||
@@ -362,9 +363,9 @@ export function setenv(specdir: string): void {
|
||||
|
||||
export interface SPEC {
|
||||
newConfig: (name: string, content: string) => Promise<void>;
|
||||
benchpath: (bench: SPECBench) => string;
|
||||
exepath: (bench: SPECBench) => string;
|
||||
buildpath: (bench: SPECBench) => string;
|
||||
benchpath: (bench: SPECBenchData) => string;
|
||||
exepath: (bench: SPECBenchData) => string;
|
||||
buildpath: (bench: SPECBenchData) => string;
|
||||
setenv: () => void;
|
||||
}
|
||||
|
||||
@@ -380,6 +381,25 @@ export function mkSPEC(specRoot: string): SPEC {
|
||||
};
|
||||
}
|
||||
|
||||
export interface Bench {
|
||||
benchpath: () => string;
|
||||
exepath: () => string;
|
||||
buildpath: () => string;
|
||||
benchData: () => SPECBenchData;
|
||||
spec: () => SPEC;
|
||||
}
|
||||
|
||||
|
||||
export function mkBench(spec: SPEC, bench: SPECBenchData): Bench {
|
||||
return {
|
||||
benchpath: () => spec.benchpath(bench),
|
||||
exepath: () => spec.exepath(bench),
|
||||
buildpath: () => spec.buildpath(bench),
|
||||
benchData: () => bench,
|
||||
spec: () => spec,
|
||||
};
|
||||
}
|
||||
|
||||
export const defaultSPEC = mkSPEC(path.join(SW_AUTOVEC, "spec2017"));
|
||||
|
||||
const specTemplate = fs.readFileSync("assets/specTemplate.cfg").toString("utf-8");
|
||||
|
||||
Reference in New Issue
Block a user