Skip to content

Commit

Permalink
try to handle CPUSummary better
Browse files Browse the repository at this point in the history
  • Loading branch information
chriselrod committed Mar 7, 2022
1 parent c71b2a2 commit 6874708
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CPUSummary"
uuid = "2a0fbf3d-bb9c-48f3-b0a9-814d99fd7ab9"
authors = ["chriselrod <[email protected]> and contributors"]
version = "0.1.12"
version = "0.1.13"

[deps]
Hwloc = "0e44f5e4-bd66-52a0-8798-143a42290a1d"
Expand Down
9 changes: 7 additions & 2 deletions src/CPUSummary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ const USE_HWLOC = @load_preference("hwloc", true)
use_hwloc(b) = @set_preferences!("hwloc" => b)

@static if USE_HWLOC
tmpd = mktempdir()
try
p = run(`$(Base.julia_cmd()) --project=$(mktempdir()) -e'using Pkg; Pkg.add("Hwloc"); using Hwloc; Hwloc.gettopology()'`, wait=false)
p = run(`$(Base.julia_cmd()) --project=$tmpd -e'using Pkg; Pkg.add("Hwloc"); using Hwloc; Hwloc.gettopology()'`, wait=false)
wait(p)
@show p
@show p.exitcode == 0 && p.termsignal == 0
if p.exitcode == 0 && p.termsignal == 0
include("topology.jl")
else
Expand All @@ -21,7 +24,9 @@ use_hwloc(b) = @set_preferences!("hwloc" => b)
end
catch
use_hwloc(false)
include("generic_topology.jl")
include("generic_topology.jl")
finally
rm(tmpd, recursive=true)
end
else
include("generic_topology.jl")
Expand Down
2 changes: 1 addition & 1 deletion src/generic_topology.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ cache_inclusive(_) = False()
else
cache_linesize(_) = StaticInt{64}() # assume...
end

cache_size(_) = StaticInt{0}()

cache_type(::Union{Val{3},StaticInt{3}}) = Val{:Unified}()
cache_size(::Union{Val{3},StaticInt{3}}) = num_cores() * StaticInt{1441792}()
Expand Down

2 comments on commit 6874708

@chriselrod
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/56155

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.13 -m "<description of version>" 6874708b72767bcaaea79eb27af5d025843ec2df
git push origin v0.1.13

Please sign in to comment.