Skip to content

Commit 78c8fde

Browse files
committed
1 parent 74c2079 commit 78c8fde

File tree

9 files changed

+389
-0
lines changed

9 files changed

+389
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""https://github.com/numactl/numactl"""
2+
3+
module(
4+
name = "numactl",
5+
version = "2.0.19",
6+
bazel_compatibility = [">=7.2.1"],
7+
)
8+
9+
bazel_dep(name = "rules_cc", version = "0.2.4")
10+
bazel_dep(name = "platforms", version = "1.0.0")
11+
bazel_dep(name = "bazel_skylib", version = "1.8.2")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test
Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
load("@bazel_skylib//rules:write_file.bzl", "write_file")
2+
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
3+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
4+
5+
LINUX_ONLY = select({
6+
"@platforms//os:linux": [],
7+
"//conditions:default": ["@platforms//:incompatible"],
8+
})
9+
10+
# Generate config.h
11+
write_file(
12+
name = "gen_config_h",
13+
out = "config.h",
14+
content = [
15+
"/* config.h - Generated by Bazel */",
16+
"",
17+
"/* Define to 1 if you have standard C headers */",
18+
"#define STDC_HEADERS 1",
19+
"#define HAVE_STDIO_H 1",
20+
"#define HAVE_STDLIB_H 1",
21+
"#define HAVE_STRING_H 1",
22+
"#define HAVE_STRINGS_H 1",
23+
"#define HAVE_INTTYPES_H 1",
24+
"#define HAVE_STDINT_H 1",
25+
"#define HAVE_UNISTD_H 1",
26+
"#define HAVE_SYS_TYPES_H 1",
27+
"#define HAVE_SYS_STAT_H 1",
28+
"",
29+
"/* TLS support */",
30+
"#if defined(__GNUC__) || defined(__clang__)",
31+
"#define TLS __thread",
32+
"#endif",
33+
"",
34+
"/* Symver attribute support */",
35+
"#if defined(__GNUC__) || defined(__clang__)",
36+
"#define HAVE_ATTRIBUTE_SYMVER 1",
37+
"#endif",
38+
"",
39+
"/* Package information */",
40+
"#define PACKAGE \"numactl\"",
41+
"#define PACKAGE_NAME \"numactl\"",
42+
"#define PACKAGE_VERSION \"2.0.19\"",
43+
"#define PACKAGE_STRING \"numactl 2.0.19\"",
44+
"#define VERSION \"2.0.19\"",
45+
"",
46+
],
47+
newline = "unix",
48+
)
49+
50+
# Common compiler flags
51+
COMMON_COPTS = ["-Wall"]
52+
53+
# Common headers for internal use
54+
INTERNAL_HDRS = [
55+
"numaint.h",
56+
"util.h",
57+
"affinity.h",
58+
"sysfs.h",
59+
"rtnetlink.h",
60+
"shm.h",
61+
"clearcache.h",
62+
"mt.h",
63+
"stream_lib.h",
64+
]
65+
66+
# libnuma: NUMA policy library
67+
cc_library(
68+
name = "numa",
69+
srcs = [
70+
"affinity.c",
71+
"distance.c",
72+
"libnuma.c",
73+
"rtnetlink.c",
74+
"syscall.c",
75+
"sysfs.c",
76+
":gen_config_h",
77+
] + INTERNAL_HDRS,
78+
hdrs = [
79+
"numa.h",
80+
"numacompat1.h",
81+
"numaif.h",
82+
],
83+
additional_linker_inputs = ["versions.ldscript"],
84+
copts = COMMON_COPTS,
85+
includes = ["."],
86+
linkopts = select({
87+
"@platforms//os:linux": [
88+
"-Wl,--version-script,$(execpath versions.ldscript)",
89+
"-Wl,-init,numa_init",
90+
"-Wl,-fini,numa_fini",
91+
],
92+
"//conditions:default": [],
93+
}),
94+
target_compatible_with = LINUX_ONLY,
95+
visibility = ["//visibility:public"],
96+
alwayslink = True,
97+
)
98+
99+
# Utility library for command-line tools and tests
100+
cc_library(
101+
name = "util",
102+
srcs = [
103+
"util.c",
104+
":gen_config_h",
105+
],
106+
hdrs = ["util.h"],
107+
copts = COMMON_COPTS,
108+
includes = ["."],
109+
target_compatible_with = LINUX_ONLY,
110+
visibility = ["@numactl_test//:__subpackages__"],
111+
deps = [":numa"],
112+
)
113+
114+
# numactl: NUMA policy control
115+
cc_binary(
116+
name = "numactl",
117+
srcs = [
118+
"numactl.c",
119+
"shm.c",
120+
"shm.h",
121+
":gen_config_h",
122+
],
123+
copts = COMMON_COPTS + ["-DVERSION=\\\"2.0.19\\\""],
124+
target_compatible_with = LINUX_ONLY,
125+
visibility = ["//visibility:public"],
126+
deps = [
127+
":numa",
128+
":util",
129+
],
130+
)
131+
132+
# numastat: NUMA statistics
133+
cc_binary(
134+
name = "numastat",
135+
srcs = [
136+
"numastat.c",
137+
":gen_config_h",
138+
],
139+
copts = COMMON_COPTS + [
140+
"-std=gnu99",
141+
"-DVERSION=\\\"2.0.19\\\"",
142+
],
143+
target_compatible_with = LINUX_ONLY,
144+
visibility = ["//visibility:public"],
145+
)
146+
147+
# numademo: NUMA demonstration/benchmark
148+
cc_binary(
149+
name = "numademo",
150+
srcs = [
151+
"clearcache.c",
152+
"clearcache.h",
153+
"mt.c",
154+
"mt.h",
155+
"numademo.c",
156+
"stream_lib.c",
157+
"stream_lib.h",
158+
":gen_config_h",
159+
],
160+
copts = COMMON_COPTS + [
161+
"-O3",
162+
"-ffast-math",
163+
"-funroll-loops",
164+
"-DHAVE_STREAM_LIB",
165+
"-DHAVE_MT",
166+
"-DHAVE_CLEAR_CACHE",
167+
],
168+
linkopts = ["-lm"],
169+
target_compatible_with = LINUX_ONLY,
170+
visibility = ["//visibility:public"],
171+
deps = [
172+
":numa",
173+
":util",
174+
],
175+
)
176+
177+
# migratepages: Migrate pages of a process
178+
cc_binary(
179+
name = "migratepages",
180+
srcs = [
181+
"migratepages.c",
182+
":gen_config_h",
183+
],
184+
copts = COMMON_COPTS,
185+
target_compatible_with = LINUX_ONLY,
186+
visibility = ["//visibility:public"],
187+
deps = [
188+
":numa",
189+
":util",
190+
],
191+
)
192+
193+
# migspeed: Measure migration speed
194+
cc_binary(
195+
name = "migspeed",
196+
srcs = [
197+
"migspeed.c",
198+
":gen_config_h",
199+
],
200+
copts = COMMON_COPTS,
201+
target_compatible_with = LINUX_ONLY,
202+
visibility = ["//visibility:public"],
203+
deps = [
204+
":numa",
205+
":util",
206+
],
207+
)
208+
209+
# memhog: Memory allocation test
210+
cc_binary(
211+
name = "memhog",
212+
srcs = [
213+
"memhog.c",
214+
":gen_config_h",
215+
],
216+
copts = COMMON_COPTS,
217+
target_compatible_with = LINUX_ONLY,
218+
visibility = ["//visibility:public"],
219+
deps = [
220+
":numa",
221+
":util",
222+
],
223+
)
224+
225+
# Convenience alias
226+
alias(
227+
name = "libnuma",
228+
actual = ":numa",
229+
visibility = ["//visibility:public"],
230+
)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""https://github.com/numactl/numactl"""
2+
3+
module(
4+
name = "numactl",
5+
version = "2.0.19",
6+
bazel_compatibility = [">=7.2.1"],
7+
)
8+
9+
bazel_dep(name = "rules_cc", version = "0.2.4")
10+
bazel_dep(name = "platforms", version = "1.0.0")
11+
bazel_dep(name = "bazel_skylib", version = "1.8.2")
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
load("@rules_cc//cc:cc_test.bzl", "cc_test")
2+
3+
# Common configuration for all tests
4+
COMMON_COPTS = ["-Wall"]
5+
6+
# Linux-only constraint - all numactl tests require Linux
7+
LINUX_ONLY = select({
8+
"@platforms//os:linux": [],
9+
"//conditions:default": ["@platforms//:incompatible"],
10+
})
11+
12+
# Test programs from Makefile.am
13+
# All tests are Linux-specific
14+
TEST_CASES = {
15+
"distance": ["distance.c"],
16+
"ftok": ["ftok.c"],
17+
"mbind_mig_pages": ["mbind_mig_pages.c"],
18+
"migrate_pages": ["migrate_pages.c"],
19+
"move_pages": ["move_pages.c"],
20+
"mynode": ["mynode.c"],
21+
"nodemap": ["nodemap.c"],
22+
"pagesize": ["pagesize.c"],
23+
"realloc_test": ["realloc_test.c"],
24+
"tshared": ["tshared.c"],
25+
}
26+
27+
# Generate basic tests
28+
[cc_test(
29+
name = name,
30+
srcs = srcs,
31+
copts = COMMON_COPTS,
32+
target_compatible_with = LINUX_ONLY,
33+
deps = ["@numactl//:numa"],
34+
) for name, srcs in TEST_CASES.items()]
35+
36+
# Tests that also need util library
37+
cc_test(
38+
name = "node-parse",
39+
srcs = ["node-parse.c"],
40+
copts = COMMON_COPTS,
41+
target_compatible_with = LINUX_ONLY,
42+
deps = [
43+
"@numactl//:numa",
44+
"@numactl//:util",
45+
],
46+
)
47+
48+
cc_test(
49+
name = "prefered",
50+
srcs = ["prefered.c"],
51+
copts = COMMON_COPTS,
52+
target_compatible_with = LINUX_ONLY,
53+
deps = [
54+
"@numactl//:numa",
55+
"@numactl//:util",
56+
],
57+
)
58+
59+
cc_test(
60+
name = "tbitmap",
61+
srcs = ["tbitmap.c"],
62+
copts = COMMON_COPTS,
63+
target_compatible_with = LINUX_ONLY,
64+
deps = [
65+
"@numactl//:numa",
66+
"@numactl//:util",
67+
],
68+
)
69+
70+
# Test that is known to be broken (per Makefile.am comment)
71+
cc_test(
72+
name = "randmap",
73+
srcs = ["randmap.c"],
74+
copts = COMMON_COPTS,
75+
tags = ["manual"],
76+
target_compatible_with = LINUX_ONLY,
77+
deps = ["@numactl//:numa"],
78+
)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module(
2+
name = "numactl_test",
3+
version = "0.0.0",
4+
)
5+
6+
bazel_dep(name = "numactl", version = "0.0.0")
7+
local_path_override(
8+
module_name = "numactl",
9+
path = "../",
10+
)
11+
12+
bazel_dep(name = "platforms", version = "1.0.0")
13+
bazel_dep(name = "rules_cc", version = "0.2.4")
14+
bazel_dep(name = "bazel_skylib", version = "1.8.2")
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
bcr_test_module:
2+
module_path: "test"
3+
matrix:
4+
platform: ["rockylinux8", "ubuntu2004", "ubuntu2004_arm64"]
5+
bazel: ["7.x", "8.x", "rolling"]
6+
tasks:
7+
verify_targets:
8+
name: "Run test module"
9+
platform: ${{ platform }}
10+
bazel: ${{ bazel }}
11+
build_targets:
12+
- "@numactl//..."
13+
test_targets:
14+
- "//..."

