-
Notifications
You must be signed in to change notification settings - Fork 592
[email protected] #6435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
UebelAndre
wants to merge
4
commits into
bazelbuild:main
Choose a base branch
from
UebelAndre:numactl
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+408
−0
Open
[email protected] #6435
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| """https://github.com/numactl/numactl""" | ||
|
|
||
| module( | ||
| name = "numactl", | ||
| version = "2.0.19", | ||
| bazel_compatibility = [">=7.2.1"], | ||
| ) | ||
|
|
||
| bazel_dep(name = "rules_cc", version = "0.2.4") | ||
| bazel_dep(name = "platforms", version = "1.0.0") | ||
| bazel_dep(name = "bazel_skylib", version = "1.8.2") |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| test |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,227 @@ | ||
| load("@bazel_skylib//rules:write_file.bzl", "write_file") | ||
| load("@rules_cc//cc:cc_binary.bzl", "cc_binary") | ||
| load("@rules_cc//cc:cc_library.bzl", "cc_library") | ||
|
|
||
| LINUX_ONLY = select({ | ||
| "@platforms//os:linux": [], | ||
| "//conditions:default": ["@platforms//:incompatible"], | ||
| }) | ||
|
|
||
| # Generate config.h | ||
| write_file( | ||
| name = "gen_config_h", | ||
| out = "config.h", | ||
| content = [ | ||
| "/* config.h - Generated by Bazel */", | ||
| "", | ||
| "/* Define to 1 if you have standard C headers */", | ||
| "#define STDC_HEADERS 1", | ||
| "#define HAVE_STDIO_H 1", | ||
| "#define HAVE_STDLIB_H 1", | ||
| "#define HAVE_STRING_H 1", | ||
| "#define HAVE_STRINGS_H 1", | ||
| "#define HAVE_INTTYPES_H 1", | ||
| "#define HAVE_STDINT_H 1", | ||
| "#define HAVE_UNISTD_H 1", | ||
| "#define HAVE_SYS_TYPES_H 1", | ||
| "#define HAVE_SYS_STAT_H 1", | ||
| "", | ||
| "/* TLS support */", | ||
| "#if defined(__GNUC__) || defined(__clang__)", | ||
| "#define TLS __thread", | ||
| "#endif", | ||
| "", | ||
| "/* Symver attribute support - disabled for Bazel builds */", | ||
| "/* #undef HAVE_ATTRIBUTE_SYMVER */", | ||
| "", | ||
| "/* Package information */", | ||
| "#define PACKAGE \"numactl\"", | ||
| "#define PACKAGE_NAME \"numactl\"", | ||
| "#define PACKAGE_VERSION \"2.0.19\"", | ||
| "#define PACKAGE_STRING \"numactl 2.0.19\"", | ||
| "#define VERSION \"2.0.19\"", | ||
| "", | ||
| ], | ||
| newline = "unix", | ||
| ) | ||
|
|
||
| # Common compiler flags | ||
| COMMON_COPTS = ["-Wall"] | ||
|
|
||
| # Common headers for internal use | ||
| INTERNAL_HDRS = [ | ||
| "numaint.h", | ||
| "util.h", | ||
| "affinity.h", | ||
| "sysfs.h", | ||
| "rtnetlink.h", | ||
| "shm.h", | ||
| "clearcache.h", | ||
| "mt.h", | ||
| "stream_lib.h", | ||
| ] | ||
UebelAndre marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # libnuma: NUMA policy library | ||
| cc_library( | ||
| name = "numa", | ||
| srcs = [ | ||
| "affinity.c", | ||
| "distance.c", | ||
| "libnuma.c", | ||
| "rtnetlink.c", | ||
| "syscall.c", | ||
| "sysfs.c", | ||
| ":gen_config_h", | ||
| ] + INTERNAL_HDRS, | ||
| hdrs = [ | ||
| "numa.h", | ||
| "numacompat1.h", | ||
| "numaif.h", | ||
| ], | ||
| copts = COMMON_COPTS, | ||
| includes = ["."], | ||
| linkstatic = True, | ||
| target_compatible_with = LINUX_ONLY, | ||
| visibility = ["//visibility:public"], | ||
| alwayslink = True, | ||
| ) | ||
|
|
||
| # Utility library for command-line tools and tests | ||
| cc_library( | ||
| name = "util", | ||
| srcs = [ | ||
| "util.c", | ||
| ":gen_config_h", | ||
| ], | ||
| hdrs = ["util.h"], | ||
| copts = COMMON_COPTS, | ||
| includes = ["."], | ||
| linkstatic = True, | ||
| target_compatible_with = LINUX_ONLY, | ||
| visibility = ["//visibility:public"], | ||
| deps = [":numa"], | ||
| alwayslink = True, | ||
| ) | ||
|
|
||
| # numactl: NUMA policy control | ||
| cc_binary( | ||
| name = "numactl", | ||
| srcs = [ | ||
| "numactl.c", | ||
| "shm.c", | ||
| "shm.h", | ||
| ":gen_config_h", | ||
| ], | ||
| copts = COMMON_COPTS + ["-DVERSION=\\\"2.0.19\\\""], | ||
| linkstatic = True, | ||
| target_compatible_with = LINUX_ONLY, | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| ":numa", | ||
| ":util", | ||
| ], | ||
| ) | ||
|
|
||
| # numastat: NUMA statistics | ||
| cc_binary( | ||
| name = "numastat", | ||
| srcs = [ | ||
| "numastat.c", | ||
| ":gen_config_h", | ||
| ], | ||
| copts = COMMON_COPTS + [ | ||
| "-std=gnu99", | ||
| "-DVERSION=\\\"2.0.19\\\"", | ||
| ], | ||
| target_compatible_with = LINUX_ONLY, | ||
| visibility = ["//visibility:public"], | ||
| ) | ||
|
|
||
| # numademo: NUMA demonstration/benchmark | ||
| cc_binary( | ||
| name = "numademo", | ||
| srcs = [ | ||
| "clearcache.c", | ||
| "clearcache.h", | ||
| "mt.c", | ||
| "mt.h", | ||
| "numademo.c", | ||
| "stream_lib.c", | ||
| "stream_lib.h", | ||
| ":gen_config_h", | ||
| ], | ||
| copts = COMMON_COPTS + [ | ||
| "-O3", | ||
| "-ffast-math", | ||
| "-funroll-loops", | ||
| "-DHAVE_STREAM_LIB", | ||
| "-DHAVE_MT", | ||
| "-DHAVE_CLEAR_CACHE", | ||
| ], | ||
| linkopts = ["-lm"], | ||
| linkstatic = True, | ||
| target_compatible_with = LINUX_ONLY, | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| ":numa", | ||
| ":util", | ||
| ], | ||
| ) | ||
|
|
||
| # migratepages: Migrate pages of a process | ||
| cc_binary( | ||
| name = "migratepages", | ||
| srcs = [ | ||
| "migratepages.c", | ||
| ":gen_config_h", | ||
| ], | ||
| copts = COMMON_COPTS, | ||
| linkstatic = True, | ||
| target_compatible_with = LINUX_ONLY, | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| ":numa", | ||
| ":util", | ||
| ], | ||
| ) | ||
|
|
||
| # migspeed: Measure migration speed | ||
| cc_binary( | ||
| name = "migspeed", | ||
| srcs = [ | ||
| "migspeed.c", | ||
| ":gen_config_h", | ||
| ], | ||
| copts = COMMON_COPTS, | ||
| linkstatic = True, | ||
| target_compatible_with = LINUX_ONLY, | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| ":numa", | ||
| ":util", | ||
| ], | ||
| ) | ||
|
|
||
| # memhog: Memory allocation test | ||
| cc_binary( | ||
| name = "memhog", | ||
| srcs = [ | ||
| "memhog.c", | ||
| ":gen_config_h", | ||
| ], | ||
| copts = COMMON_COPTS, | ||
| linkstatic = True, | ||
| target_compatible_with = LINUX_ONLY, | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| ":numa", | ||
| ":util", | ||
| ], | ||
| ) | ||
|
|
||
| # Convenience alias | ||
| alias( | ||
| name = "libnuma", | ||
| actual = ":numa", | ||
| visibility = ["//visibility:public"], | ||
| ) | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| """https://github.com/numactl/numactl""" | ||
|
|
||
| module( | ||
| name = "numactl", | ||
| version = "2.0.19", | ||
| bazel_compatibility = [">=7.2.1"], | ||
| ) | ||
|
|
||
| bazel_dep(name = "rules_cc", version = "0.2.4") | ||
| bazel_dep(name = "platforms", version = "1.0.0") | ||
| bazel_dep(name = "bazel_skylib", version = "1.8.2") |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| load("@rules_cc//cc:cc_test.bzl", "cc_test") | ||
|
|
||
| # Common configuration for all tests | ||
| COMMON_COPTS = ["-Wall"] | ||
|
|
||
| # Linux-only constraint - all numactl tests require Linux | ||
| LINUX_ONLY = select({ | ||
| "@platforms//os:linux": [], | ||
| "//conditions:default": ["@platforms//:incompatible"], | ||
| }) | ||
|
|
||
| # Test programs from Makefile.am | ||
| # All tests are Linux-specific | ||
| # Tests that work without NUMA hardware | ||
| TEST_CASES = { | ||
| "ftok": ["ftok.c"], | ||
| "mynode": ["mynode.c"], | ||
| "pagesize": ["pagesize.c"], | ||
| } | ||
|
|
||
| # Tests that require NUMA hardware/kernel support (tagged as manual) | ||
| MANUAL_TEST_CASES = { | ||
| "distance": ["distance.c"], | ||
| "mbind_mig_pages": ["mbind_mig_pages.c"], | ||
| "migrate_pages": ["migrate_pages.c"], | ||
| "move_pages": ["move_pages.c"], | ||
| "nodemap": ["nodemap.c"], | ||
| "realloc_test": ["realloc_test.c"], | ||
| "tshared": ["tshared.c"], | ||
| } | ||
|
|
||
| # Generate basic tests | ||
| [cc_test( | ||
| name = name, | ||
| srcs = srcs, | ||
| copts = COMMON_COPTS, | ||
| linkstatic = True, | ||
| target_compatible_with = LINUX_ONLY, | ||
| deps = ["@numactl//:numa"], | ||
| ) for name, srcs in TEST_CASES.items()] | ||
|
|
||
| # Generate manual tests (require NUMA hardware) | ||
| [cc_test( | ||
| name = name, | ||
| srcs = srcs, | ||
| copts = COMMON_COPTS, | ||
| linkstatic = True, | ||
| tags = ["manual"], | ||
| target_compatible_with = LINUX_ONLY, | ||
| deps = ["@numactl//:numa"], | ||
| ) for name, srcs in MANUAL_TEST_CASES.items()] | ||
|
|
||
| # Tests that also need util library | ||
| cc_test( | ||
| name = "node-parse", | ||
| srcs = ["node-parse.c"], | ||
| copts = COMMON_COPTS, | ||
| linkstatic = True, | ||
| target_compatible_with = LINUX_ONLY, | ||
| deps = [ | ||
| "@numactl//:numa", | ||
| "@numactl//:util", | ||
| ], | ||
| ) | ||
|
|
||
| cc_test( | ||
| name = "prefered", | ||
| srcs = ["prefered.c"], | ||
| copts = COMMON_COPTS, | ||
| linkstatic = True, | ||
| tags = ["manual"], # Requires NUMA hardware | ||
| target_compatible_with = LINUX_ONLY, | ||
| deps = [ | ||
| "@numactl//:numa", | ||
| "@numactl//:util", | ||
| ], | ||
| ) | ||
|
|
||
| cc_test( | ||
| name = "tbitmap", | ||
| srcs = ["tbitmap.c"], | ||
| copts = COMMON_COPTS, | ||
| linkstatic = True, | ||
| target_compatible_with = LINUX_ONLY, | ||
| deps = [ | ||
| "@numactl//:numa", | ||
| "@numactl//:util", | ||
| ], | ||
| ) | ||
|
|
||
| # Test that is known to be broken (per Makefile.am comment) | ||
| cc_test( | ||
| name = "randmap", | ||
| srcs = ["randmap.c"], | ||
| copts = COMMON_COPTS, | ||
| linkstatic = True, | ||
| tags = ["manual"], | ||
| target_compatible_with = LINUX_ONLY, | ||
| deps = ["@numactl//:numa"], | ||
| ) |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| module( | ||
| name = "numactl_test", | ||
| version = "0.0.0", | ||
| ) | ||
|
|
||
| bazel_dep(name = "numactl", version = "0.0.0") | ||
| local_path_override( | ||
| module_name = "numactl", | ||
| path = "../", | ||
| ) | ||
|
|
||
| bazel_dep(name = "platforms", version = "1.0.0") | ||
| bazel_dep(name = "rules_cc", version = "0.2.4") | ||
| bazel_dep(name = "bazel_skylib", version = "1.8.2") |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| bcr_test_module: | ||
| module_path: "test" | ||
| matrix: | ||
| platform: ["rockylinux8", "ubuntu2004", "ubuntu2004_arm64"] | ||
| bazel: ["7.x", "8.x", "rolling"] | ||
| tasks: | ||
| verify_targets: | ||
| name: "Run test module" | ||
| platform: ${{ platform }} | ||
| bazel: ${{ bazel }} | ||
| build_targets: | ||
| - "@numactl//..." | ||
| test_targets: | ||
| - "//..." |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "url": "https://github.com/numactl/numactl/releases/download/v2.0.19/numactl-2.0.19.tar.gz", | ||
| "strip_prefix": "numactl-2.0.19", | ||
| "integrity": "sha256-8mcqA4HLWRlunCRr+LzEPVVovEV3AKaX8aHfdiua+IQ=", | ||
| "overlay": { | ||
| ".bazelignore": "sha256-8sobtsfpB9Btr+Roflefznazfk6Tt2BQItpS5szCb9I=", | ||
| "BUILD.bazel": "sha256-hp5wpyIJ6sAj6CVtJ25WaYQQJpwE5jo2VgtEyRavt0M=", | ||
| "MODULE.bazel": "sha256-SQWxK9vTP6M/Fu0QhJOe6g1QgepytdQlkcMmcACe9cY=", | ||
| "test/BUILD.bazel": "sha256-n2drjZwTpakw8mun/CL98ARNbu60jhDiP9AY5JyXSrA=", | ||
| "test/MODULE.bazel": "sha256-s8fjAzkHpgkL6fzAOuvN9BGuiiRT3V1QwKMF1nuqu84=" | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't this cause warning spam if consumers use a different compiler? Protobuf has been doing this forever and it's always been very painful.