From 6ff242bb3225fc5f4cddaa69668456e6be1ffabc Mon Sep 17 00:00:00 2001 From: Chetan Vardhan Date: Wed, 6 Mar 2024 09:51:04 +0530 Subject: [PATCH] Initial changes --- Project.toml | 1 + src/PerfChecker.jl | 38 ++++++++++++++++++++++++++++++++++++++ src/alloc.jl | 2 -- src/check.jl | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 1dba28c..e231b76 100644 --- a/Project.toml +++ b/Project.toml @@ -5,6 +5,7 @@ version = "0.2.0" [deps] CoverageTools = "c36e975a-824b-4404-a568-ef97ca766997" +CpuId = "adafc99b-e345-5852-983c-f28acb93d879" Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b" Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d" diff --git a/src/PerfChecker.jl b/src/PerfChecker.jl index 03e3cb5..eb827d6 100644 --- a/src/PerfChecker.jl +++ b/src/PerfChecker.jl @@ -6,6 +6,44 @@ using Profile import TypedTables: Table import Distributed: remotecall_fetch, addprocs, rmprocs import CoverageTools: analyze_malloc_files, find_malloc_files, MallocInfo +import Sys +import CpuId + +struct HwInfo + cpus::Vector{CPUInfo} + machine::String + word::Int + simdbytes::Int + corecount::Tuple{Int, Int} +end + +struct CheckerResult + table::Table + hwinfo::HwInfo + tags::Vector{Symbol} +end + +function find_by_tags(tags::Vector{Symbol}, results::CheckerResult; exact_match = true) + results = [] + if exact_match + for j in results + if tags == j.tags + push!(results, tags) + else + end + else + for j in results + for i in tags + if i in j.tags + push!(results, tags) + break + end + end + end + end + + return results +end # SECTION - Exports export @check diff --git a/src/alloc.jl b/src/alloc.jl index 9afb80b..4a8e41e 100644 --- a/src/alloc.jl +++ b/src/alloc.jl @@ -1,6 +1,4 @@ prep(d::Dict, block::Expr, ::Val{:alloc}) = quote - import Pkg - Pkg.instantiate() import Profile $block nothing diff --git a/src/check.jl b/src/check.jl index adf034c..e534c7a 100644 --- a/src/check.jl +++ b/src/check.jl @@ -12,19 +12,53 @@ function default_options(d::Dict, v::Symbol) return merge(di, d) end +function resolve_versions(d::Dict{String,Any}) + for key,value in d + d[key] = resolve_version(x) + end +end + +function resolve_version(x::String, y::VersionNumber) + +end + +function resolve_version(x::String, y::String) + +end + +function resolve_version(x::String, y::Symbol) + +end + macro check(x, d, block1, block2) block1, block2 = Expr(:quote, block1), Expr(:quote, block2) quote di = default_options($d, $x) g = prep(di, $block1, $x) h = check(di, $block2, $x) + import Pkg + Pkg.instantiate() p = remotecall_fetch(Core.eval, 1, Main, Expr(:toplevel, quote import Distributed d = $di + if typeof(d[:path]) == Dict{String, Any} + d[:path] == mktemp()[1] + end Distributed.addprocs(1; exeflags=["--track-allocation=$(d[:track])", "--project=$(d[:path])", "-t $(d[:threads])"]) end).args...) |> first + remotecall_fetch(Core.eval, p, Main, + Expr(:toplevel, quote + import Pkg; + Pkg.instantiate(); + ).args...) + + + if typeof(di.path) == Dict{String, Any} + + end + di[:prep_result] = remotecall_fetch(Core.eval, p, Main, Expr(:toplevel, g.args...))