This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using PortAudio, SampledSignals, Whisper | |
# Requires https://github.com/aviks/Whisper.jl/pull/8 | |
ctx = Whisper.create_ctx("base.en") | |
wparams = Whisper.create_params() | |
wparams.n_threads = 6 | |
queue = Channel(typemax(Int)) | |
stream = PortAudioStream(1, 0) | |
function to_16k(buf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BenchmarkTools | |
function bench_async_yield(N, T) | |
ts = [@async begin | |
for i in 1:N | |
yield() | |
end | |
end for _ in 1:T] | |
wait.(ts) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function task_hook(code, to) | |
from_tls = task_local_storage() | |
if code == 0 | |
to::Task | |
# Creation, setup child counters | |
@assert to.storage === nothing | |
to_tls = to.storage = IdDict{Any, Any}() | |
to_tls[:counter] = UInt64(0) | |
to_tls[:child_counter] = UInt64(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env julia | |
function ts_to_s(ts::AbstractString) | |
secs = tryparse(Float64, ts) | |
if secs !== nothing | |
return secs | |
end | |
hours, mins, secs = parse.(Float64, split(ts, ':')) | |
return (hours * 60 * 60) + (mins * 60) + secs | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Dagger | |
using Profile | |
fibsum(a, b) = .3 .* a .+ .7 .* b | |
function compute_sn_aot(N) | |
f0 = delayed(rand)(10) | |
f1 = delayed(rand)(10) | |
s = 0. # result held here | |
even = [f0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# compiler driver and main interface | |
# (::CompilerJob) | |
const compile_hook = Ref{Union{Nothing,Function}}(nothing) | |
""" | |
compile(target::Symbol, agent::HSAAgent, f, tt, kernel=true; | |
libraries=true, optimize=true, strip=false, strict=true, ...) | |
Compile a function `f` invoked with types `tt` for agent `agent` to one of the |