Skip to content

Commit fd83fb2

Browse files
authored
Merge pull request #3 from janekb04/ease-windows-development
Ease windows development
2 parents 8e361d9 + 4f8e788 commit fd83fb2

File tree

3 files changed

+72
-1
lines changed

3 files changed

+72
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ arm_neon.h
2424
sync.sh
2525
libwhisper.a
2626
libwhisper.so
27+
bench.exe
28+
whisper.dll
2729
compile_commands.json
30+
CMakeSettings.json
2831

2932
examples/arm_neon.h
3033
examples/whisper.objc/whisper.objc.xcodeproj/xcshareddata

extra/bench-all.ps1

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Helper script to run the bench tool on all models and print the results in share-able format
2+
3+
Write-Host "Usage: .\bench-all.ps1 [n_threads]`n"
4+
5+
if ($args.Length -eq 0) {
6+
$n_threads = 4
7+
} else {
8+
$n_threads = $args[0]
9+
}
10+
11+
$models = @( "tiny", "base", "small", "medium", "large" )
12+
13+
Write-Host "`nRunning memcpy benchmark with 1 thread`n"
14+
15+
.\bench -w 1 -t 1
16+
17+
Write-Host "`nRunning ggml_mul_mat benchmark with $n_threads threads`n"
18+
19+
.\bench -w 2 -t $n_threads
20+
21+
Write-Host "`nRunning benchmark for all models"
22+
Write-Host "This can take a while!`n"
23+
24+
Write-Host "| CPU | OS | Config | Model | Th | Load | Enc. | Commit |"
25+
Write-Host "| --- | -- | ------ | ----- | -- | ---- | ---- | ------ |"
26+
27+
$commit = git rev-parse --short HEAD
28+
$cpu_name = (Get-CimInstance -ClassName Win32_Processor).Name
29+
$os = ((Get-WMIObject win32_operatingsystem).name).split("|")[0]
30+
31+
foreach ($model in $models) {
32+
# run once to heat-up the cache
33+
.\bench -m .\models\ggml-$model.bin -t $n_threads 2>&1 | Out-Null
34+
35+
# actual run
36+
# store stderr output in a variable in order to parse it later
37+
$output = .\bench -m .\models\ggml-$model.bin -t $n_threads 2>&1
38+
39+
# parse the output:
40+
$load_time = (($output | Select-String "load time") -split "[\s]+")[4]
41+
$encode_time = (($output | Select-String "encode time") -split "[\s]+")[4]
42+
$system_info = ($output | Select-String "system_info").ToString()
43+
$n_threads = ($system_info -split "[\s]+")[3]
44+
45+
# convert the time values to float type
46+
$load_time = [float]::Parse($load_time)
47+
$encode_time = [float]::Parse($encode_time)
48+
49+
# floor to milliseconds
50+
$load_time = [math]::Floor($load_time)
51+
$encode_time = [math]::Floor($encode_time)
52+
53+
$config = ""
54+
55+
if ($system_info.Contains("AVX2 = 1")) {
56+
$config += " AVX2"
57+
}
58+
59+
if ($system_info.Contains("NEON = 1")) {
60+
$config += " NEON"
61+
}
62+
63+
if ($system_info.Contains("BLAS = 1")) {
64+
$config += " BLAS"
65+
}
66+
67+
Write-Host "| $cpu_name | $os |$config | $model | $n_threads | $load_time | $encode_time | $commit |"
68+
}

extra/bench-all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Helper script to run the bench tool on all models and print the results in share-able format
44

5-
printf "Usage: ./bench.sh [n_threads]\n"
5+
printf "Usage: ./bench-all.sh [n_threads]\n"
66

77
if [ -z "$1" ]; then
88
n_threads=4

0 commit comments

Comments
 (0)