modules/numactl/2.0.19/source.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"url": "https://github.com/numactl/numactl/releases/download/v2.0.19/numactl-2.0.19.tar.gz",
3+
"strip_prefix": "numactl-2.0.19",
4+
"integrity": "sha256-8mcqA4HLWRlunCRr+LzEPVVovEV3AKaX8aHfdiua+IQ=",
5+
"overlay": {
6+
".bazelignore": "sha256-8sobtsfpB9Btr+Roflefznazfk6Tt2BQItpS5szCb9I=",
7+
"BUILD.bazel": "sha256-PPOFHtwmoaxAYsMrqEqUyGWWigX25/KCH7LpZkdhL8w=",
8+
"MODULE.bazel": "sha256-SQWxK9vTP6M/Fu0QhJOe6g1QgepytdQlkcMmcACe9cY=",
9+
"test/BUILD.bazel": "sha256-XCYrpBVqkIP2AP3rfz+DWYiCtv0trY0+qb5C0Z4v3/8=",
10+
"test/MODULE.bazel": "sha256-s8fjAzkHpgkL6fzAOuvN9BGuiiRT3V1QwKMF1nuqu84="
11+
}
12+
}

modules/numactl/metadata.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"homepage": "https://github.com/numactl/numactl",
3+
"maintainers": [
4+
{
5+
"email": "[email protected]",
6+
"github": "UebelAndre",
7+
"github_user_id": 26427366,
8+
"name": "UebelAndre"
9+
}
10+
],
11+
"repository": [
12+
"github:numactl/numactl"
13+
],
14+
"versions": [
15+
"2.0.19"
16+
],
17+
"yanked_versions": {}
18+
}

0 commit comments

Comments
 (0)