From 3e32acc01fe57de6725c191a55e3263cbced6157 Mon Sep 17 00:00:00 2001 From: Carsten Bauer Date: Mon, 5 Aug 2024 22:17:07 +0200 Subject: [PATCH] drop Statistics dep; clean up imports/using --- Project.toml | 17 ++++++----------- ext/HwlocTrees.jl | 3 ++- src/Hwloc.jl | 1 - src/libhwloc.jl | 4 ++-- src/libhwloc_extensions.jl | 4 +--- src/lowlevel_api.jl | 27 +++++++++++---------------- test/runtests.jl | 1 - 7 files changed, 22 insertions(+), 35 deletions(-) diff --git a/Project.toml b/Project.toml index 066de55..f02fcb9 100644 --- a/Project.toml +++ b/Project.toml @@ -4,32 +4,27 @@ authors = ["Erik Schnetter "] version = "3.2.0" [deps] +AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82" Hwloc_jll = "e33a78d0-f292-5ffc-b300-72abe9b543c8" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" -Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" -# here for compatibility with older versions of Julia (that don't have extensions): -# https://pkgdocs.julialang.org/v1/creating-packages/#Transition-from-normal-dependency-to-extension -AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" [weakdeps] AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" +[extensions] +HwlocTrees = "AbstractTrees" + [compat] +AbstractTrees = "^0.4, ^0.3" CEnum = "^0.4, ^0.5" Hwloc_jll = "^2.8" -AbstractTrees = "^0.4, ^0.3" julia = "^1.10" [extras] +AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" CpuId = "adafc99b-e345-5852-983c-f28acb93d879" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" - -[extensions] -# Conditional dependencies: https://pkgdocs.julialang.org/v1/creating-packages/#Conditional-loading-of-code-in-packages-(Extensions) -# Note: use a list for multiple extension dependencies -HwlocTrees = "AbstractTrees" [targets] test = ["Test", "CpuId", "AbstractTrees"] diff --git a/ext/HwlocTrees.jl b/ext/HwlocTrees.jl index e94ad52..d2c9c33 100644 --- a/ext/HwlocTrees.jl +++ b/ext/HwlocTrees.jl @@ -1,6 +1,7 @@ module HwlocTrees -using Hwloc, Printf +using Hwloc +using Printf: Printf, @sprintf import AbstractTrees mutable struct HwlocTreeNode{T} diff --git a/src/Hwloc.jl b/src/Hwloc.jl index 8f4f5ef..5a86c8c 100644 --- a/src/Hwloc.jl +++ b/src/Hwloc.jl @@ -1,6 +1,5 @@ module Hwloc using Hwloc_jll -using Statistics import Base: show, IteratorSize, IteratorEltype, isempty, eltype, iterate diff --git a/src/libhwloc.jl b/src/libhwloc.jl index 4510d1e..d338583 100644 --- a/src/libhwloc.jl +++ b/src/libhwloc.jl @@ -1,9 +1,9 @@ module LibHwloc -using Hwloc_jll +using Hwloc_jll: Hwloc_jll, libhwloc export Hwloc_jll -using CEnum +using CEnum: CEnum, @cenum const __pid_t = Cint diff --git a/src/libhwloc_extensions.jl b/src/libhwloc_extensions.jl index 9a9984a..f0ba164 100644 --- a/src/libhwloc_extensions.jl +++ b/src/libhwloc_extensions.jl @@ -2,8 +2,6 @@ module LibHwlocExtensions using ..LibHwloc: libhwloc -using CEnum - function hwloc_pci_class_string(class_id) val = ccall( (:hwloc_pci_class_string, libhwloc), @@ -14,4 +12,4 @@ function hwloc_pci_class_string(class_id) return unsafe_string(val) end -end \ No newline at end of file +end diff --git a/src/lowlevel_api.jl b/src/lowlevel_api.jl index d0e2af9..95d1b04 100644 --- a/src/lowlevel_api.jl +++ b/src/lowlevel_api.jl @@ -1,19 +1,14 @@ using ..LibHwloc: - hwloc_cpuset_t, hwloc_nodeset_t, hwloc_obj_type_t, hwloc_obj_cache_type_t, - hwloc_obj_bridge_type_t, hwloc_obj_osdev_type_t, hwloc_distances_s, - hwloc_obj, hwloc_obj_t, hwloc_obj_attr_u, hwloc_cache_attr_s, - hwloc_group_attr_s, hwloc_bridge_attr_s, hwloc_pcidev_attr_s, - hwloc_osdev_attr_s, hwloc_topology_t, hwloc_topology_init, - hwloc_topology_load, hwloc_topology_get_depth, hwloc_get_nbobjs_by_depth, - hwloc_get_obj_by_depth, hwloc_topology_destroy, hwloc_type_filter_e, - hwloc_topology_set_type_filter, hwloc_topology_get_type_filter, - hwloc_topology_set_all_types_filter, hwloc_topology_set_cache_types_filter, - hwloc_topology_set_icache_types_filter, hwloc_topology_set_io_types_filter, - hwloc_topology_set_userdata, hwloc_topology_get_userdata, var"##Ctag#349", - var"##Ctag#350", hwloc_cpukinds_get_nr, hwloc_bitmap_alloc, hwloc_bitmap_alloc_full, - hwloc_bitmap_free, hwloc_cpukinds_get_by_cpuset, hwloc_bitmap_from_ulong, - hwloc_cpukinds_get_info, hwloc_info_s, hwloc_bitmap_nr_ulongs, - hwloc_bitmap_to_ulongs, hwloc_topology_set_flags + hwloc_obj_type_t, hwloc_obj_cache_type_t, hwloc_obj_bridge_type_t, + hwloc_obj_osdev_type_t, hwloc_obj_t, hwloc_obj_attr_u, hwloc_cache_attr_s, + hwloc_group_attr_s, hwloc_bridge_attr_s, hwloc_pcidev_attr_s, hwloc_topology_t, + hwloc_topology_init, hwloc_topology_load, hwloc_topology_get_depth, + hwloc_get_nbobjs_by_depth, hwloc_get_obj_by_depth, hwloc_topology_destroy, + hwloc_type_filter_e, hwloc_topology_get_type_filter, + hwloc_topology_set_io_types_filter, var"##Ctag#349", var"##Ctag#350", + hwloc_cpukinds_get_nr, hwloc_bitmap_alloc, hwloc_bitmap_alloc_full, hwloc_bitmap_free, + hwloc_cpukinds_get_info, hwloc_info_s, hwloc_bitmap_nr_ulongs, hwloc_bitmap_to_ulongs, + hwloc_topology_set_flags using ..LibHwlocExtensions: hwloc_pci_class_string @@ -374,7 +369,7 @@ function ith_in_mask(mask::Culong, i::Integer) return !iszero(mask & imask) end -count_set_bits(mask::Culong) = count(i -> ith_in_mask(mask, i), 0:(sizeof(Culong) * 8 - 1)) +count_set_bits(mask::Culong) = count(i -> ith_in_mask(mask, i), 0:(sizeof(Culong)*8-1)) count_set_bits(masks::Vector{Culong}) = sum(count_set_bits.(masks)) struct HwlocInfo diff --git a/test/runtests.jl b/test/runtests.jl index f61b902..045bc17 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,5 @@ using Hwloc using Test -using Statistics import CpuId @testset "Hwloc.jl" begin