2021-06-29 14:49:53 +00:00
|
|
|
mode = ScriptMode.Verbose
|
|
|
|
|
|
|
|
packageName = "taskpools"
|
2023-08-07 23:45:08 +00:00
|
|
|
version = "0.0.5"
|
2021-06-29 14:49:53 +00:00
|
|
|
author = "Status Research & Development GmbH"
|
|
|
|
description = "lightweight, energy-efficient, easily auditable threadpool"
|
|
|
|
license = "MIT"
|
2022-11-21 18:56:12 +00:00
|
|
|
skipDirs = @["tests"]
|
2021-06-29 14:49:53 +00:00
|
|
|
|
2023-06-27 09:45:06 +00:00
|
|
|
requires "nim >= 1.6.0"
|
2021-07-01 08:51:35 +00:00
|
|
|
|
2022-11-21 18:56:12 +00:00
|
|
|
let nimc = getEnv("NIMC", "nim") # Which nim compiler to use
|
|
|
|
let lang = getEnv("NIMLANG", "c") # Which backend (c/cpp/js)
|
|
|
|
let flags = getEnv("NIMFLAGS", "") # Extra flags for the compiler
|
|
|
|
let verbose = getEnv("V", "") notin ["", "0"]
|
2021-07-01 08:51:35 +00:00
|
|
|
|
2022-11-21 18:56:12 +00:00
|
|
|
let cfg =
|
2023-06-27 09:45:06 +00:00
|
|
|
" --styleCheck:usages --styleCheck:error" &
|
2022-11-21 18:56:12 +00:00
|
|
|
(if verbose: "" else: " --verbosity:0 --hints:off") &
|
|
|
|
" --skipParentCfg --skipUserCfg --outdir:build --nimcache:build/nimcache -f" &
|
|
|
|
" --stacktrace:on --linetrace:on" &
|
|
|
|
" --threads:on"
|
2021-07-01 08:51:35 +00:00
|
|
|
|
2022-11-21 18:56:12 +00:00
|
|
|
proc build(args, path: string) =
|
|
|
|
exec nimc & " " & lang & " " & cfg & " " & flags & " " & args & " " & path
|
|
|
|
|
|
|
|
proc run(args, path: string) =
|
|
|
|
build args & " -r", path
|
2024-02-19 09:30:19 +00:00
|
|
|
if (NimMajor, NimMinor) > (1, 6):
|
|
|
|
build args & " --mm:refc -r", path
|
2021-07-01 08:51:35 +00:00
|
|
|
|
|
|
|
task test, "Run Taskpools tests":
|
|
|
|
# Internal data structures
|
2022-11-21 18:56:12 +00:00
|
|
|
run "", "taskpools/channels_spsc_single.nim"
|
|
|
|
run "", "taskpools/sparsesets.nim"
|
2021-07-01 08:51:35 +00:00
|
|
|
|
|
|
|
# Examples
|
2022-11-21 18:56:12 +00:00
|
|
|
run "", "examples/e01_simple_tasks.nim"
|
|
|
|
run "", "examples/e02_parallel_pi.nim"
|
2021-07-01 08:51:35 +00:00
|
|
|
|
|
|
|
# Benchmarks
|
2022-11-21 18:56:12 +00:00
|
|
|
run "", "benchmarks/dfs/taskpool_dfs.nim"
|
|
|
|
run "", "benchmarks/heat/taskpool_heat.nim"
|
|
|
|
run "", "benchmarks/nqueens/taskpool_nqueens.nim"
|
2021-07-01 18:24:50 +00:00
|
|
|
|
|
|
|
when not defined(windows):
|
2022-11-21 18:56:12 +00:00
|
|
|
run "", "benchmarks/single_task_producer/taskpool_spc.nim"
|
|
|
|
run "", "benchmarks/bouncing_producer_consumer/taskpool_bpc.nim"
|
2021-07-01 08:51:35 +00:00
|
|
|
|
|
|
|
# TODO - generics in macro issue
|
2022-11-21 18:56:12 +00:00
|
|
|
# run "", "benchmarks/matmul_cache_oblivious/taskpool_matmul_co.nim"
|