mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-06 23:52:38 -05:00
Compare commits
1054 Commits
v6.2.0-bet
...
1438672fe5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1438672fe5 | ||
|
|
f6dbe32c86 | ||
|
|
4948a8c354 | ||
|
|
637c023d06 | ||
|
|
ce0b879542 | ||
|
|
f006ec0b68 | ||
|
|
04e5ff0349 | ||
|
|
9ad1c02430 | ||
|
|
61c263af6e | ||
|
|
fe0ed9eaae | ||
|
|
d8f39ebef3 | ||
|
|
07d53fb77e | ||
|
|
4c57b60e59 | ||
|
|
e6c81d7166 | ||
|
|
94840c70d8 | ||
|
|
e1478bfa94 | ||
|
|
6df6e15267 | ||
|
|
834ea44507 | ||
|
|
73dc0ffb7e | ||
|
|
e57641d6b1 | ||
|
|
b324e34444 | ||
|
|
fdfbb60840 | ||
|
|
3ded8e6734 | ||
|
|
ee51dec499 | ||
|
|
575742078c | ||
|
|
6bab67bced | ||
|
|
db9069897d | ||
|
|
30641b1bdf | ||
|
|
45061f40d8 | ||
|
|
9f70752090 | ||
|
|
22d6a7525e | ||
|
|
774f630e14 | ||
|
|
09a7219651 | ||
|
|
97869f3347 | ||
|
|
1bbbff7d17 | ||
|
|
97683e5719 | ||
|
|
059d5d8421 | ||
|
|
285719cde4 | ||
|
|
d6a1c98314 | ||
|
|
75283445fd | ||
|
|
45084cb718 | ||
|
|
bc150fec04 | ||
|
|
c877ba8145 | ||
|
|
6793981066 | ||
|
|
9a0cd68ea5 | ||
|
|
603eb261c5 | ||
|
|
1ae9a4e428 | ||
|
|
0e57053c5a | ||
|
|
de97f3492e | ||
|
|
8a167cb2a7 | ||
|
|
d0953a507c | ||
|
|
fe8e198106 | ||
|
|
232d2d6dc5 | ||
|
|
a3cb74f29b | ||
|
|
dfc3b4632a | ||
|
|
6106bf30de | ||
|
|
56753d7c4a | ||
|
|
f7b9e3ca67 | ||
|
|
56c95703a5 | ||
|
|
eadf272425 | ||
|
|
cb227a0a79 | ||
|
|
4c171bea1e | ||
|
|
e55a854314 | ||
|
|
5bdfafd719 | ||
|
|
15a2091837 | ||
|
|
48bd09f730 | ||
|
|
21fb970949 | ||
|
|
23c12fc351 | ||
|
|
71d193676a | ||
|
|
baef34ba8c | ||
|
|
95a739d821 | ||
|
|
7b9135aadc | ||
|
|
e6f694ca9e | ||
|
|
afd79e7537 | ||
|
|
a2728af4f7 | ||
|
|
65dbded9c4 | ||
|
|
f25e65b5ac | ||
|
|
bbb19ea2f9 | ||
|
|
1c5b332add | ||
|
|
87fd0ea94a | ||
|
|
4a42dca2cb | ||
|
|
b674fafa0f | ||
|
|
b5da73389f | ||
|
|
bf5e38545c | ||
|
|
f7543ada60 | ||
|
|
95e1705fc8 | ||
|
|
2d0b07afbc | ||
|
|
b33ccf0e0b | ||
|
|
4f5f9bdffb | ||
|
|
4d3e3daa6a | ||
|
|
802029e5f5 | ||
|
|
14117e9658 | ||
|
|
7ccb1d65f0 | ||
|
|
15de3cc16c | ||
|
|
124daa4afd | ||
|
|
5de1609b7d | ||
|
|
644f4cc017 | ||
|
|
41a3f97060 | ||
|
|
452080cfbd | ||
|
|
4f103b6b45 | ||
|
|
39609c9183 | ||
|
|
2adb7b2b74 | ||
|
|
3673137df6 | ||
|
|
faa7095865 | ||
|
|
e0701f9dad | ||
|
|
14aacf8636 | ||
|
|
c764441337 | ||
|
|
05fae12a63 | ||
|
|
8059ce67f9 | ||
|
|
10111fd7f9 | ||
|
|
2d25bec2df | ||
|
|
cab244d468 | ||
|
|
4001488888 | ||
|
|
9bec1521b8 | ||
|
|
7bde3ed5f7 | ||
|
|
2e738509bb | ||
|
|
f5447088cb | ||
|
|
7f2f50a8d9 | ||
|
|
5747ccfafc | ||
|
|
93081eb1f6 | ||
|
|
4bf65c8669 | ||
|
|
1a6fc3a665 | ||
|
|
8dede14ac8 | ||
|
|
20687a397e | ||
|
|
454f97fa0f | ||
|
|
8149fc7dcb | ||
|
|
a39ab89236 | ||
|
|
5b8501fb57 | ||
|
|
039be2ab75 | ||
|
|
718c7e0fc1 | ||
|
|
ef7951b91d | ||
|
|
214b1f021b | ||
|
|
81b18c0741 | ||
|
|
8e83f72456 | ||
|
|
c2ae625032 | ||
|
|
60566dc84c | ||
|
|
4ea8fe694d | ||
|
|
669d1ab008 | ||
|
|
e87d5111a2 | ||
|
|
56158779de | ||
|
|
efb322df66 | ||
|
|
e673d541c1 | ||
|
|
a98db529fb | ||
|
|
1a9eaaad8f | ||
|
|
be5fbca9b6 | ||
|
|
2feb264375 | ||
|
|
00990f2649 | ||
|
|
d78713be48 | ||
|
|
77367abe13 | ||
|
|
cd046f6fd0 | ||
|
|
63b7ec2887 | ||
|
|
a1e8f1c3e5 | ||
|
|
6db480a1ab | ||
|
|
a7acd9de6d | ||
|
|
a64f4d1870 | ||
|
|
9bfe59b630 | ||
|
|
1a4bf16521 | ||
|
|
a4d5d0a75a | ||
|
|
c40f1f9f66 | ||
|
|
15e5052dd0 | ||
|
|
f9f7963453 | ||
|
|
02240eff8c | ||
|
|
d64c963e5e | ||
|
|
c6292ce9ee | ||
|
|
cd652e2644 | ||
|
|
6f5ef0fe0f | ||
|
|
01fa968763 | ||
|
|
8e6f3ad99e | ||
|
|
b1f2479ec1 | ||
|
|
ecceba8ecd | ||
|
|
cb5f4a9c17 | ||
|
|
3a8ebfdcb6 | ||
|
|
0dcafeb571 | ||
|
|
a1d7ee4c6b | ||
|
|
03e70ba2ed | ||
|
|
19ef8c5d65 | ||
|
|
63baa9e263 | ||
|
|
1248bd5859 | ||
|
|
5c951ddb8a | ||
|
|
4ab0ad928d | ||
|
|
e67eb47796 | ||
|
|
a6656a8c49 | ||
|
|
a903d0a5bd | ||
|
|
ceaebfd877 | ||
|
|
5156ff11a8 | ||
|
|
e0143a92a8 | ||
|
|
f682d9a2e9 | ||
|
|
3bece0ff40 | ||
|
|
e6c456a970 | ||
|
|
923d1d712f | ||
|
|
ae8459bd35 | ||
|
|
3a7be07c62 | ||
|
|
e1cc0000c6 | ||
|
|
1210e8e95c | ||
|
|
a45fbd9cae | ||
|
|
f6d45f7990 | ||
|
|
b9464f993b | ||
|
|
f8f73b0cd7 | ||
|
|
df6ab2edd8 | ||
|
|
8bf7600154 | ||
|
|
a30501956f | ||
|
|
c287a40a20 | ||
|
|
04f50c24e2 | ||
|
|
7627b23212 | ||
|
|
e90e7febfb | ||
|
|
733b85a132 | ||
|
|
35ba786e63 | ||
|
|
446810a837 | ||
|
|
c6a68c3e51 | ||
|
|
ca8bef3ade | ||
|
|
d735caa334 | ||
|
|
eb54cc0e0f | ||
|
|
84c67c37cd | ||
|
|
b44f38a362 | ||
|
|
8ed4088d0a | ||
|
|
cdcea2a4f9 | ||
|
|
f0d80326ec | ||
|
|
cb8fc26cbe | ||
|
|
5ec5b5ed00 | ||
|
|
67e29c1af1 | ||
|
|
4bd94a79a4 | ||
|
|
80e597d951 | ||
|
|
2e269f5b8c | ||
|
|
57b8e35903 | ||
|
|
53be5765e6 | ||
|
|
68741c925b | ||
|
|
9ce207e667 | ||
|
|
07e0966517 | ||
|
|
a9d4c2a923 | ||
|
|
dc02e1feaa | ||
|
|
7daff331dc | ||
|
|
058a2fb0f4 | ||
|
|
4fff3b946e | ||
|
|
f7aa5e781b | ||
|
|
298c5cccfa | ||
|
|
2985571620 | ||
|
|
279d29cd7f | ||
|
|
387320ad6d | ||
|
|
76cd83edb2 | ||
|
|
7f4d667351 | ||
|
|
8027716264 | ||
|
|
a459dd7741 | ||
|
|
ef6011ac12 | ||
|
|
6d66051d92 | ||
|
|
b2cc2ef0d7 | ||
|
|
9805320517 | ||
|
|
582d17bb84 | ||
|
|
3ab07fe8c1 | ||
|
|
824ba24134 | ||
|
|
d7a6aaadea | ||
|
|
26819f01e1 | ||
|
|
d94f6e9c3a | ||
|
|
28312236fd | ||
|
|
dbc53c5d46 | ||
|
|
a7e20ea5de | ||
|
|
9e5f5b35a6 | ||
|
|
9a9c69ff50 | ||
|
|
5c1f3f395c | ||
|
|
23cefffe43 | ||
|
|
bb9e35f5d2 | ||
|
|
d048d5a639 | ||
|
|
cb2ec2316a | ||
|
|
e3b5bfeb36 | ||
|
|
cac1e4aa5e | ||
|
|
e1f0737a59 | ||
|
|
5c6c1299c8 | ||
|
|
4f90075ea0 | ||
|
|
9a6f773dea | ||
|
|
cd7c7902a9 | ||
|
|
fd3dad920d | ||
|
|
3dc192f63e | ||
|
|
123c7ab140 | ||
|
|
838996a0fc | ||
|
|
6e4fea34a4 | ||
|
|
b52c289931 | ||
|
|
4dbb5b89da | ||
|
|
84d0212e79 | ||
|
|
35acb3f00b | ||
|
|
7f2771b466 | ||
|
|
5fdf5516ff | ||
|
|
234de96784 | ||
|
|
df4532d9a1 | ||
|
|
c27f535768 | ||
|
|
c7ac314110 | ||
|
|
3215403815 | ||
|
|
bea2a6cf5b | ||
|
|
a28f411339 | ||
|
|
460d9c75c5 | ||
|
|
d1033abbe5 | ||
|
|
9eac9dd30a | ||
|
|
8d7b6adf98 | ||
|
|
230ff87634 | ||
|
|
19adf2630a | ||
|
|
3de4b16117 | ||
|
|
602e3a7587 | ||
|
|
4f6ffb67c1 | ||
|
|
a0194ddd18 | ||
|
|
30f7e876a2 | ||
|
|
5958490c23 | ||
|
|
f92ad4423d | ||
|
|
e0749a82c2 | ||
|
|
440aa003af | ||
|
|
9580f5395f | ||
|
|
e9ae4deb91 | ||
|
|
aee0762424 | ||
|
|
e6332eff2b | ||
|
|
d0a632f557 | ||
|
|
f4cdc527b0 | ||
|
|
661dc515ab | ||
|
|
6d9bafe068 | ||
|
|
202c8aaee8 | ||
|
|
410084384e | ||
|
|
43e98c509a | ||
|
|
08d79ddcdc | ||
|
|
0fdf063760 | ||
|
|
929205536c | ||
|
|
d24581c963 | ||
|
|
2eb2e90631 | ||
|
|
0842e6b9d2 | ||
|
|
93805cd167 | ||
|
|
755fe28bc3 | ||
|
|
59d780169f | ||
|
|
a30ede04f3 | ||
|
|
3f2dfa4279 | ||
|
|
7177b42903 | ||
|
|
21638c2f58 | ||
|
|
02b2b87bb6 | ||
|
|
c8a9dba8fd | ||
|
|
9a77d39a3f | ||
|
|
28a1d0fe1e | ||
|
|
0243789c04 | ||
|
|
45dd58f808 | ||
|
|
1b4abe1e98 | ||
|
|
9f778742a6 | ||
|
|
015f8aeed4 | ||
|
|
9e6311a7e0 | ||
|
|
0af9d2e75b | ||
|
|
6e2a84a46c | ||
|
|
6bb8913066 | ||
|
|
cf104ebdc5 | ||
|
|
ecba750442 | ||
|
|
3967badc55 | ||
|
|
3f3f9b0661 | ||
|
|
e3fc78a66c | ||
|
|
e6d833c227 | ||
|
|
ebe299902c | ||
|
|
bc63b63a2a | ||
|
|
e739e7d704 | ||
|
|
1bae083587 | ||
|
|
88959bd703 | ||
|
|
93e689d601 | ||
|
|
a136790bee | ||
|
|
29f2dd4b9e | ||
|
|
3003c067d3 | ||
|
|
89bc6418b1 | ||
|
|
8458b4ee39 | ||
|
|
7bfb801ce2 | ||
|
|
4567499905 | ||
|
|
9b63955b09 | ||
|
|
0414511de0 | ||
|
|
b61dad128c | ||
|
|
80ae339343 | ||
|
|
4d87555398 | ||
|
|
bef82c5de6 | ||
|
|
b069ad5dd1 | ||
|
|
f6a0646271 | ||
|
|
b5f1a1feae | ||
|
|
1ce059da1c | ||
|
|
2929451ee1 | ||
|
|
94fecb5e92 | ||
|
|
3bfa5ea038 | ||
|
|
ff82ca57f2 | ||
|
|
7f7b1fb073 | ||
|
|
d443dd86f1 | ||
|
|
3ac8f6b23a | ||
|
|
9b1f020a8b | ||
|
|
8bf88a4e74 | ||
|
|
08a2c143f5 | ||
|
|
4eb9a1aad5 | ||
|
|
c8c40586a1 | ||
|
|
29cb416107 | ||
|
|
465169ff12 | ||
|
|
df2bcd8192 | ||
|
|
d89bb56964 | ||
|
|
87a0864e3b | ||
|
|
ecf5579f36 | ||
|
|
d5523d819f | ||
|
|
dbda2e9ccd | ||
|
|
8babd7bc0a | ||
|
|
27ced139a6 | ||
|
|
b46849e813 | ||
|
|
a96a6108ff | ||
|
|
c50c78b700 | ||
|
|
cd7ab2c79f | ||
|
|
695fbc013b | ||
|
|
a403c53543 | ||
|
|
e26fbc96e9 | ||
|
|
259c165e60 | ||
|
|
7897bf02dc | ||
|
|
05f62c5ccc | ||
|
|
d82e100e30 | ||
|
|
5f869a414c | ||
|
|
7fd6be7d83 | ||
|
|
ae6c536e98 | ||
|
|
c66c593123 | ||
|
|
b3788b2ba3 | ||
|
|
b7adb34c37 | ||
|
|
ace8409a56 | ||
|
|
e2c757d9dd | ||
|
|
da35de993f | ||
|
|
854b7618ef | ||
|
|
3477f9fbc1 | ||
|
|
5799744f2f | ||
|
|
61d165a314 | ||
|
|
69186f2470 | ||
|
|
730d4a6cee | ||
|
|
54bc91d5e3 | ||
|
|
2012ffb231 | ||
|
|
5f9e0ebc6c | ||
|
|
f314c69a70 | ||
|
|
16fe462cad | ||
|
|
e6e2987ddf | ||
|
|
ed456b02cf | ||
|
|
da7f5826cb | ||
|
|
6cb398bb42 | ||
|
|
748be760e8 | ||
|
|
4a4118bb8e | ||
|
|
77f1bf0861 | ||
|
|
6bb29b3e7b | ||
|
|
f720772338 | ||
|
|
e53e48b88c | ||
|
|
ecf36ee891 | ||
|
|
23ef949dd3 | ||
|
|
92e708c6e7 | ||
|
|
30cfcc27db | ||
|
|
3c6077fb02 | ||
|
|
63883b4fa7 | ||
|
|
0f83b5e06c | ||
|
|
637a333197 | ||
|
|
3171b06048 | ||
|
|
2a66a0fa2f | ||
|
|
c080d5b962 | ||
|
|
0133107f14 | ||
|
|
253e349ef9 | ||
|
|
5126cc1414 | ||
|
|
ea1245026d | ||
|
|
2158adb711 | ||
|
|
8554bb4d9c | ||
|
|
1741354498 | ||
|
|
866e97efcf | ||
|
|
277352d072 | ||
|
|
8cae605e1f | ||
|
|
59c85eaf6a | ||
|
|
864233c110 | ||
|
|
e9b32b3009 | ||
|
|
ec608bbd05 | ||
|
|
ec2793bcc9 | ||
|
|
eb40f07552 | ||
|
|
28f268aeba | ||
|
|
bad5458d40 | ||
|
|
b72e21fc3c | ||
|
|
d578a3828f | ||
|
|
6c417eb9af | ||
|
|
dc70893e6b | ||
|
|
c5c958743e | ||
|
|
89f2fa6818 | ||
|
|
bcfd9edaa5 | ||
|
|
e0f774d6dd | ||
|
|
955cc366d1 | ||
|
|
bc4f6249be | ||
|
|
0d45600b0e | ||
|
|
2c8f7f692c | ||
|
|
3e41bdc552 | ||
|
|
5b189696d7 | ||
|
|
c6bcea3811 | ||
|
|
900dd13c45 | ||
|
|
2876f17f65 | ||
|
|
b2563ca8a6 | ||
|
|
7c0d60ac68 | ||
|
|
813a1885cb | ||
|
|
54bcf05b1d | ||
|
|
bbea8810a7 | ||
|
|
b6514957f1 | ||
|
|
69590f9777 | ||
|
|
576ff120e5 | ||
|
|
2d52118c1b | ||
|
|
28ad59d828 | ||
|
|
e0c630f34f | ||
|
|
b8f9a326aa | ||
|
|
542617b6db | ||
|
|
f5db50c9d7 | ||
|
|
856c8e6bcd | ||
|
|
b3dbf6e23f | ||
|
|
a11c57226b | ||
|
|
94d2cac775 | ||
|
|
548a7d46e1 | ||
|
|
bebc163e25 | ||
|
|
70cddc06ba | ||
|
|
1f9cdc0564 | ||
|
|
a5a7ee716d | ||
|
|
d2f24d94b9 | ||
|
|
ba3299b61b | ||
|
|
ca5dfe7c12 | ||
|
|
91ad6fcf3d | ||
|
|
0b7dfaabe0 | ||
|
|
6f8ffb7660 | ||
|
|
4a8e7510e1 | ||
|
|
32876dd01d | ||
|
|
37df513b32 | ||
|
|
31a5d05dc1 | ||
|
|
d478d737c4 | ||
|
|
e20daff4eb | ||
|
|
1ccdcb1645 | ||
|
|
072881e1a1 | ||
|
|
0c4a3cfc30 | ||
|
|
cffd0f50a4 | ||
|
|
4b1857114e | ||
|
|
b49fb27e84 | ||
|
|
ee341118ce | ||
|
|
f599807bbb | ||
|
|
a2ad626012 | ||
|
|
e8a99809b6 | ||
|
|
0fe20fe88c | ||
|
|
d1d1517b4f | ||
|
|
5980675876 | ||
|
|
3b87cd97ce | ||
|
|
d2f01cfa86 | ||
|
|
82830e359a | ||
|
|
8e3fec5768 | ||
|
|
4fd23a1bf4 | ||
|
|
8bfaddd3fc | ||
|
|
dabafaaadb | ||
|
|
5cda714254 | ||
|
|
91151ce4a1 | ||
|
|
dc1443f3b8 | ||
|
|
8af8df25aa | ||
|
|
b1e14dc1d3 | ||
|
|
f460d76f8d | ||
|
|
1c63e9efba | ||
|
|
21abbe4e84 | ||
|
|
3080f47cd6 | ||
|
|
f4ebdaa8e5 | ||
|
|
1bcfd0cdea | ||
|
|
9396ecf93d | ||
|
|
a4af964696 | ||
|
|
2c8d8ee2ab | ||
|
|
631a8ca802 | ||
|
|
346892e170 | ||
|
|
db03573804 | ||
|
|
e74573f81f | ||
|
|
0e70974d7d | ||
|
|
3a3ee91324 | ||
|
|
4108428872 | ||
|
|
4c3425a958 | ||
|
|
09624c4f9b | ||
|
|
8faef28e7d | ||
|
|
62450f4ed8 | ||
|
|
2c52a5a352 | ||
|
|
7d52bd7454 | ||
|
|
f68b105bd9 | ||
|
|
9ca1a6129b | ||
|
|
7a3df1c0bb | ||
|
|
22a1b8d82d | ||
|
|
0a462fbef5 | ||
|
|
f302b4b0ef | ||
|
|
65fe26dc6c | ||
|
|
e6d4921e21 | ||
|
|
f82d67e76e | ||
|
|
4e671a945d | ||
|
|
e38d277143 | ||
|
|
8eb9b4d37a | ||
|
|
2d45cc64c1 | ||
|
|
b9081e992b | ||
|
|
1424b2975f | ||
|
|
0fa5db8fa3 | ||
|
|
5999dccd57 | ||
|
|
78922a0772 | ||
|
|
bc3914883a | ||
|
|
86dae9e149 | ||
|
|
05b2260393 | ||
|
|
672f6df6c1 | ||
|
|
9dae559b73 | ||
|
|
b9d813c403 | ||
|
|
c48e2e6af8 | ||
|
|
76fba819fe | ||
|
|
6bab624885 | ||
|
|
3730bcd434 | ||
|
|
3b7d30a91d | ||
|
|
c8588903e3 | ||
|
|
0b4fec15dd | ||
|
|
ef8cc28f3f | ||
|
|
8471f7fad3 | ||
|
|
b99dc440af | ||
|
|
9a02007900 | ||
|
|
efc5e5d811 | ||
|
|
dea5be0a57 | ||
|
|
24c290963a | ||
|
|
9dffcdaddd | ||
|
|
3df47052ed | ||
|
|
3b8d081c8c | ||
|
|
05e6f66169 | ||
|
|
11e0d3de3a | ||
|
|
ea367da064 | ||
|
|
a999a56775 | ||
|
|
590252bd5e | ||
|
|
cc2de4f768 | ||
|
|
aeea0e0a6c | ||
|
|
82d698a1e5 | ||
|
|
95b2b5e028 | ||
|
|
eae84d47e7 | ||
|
|
45d12314f4 | ||
|
|
fa11cb623d | ||
|
|
7da04c6a2c | ||
|
|
5c449913af | ||
|
|
af019fed8e | ||
|
|
8872630c46 | ||
|
|
d3ec21cbf5 | ||
|
|
395dd4086b | ||
|
|
a7f9808621 | ||
|
|
88862b617f | ||
|
|
39bfa0c420 | ||
|
|
f62f4e6108 | ||
|
|
9f128d1182 | ||
|
|
2f2b33c82b | ||
|
|
56280cb1d5 | ||
|
|
07127c6e87 | ||
|
|
3dabc77a09 | ||
|
|
66349e3d23 | ||
|
|
85a78ce537 | ||
|
|
0d9f17670e | ||
|
|
deb561a410 | ||
|
|
9d256a1e9b | ||
|
|
3c985eef25 | ||
|
|
6224887967 | ||
|
|
09361bf3a5 | ||
|
|
8a1311f015 | ||
|
|
cde7cddcaa | ||
|
|
aa53ba073d | ||
|
|
ac46d6f8de | ||
|
|
5efd00abec | ||
|
|
e79e3370f8 | ||
|
|
633aaccd9c | ||
|
|
410313d933 | ||
|
|
7aba194d3b | ||
|
|
515a85e66c | ||
|
|
6b21a51a2f | ||
|
|
a934ba3079 | ||
|
|
633a92bff0 | ||
|
|
5a846ebd58 | ||
|
|
e4c2ccba9d | ||
|
|
15168950e5 | ||
|
|
6b331b6945 | ||
|
|
4c7d20c8e6 | ||
|
|
414588d701 | ||
|
|
f89f6a8abf | ||
|
|
ca3695a754 | ||
|
|
7c682ec91a | ||
|
|
cc5c2c41be | ||
|
|
643142dc30 | ||
|
|
a36fb7e728 | ||
|
|
87fafcf91b | ||
|
|
2966b80ba1 | ||
|
|
179f09081f | ||
|
|
775867fc3e | ||
|
|
497863441a | ||
|
|
ec62ded279 | ||
|
|
f9c0933f05 | ||
|
|
0da3390d09 | ||
|
|
9a025fdb75 | ||
|
|
cafd868773 | ||
|
|
1c9e959cc4 | ||
|
|
41a9bddd59 | ||
|
|
7a09f5fe47 | ||
|
|
ab45794b7c | ||
|
|
1d5592f303 | ||
|
|
2bf8887cab | ||
|
|
acf7ec8355 | ||
|
|
bd82b3c852 | ||
|
|
daf08fcf9a | ||
|
|
c8ee6f7db8 | ||
|
|
662a957106 | ||
|
|
3055e03b7e | ||
|
|
11da7a3155 | ||
|
|
0a27c6d6af | ||
|
|
86795aa5b7 | ||
|
|
63bd45c397 | ||
|
|
469b1f08de | ||
|
|
121c515a07 | ||
|
|
2715bc20d9 | ||
|
|
c156cdfe7a | ||
|
|
a9965c5580 | ||
|
|
dca6d3f1ff | ||
|
|
91979dc4dd | ||
|
|
87195ed237 | ||
|
|
d557fe7f39 | ||
|
|
13ee9d09a8 | ||
|
|
f16d1837f8 | ||
|
|
096b09bf4d | ||
|
|
bbcf8e2be3 | ||
|
|
fb9d2b9e7c | ||
|
|
58711aa666 | ||
|
|
c7236d2cf0 | ||
|
|
25da0cba57 | ||
|
|
fb721edc20 | ||
|
|
d2a4fa367a | ||
|
|
8686e08336 | ||
|
|
09b68f3cdb | ||
|
|
05a2054057 | ||
|
|
4e59f90495 | ||
|
|
19f0476efb | ||
|
|
edf7885172 | ||
|
|
6cd7f3e053 | ||
|
|
f1ae81c6ae | ||
|
|
8cbf90d35b | ||
|
|
48eaf11026 | ||
|
|
75f18c9b31 | ||
|
|
302fe70f6b | ||
|
|
a2a0defeef | ||
|
|
e2ea11ffeb | ||
|
|
d8f9501ac8 | ||
|
|
12a1365b5d | ||
|
|
8f3a2a63ba | ||
|
|
f7f07ce42c | ||
|
|
c1d99bfa09 | ||
|
|
be8245fc92 | ||
|
|
926871cbe1 | ||
|
|
ee677ef5c9 | ||
|
|
c10ec90b60 | ||
|
|
0d3c2752c9 | ||
|
|
eaa44a1547 | ||
|
|
89454c6d30 | ||
|
|
d3f2184fcc | ||
|
|
19da03c9b7 | ||
|
|
aa284c6a3a | ||
|
|
6379d1f90e | ||
|
|
8737af0f6f | ||
|
|
9a1e867da2 | ||
|
|
be979d35c7 | ||
|
|
971abe536c | ||
|
|
5ceacbbfd0 | ||
|
|
c18a0152dd | ||
|
|
3bbe3fa481 | ||
|
|
4d6b384c16 | ||
|
|
e4283d5f53 | ||
|
|
3b6cfd9c4f | ||
|
|
a076f739e3 | ||
|
|
4cdea633bf | ||
|
|
e3727f01b8 | ||
|
|
837bd1a43c | ||
|
|
eb36d2beef | ||
|
|
f08887180d | ||
|
|
95d3293f4b | ||
|
|
44054ac7eb | ||
|
|
057fbf7608 | ||
|
|
a64ff6b7c7 | ||
|
|
673c366f77 | ||
|
|
c8c0abdb00 | ||
|
|
0a183a59c0 | ||
|
|
3f7cf2ac18 | ||
|
|
d97b5a7552 | ||
|
|
cbd0c45c2b | ||
|
|
e5fd83554b | ||
|
|
c9e17780e7 | ||
|
|
5df1686810 | ||
|
|
1e3e8ff8ee | ||
|
|
d4750239ea | ||
|
|
99e9073993 | ||
|
|
51690ebad6 | ||
|
|
5ac908c027 | ||
|
|
f1a24b7ddd | ||
|
|
f977b31331 | ||
|
|
80b980c9d3 | ||
|
|
ddb4f9be76 | ||
|
|
a87d9d31e2 | ||
|
|
6c26e04fbe | ||
|
|
eb95d0339e | ||
|
|
e295a938f8 | ||
|
|
bccffa63a4 | ||
|
|
ca6ca4cb67 | ||
|
|
3910cf9e69 | ||
|
|
5d274777f6 | ||
|
|
dad1fdb505 | ||
|
|
565d36d9e4 | ||
|
|
e32e22474a | ||
|
|
905713f1ca | ||
|
|
5f314edb2f | ||
|
|
315d74c319 | ||
|
|
6b7b3511ce | ||
|
|
50bdaba526 | ||
|
|
4914fefb1f | ||
|
|
03cd56ed73 | ||
|
|
79c96418c7 | ||
|
|
36c1cb23e0 | ||
|
|
6dba0635f1 | ||
|
|
99b58580e9 | ||
|
|
027a6f8ae2 | ||
|
|
a3daaf09f5 | ||
|
|
da8b87b007 | ||
|
|
87b4d97798 | ||
|
|
6860450147 | ||
|
|
b0de5aefb1 | ||
|
|
d2e2f5f800 | ||
|
|
3088f915f9 | ||
|
|
4c5421b2bf | ||
|
|
6dd281b508 | ||
|
|
599958c982 | ||
|
|
328f985e07 | ||
|
|
7fc7b976bf | ||
|
|
36b1523194 | ||
|
|
5155139e9a | ||
|
|
a152d6be42 | ||
|
|
ccebf6bb20 | ||
|
|
5b4648339a | ||
|
|
7727014eea | ||
|
|
8c45e3226d | ||
|
|
75403ee275 | ||
|
|
c4db1435b2 | ||
|
|
f3ea3c5227 | ||
|
|
722e468bd9 | ||
|
|
9569772e7e | ||
|
|
144f9c4409 | ||
|
|
2ecece7b3d | ||
|
|
677d287135 | ||
|
|
62eb66486d | ||
|
|
da03d74ade | ||
|
|
9fcc542676 | ||
|
|
581d004568 | ||
|
|
4f7186cb0e | ||
|
|
65fa1d9bf3 | ||
|
|
f85efd163c | ||
|
|
eb8cf3ee5a | ||
|
|
793a2454ad | ||
|
|
4a74ce3242 | ||
|
|
87a54766eb | ||
|
|
22a69f70da | ||
|
|
3fbf2ac3d4 | ||
|
|
0a2fe5caa7 | ||
|
|
17795e3d7b | ||
|
|
1fdc8631e3 | ||
|
|
858463ceba | ||
|
|
a4550f55ea | ||
|
|
d9b6f46a6a | ||
|
|
4bac3e7695 | ||
|
|
59bd6d4187 | ||
|
|
166c011d37 | ||
|
|
1f55c6eb02 | ||
|
|
c2bdae70fe | ||
|
|
1289942567 | ||
|
|
44dcded866 | ||
|
|
8deb247b3e | ||
|
|
a705ab775b | ||
|
|
bfd5a81937 | ||
|
|
c710ee5fb5 | ||
|
|
a8466a139c | ||
|
|
ba47219185 | ||
|
|
cf54c85b76 | ||
|
|
fa5b872782 | ||
|
|
3ee0cd8c51 | ||
|
|
7bdeba4d08 | ||
|
|
116fb3d3f9 | ||
|
|
54a17a75ab | ||
|
|
5f0f2506e8 | ||
|
|
31e896feef | ||
|
|
8bfd7bcf05 | ||
|
|
ec13337228 | ||
|
|
cfe2a098ce | ||
|
|
a89c2c8dd1 | ||
|
|
ebf259fa7c | ||
|
|
1b4a124bc5 | ||
|
|
4bb8be8a29 | ||
|
|
d45bb24a32 | ||
|
|
5a7bcb2d03 | ||
|
|
f1ec8a18f6 | ||
|
|
7b4f768114 | ||
|
|
dfab81e9fa | ||
|
|
3025c265e8 | ||
|
|
ee603ab9e2 | ||
|
|
84f8a0dc54 | ||
|
|
481deff163 | ||
|
|
0e9ed351a1 | ||
|
|
8952f6892d | ||
|
|
d51fe01273 | ||
|
|
f7d6348948 | ||
|
|
3a01ebe277 | ||
|
|
189cc78d44 | ||
|
|
9be3b69109 | ||
|
|
7b38af703e | ||
|
|
bef9031b03 | ||
|
|
e4929d7c06 | ||
|
|
1e26e58660 | ||
|
|
8fe0577d60 | ||
|
|
64f42feba9 | ||
|
|
36ed0b4309 | ||
|
|
cb0bba7e10 | ||
|
|
51a72afb0e | ||
|
|
b1b0a3ba95 | ||
|
|
9768bf65d1 | ||
|
|
1584cca6d1 | ||
|
|
891a46382e | ||
|
|
db920e8006 | ||
|
|
768a4581e0 | ||
|
|
866245b525 | ||
|
|
c7476e076b | ||
|
|
d11a313d88 | ||
|
|
8d1168385a | ||
|
|
852fe14604 | ||
|
|
30be1cd102 | ||
|
|
fa0bb0e1bf | ||
|
|
a05393727c | ||
|
|
adf833b60a | ||
|
|
23daceb4dc | ||
|
|
4a9db89527 | ||
|
|
060c1af4c4 | ||
|
|
b826985d05 | ||
|
|
0f09883429 | ||
|
|
a84b45b1bb | ||
|
|
a5b6383f7b | ||
|
|
24f8f76714 | ||
|
|
ba336122c0 | ||
|
|
591744174c | ||
|
|
fc85017948 | ||
|
|
24f541a0dd | ||
|
|
f552577e71 | ||
|
|
a06ec06e8b | ||
|
|
96833d4790 | ||
|
|
5611ae9a30 | ||
|
|
72c8404d18 | ||
|
|
bc128d11d9 | ||
|
|
ff13675d31 | ||
|
|
4b682b6633 | ||
|
|
879e160ba3 | ||
|
|
9a6b8594f3 | ||
|
|
a354e9d217 | ||
|
|
950b5fa75e | ||
|
|
9f66d59c0a | ||
|
|
9d99fef52e | ||
|
|
3b22f1704f | ||
|
|
c89ad6b36d | ||
|
|
45300f1ff5 | ||
|
|
847d08cdbc | ||
|
|
81af1e964d | ||
|
|
3662e45435 | ||
|
|
f06e30e343 | ||
|
|
34d4aa4012 | ||
|
|
3e4bf8cd6c | ||
|
|
206b675892 | ||
|
|
00b4ae9c36 | ||
|
|
8d5ea745bb | ||
|
|
cac48cdd27 | ||
|
|
c20010ed54 | ||
|
|
5926dee354 | ||
|
|
b78b0b5c6b | ||
|
|
43afa437e4 | ||
|
|
050568a4ab | ||
|
|
8bf40cea36 | ||
|
|
ae3ff0f570 | ||
|
|
0addf91a70 | ||
|
|
abb78302b8 | ||
|
|
e5579d8635 | ||
|
|
3986c43fa5 | ||
|
|
838cc08680 | ||
|
|
a0fe49f946 | ||
|
|
70dbe8562c | ||
|
|
41fcd1e49a | ||
|
|
90195caa1d | ||
|
|
cdb6287d89 | ||
|
|
32e9b7e34a | ||
|
|
6484bbb716 | ||
|
|
e59806d6ae | ||
|
|
299b180b28 | ||
|
|
1acd88ed39 | ||
|
|
109c088e8a | ||
|
|
bb18239642 | ||
|
|
ccded7cc0a | ||
|
|
5bc89fdc8b | ||
|
|
70c7f33a20 | ||
|
|
1ec185a3a0 | ||
|
|
6aa4eeefbb | ||
|
|
10ea567084 | ||
|
|
028d6503aa | ||
|
|
51346c2b2b | ||
|
|
ca535c7813 | ||
|
|
ba80e27349 | ||
|
|
bd8cf54a0b | ||
|
|
e0eed7d5d6 | ||
|
|
8dff08f15f | ||
|
|
47d68b068b | ||
|
|
a648a8b9be | ||
|
|
7eefccc6bc | ||
|
|
1bf159d1e8 | ||
|
|
bf46cb8684 | ||
|
|
72c385c870 | ||
|
|
c83429c55c | ||
|
|
e5a2689052 | ||
|
|
b665d2d865 | ||
|
|
e06a76ef1c | ||
|
|
f523fddbfd | ||
|
|
30165ce4be | ||
|
|
83a10cce8c | ||
|
|
71cc486553 | ||
|
|
2eaf8edf0e | ||
|
|
3d740e81a2 | ||
|
|
ef475d98da | ||
|
|
5e92acab34 | ||
|
|
935b8a1106 | ||
|
|
c371a7a2bb | ||
|
|
4fe011b469 | ||
|
|
bf32802a82 | ||
|
|
ccfbba94f2 | ||
|
|
70d7fe9b59 | ||
|
|
34a5c89ee2 | ||
|
|
39ed25cf7b | ||
|
|
26c2200af3 | ||
|
|
aa5a7c3c13 | ||
|
|
08ca51ec4c | ||
|
|
bbd9945866 | ||
|
|
59313d9cc3 | ||
|
|
2da5d31a5d | ||
|
|
5724d8beb6 | ||
|
|
03e9797b92 | ||
|
|
74bd9460d7 | ||
|
|
f033cb7f46 | ||
|
|
38cf5b6324 | ||
|
|
16863763d3 | ||
|
|
aa1934d273 | ||
|
|
4bfe7c7090 | ||
|
|
c61dafce60 | ||
|
|
a4d086c451 | ||
|
|
12394c7c78 | ||
|
|
a83f2c809c | ||
|
|
416c9eff69 | ||
|
|
cee3aeb116 | ||
|
|
77ca380697 | ||
|
|
28c81f2c53 | ||
|
|
945d1db05c | ||
|
|
5324761e06 | ||
|
|
f7d1d50a25 | ||
|
|
dc0aee1432 | ||
|
|
e4c8714daa | ||
|
|
b974f1dc73 | ||
|
|
1b928e8bf1 | ||
|
|
8ac03a0d89 | ||
|
|
69a6111a4f | ||
|
|
78476c5da0 | ||
|
|
e4779ab6ca | ||
|
|
1c63a8e7c3 | ||
|
|
f42a100937 | ||
|
|
2d2f3d4eb2 | ||
|
|
3472bd9f02 | ||
|
|
8c979d3bc7 | ||
|
|
12728649ff | ||
|
|
fa2461ba73 | ||
|
|
baa3384d12 | ||
|
|
89e6998054 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,4 +1,6 @@
|
||||
/build
|
||||
scripts/build
|
||||
scripts/deps
|
||||
/CMakeLists.txt.user
|
||||
/.idea
|
||||
/src/backend/opencl/cl/cn/cryptonight_gen.cl
|
||||
|
||||
4
.gitmodules
vendored
Normal file
4
.gitmodules
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
[submodule "src/base"]
|
||||
path = src/base
|
||||
url = https://github.com/xmrig/base.git
|
||||
branch = master
|
||||
319
CHANGELOG.md
319
CHANGELOG.md
@@ -1,3 +1,322 @@
|
||||
# v6.18.0
|
||||
- [#3067](https://github.com/xmrig/xmrig/pull/3067) Monero v15 network upgrade support and more house keeping.
|
||||
- Removed deprecated AstroBWTv1 and v2.
|
||||
- Fixed debug GhostRider build.
|
||||
- Monero v15 network upgrade support.
|
||||
- Fixed ZMQ debug log.
|
||||
- Improved daemon ZMQ mining stability.
|
||||
- [#3054](https://github.com/xmrig/xmrig/pull/3054) Fixes for 32-bit ARM.
|
||||
- [#3042](https://github.com/xmrig/xmrig/pull/3042) Fixed being unable to resume from `pause-on-battery`.
|
||||
- [#3031](https://github.com/xmrig/xmrig/pull/3031) Fixed `--cpu-priority` not working sometimes.
|
||||
- [#3020](https://github.com/xmrig/xmrig/pull/3020) Removed old AstroBWT algorithm.
|
||||
|
||||
# v6.17.0
|
||||
- [#2954](https://github.com/xmrig/xmrig/pull/2954) **Dero HE fork support (`astrobwt/v2` algorithm).**
|
||||
- [#2961](https://github.com/xmrig/xmrig/pull/2961) Dero HE (`astrobwt/v2`) CUDA config generator.
|
||||
- [#2969](https://github.com/xmrig/xmrig/pull/2969) Dero HE (`astrobwt/v2`) OpenCL support.
|
||||
- Fixed displayed DMI memory information for empty slots.
|
||||
- [#2932](https://github.com/xmrig/xmrig/pull/2932) Fixed GhostRider with hwloc disabled.
|
||||
|
||||
# v6.16.4
|
||||
- [#2904](https://github.com/xmrig/xmrig/pull/2904) Fixed unaligned memory accesses.
|
||||
- [#2908](https://github.com/xmrig/xmrig/pull/2908) Added MSVC/2022 to `version.h`.
|
||||
- [#2910](https://github.com/xmrig/xmrig/issues/2910) Fixed donation for GhostRider/RTM.
|
||||
|
||||
# v6.16.3
|
||||
- [#2778](https://github.com/xmrig/xmrig/pull/2778) Fixed `READY threads X/X` display after algorithm switching.
|
||||
- [#2782](https://github.com/xmrig/xmrig/pull/2782) Updated GhostRider documentation.
|
||||
- [#2815](https://github.com/xmrig/xmrig/pull/2815) Fixed `cn-heavy` in 32-bit builds.
|
||||
- [#2827](https://github.com/xmrig/xmrig/pull/2827) GhostRider: set correct priority for helper threads.
|
||||
- [#2837](https://github.com/xmrig/xmrig/pull/2837) RandomX: don't restart mining threads when the seed changes.
|
||||
- [#2848](https://github.com/xmrig/xmrig/pull/2848) GhostRider: added support for `client.reconnect` method.
|
||||
- [#2856](https://github.com/xmrig/xmrig/pull/2856) Fix for short responses from some Raptoreum pools.
|
||||
- [#2873](https://github.com/xmrig/xmrig/pull/2873) Fixed GhostRider benchmark on single-core systems.
|
||||
- [#2882](https://github.com/xmrig/xmrig/pull/2882) Fixed ARMv7 compilation.
|
||||
- [#2893](https://github.com/xmrig/xmrig/pull/2893) KawPow OpenCL: use separate UV loop for building programs.
|
||||
|
||||
# v6.16.2
|
||||
- [#2751](https://github.com/xmrig/xmrig/pull/2751) Fixed crash on CPUs supporting VAES and running GCC-compiled xmrig.
|
||||
- [#2761](https://github.com/xmrig/xmrig/pull/2761) Fixed broken auto-tuning in GCC Windows build.
|
||||
- [#2771](https://github.com/xmrig/xmrig/issues/2771) Fixed environment variables support for GhostRider and KawPow.
|
||||
- [#2769](https://github.com/xmrig/xmrig/pull/2769) Performance fixes:
|
||||
- Fixed several performance bottlenecks introduced in v6.16.1.
|
||||
- Fixed overall GCC-compiled build performance, it's the same speed as MSVC build now.
|
||||
- **Linux builds are up to 10% faster now compared to v6.16.0 GCC build.**
|
||||
- **Windows builds are up to 5% faster now compared to v6.16.0 MSVC build.**
|
||||
|
||||
# v6.16.1
|
||||
- [#2729](https://github.com/xmrig/xmrig/pull/2729) GhostRider fixes:
|
||||
- Added average hashrate display.
|
||||
- Fixed the number of threads shown at startup.
|
||||
- Fixed `--threads` or `-t` command line option (but `--cpu-max-threads-hint` is recommended to use).
|
||||
- [#2738](https://github.com/xmrig/xmrig/pull/2738) GhostRider fixes:
|
||||
- Fixed "difficulty is not a number" error when diff is high on some pools.
|
||||
- Fixed GhostRider compilation when `WITH_KAWPOW=OFF`.
|
||||
- [#2740](https://github.com/xmrig/xmrig/pull/2740) Added VAES support for Cryptonight variants **+4% speedup on Zen3**.
|
||||
- VAES instructions are available on Intel Ice Lake/AMD Zen3 and newer CPUs.
|
||||
- +4% speedup on Ryzen 5 5600X.
|
||||
|
||||
# v6.16.0
|
||||
- [#2712](https://github.com/xmrig/xmrig/pull/2712) **GhostRider algorithm (Raptoreum) support**: read the [RELEASE NOTES](src/crypto/ghostrider/README.md) for quick start guide and performance comparisons.
|
||||
- [#2682](https://github.com/xmrig/xmrig/pull/2682) Fixed: use cn-heavy optimization only for Vermeer CPUs.
|
||||
- [#2684](https://github.com/xmrig/xmrig/pull/2684) MSR mod: fix for error 183.
|
||||
|
||||
# v6.15.3
|
||||
- [#2614](https://github.com/xmrig/xmrig/pull/2614) OpenCL fixes for non-AMD platforms.
|
||||
- [#2623](https://github.com/xmrig/xmrig/pull/2623) Fixed compiling without kawpow.
|
||||
- [#2636](https://github.com/xmrig/xmrig/pull/2636) [#2639](https://github.com/xmrig/xmrig/pull/2639) AstroBWT speedup (up to +35%).
|
||||
- [#2646](https://github.com/xmrig/xmrig/pull/2646) Fixed MSVC compilation error.
|
||||
|
||||
# v6.15.2
|
||||
- [#2606](https://github.com/xmrig/xmrig/pull/2606) Fixed: AstroBWT auto-config ignored `max-threads-hint`.
|
||||
- Fixed possible crash on Windows (regression in v6.15.1).
|
||||
|
||||
# v6.15.1
|
||||
- [#2586](https://github.com/xmrig/xmrig/pull/2586) Fixed Windows 7 compatibility.
|
||||
- [#2594](https://github.com/xmrig/xmrig/pull/2594) Added Windows taskbar icon colors.
|
||||
|
||||
# v6.15.0
|
||||
- [#2548](https://github.com/xmrig/xmrig/pull/2548) Added automatic coin detection for daemon mining.
|
||||
- [#2563](https://github.com/xmrig/xmrig/pull/2563) Added new algorithm RandomX Graft (`rx/graft`).
|
||||
- [#2565](https://github.com/xmrig/xmrig/pull/2565) AstroBWT: added AVX2 Salsa20 implementation.
|
||||
- Added support for new CUDA plugin API (previous API still supported).
|
||||
|
||||
# v6.14.1
|
||||
- [#2532](https://github.com/xmrig/xmrig/pull/2532) Refactoring: stable (persistent) algorithms IDs.
|
||||
- [#2537](https://github.com/xmrig/xmrig/pull/2537) Fixed Termux build.
|
||||
|
||||
# v6.14.0
|
||||
- [#2484](https://github.com/xmrig/xmrig/pull/2484) Added ZeroMQ support for solo mining.
|
||||
- [#2476](https://github.com/xmrig/xmrig/issues/2476) Fixed crash in DMI memory reader.
|
||||
- [#2492](https://github.com/xmrig/xmrig/issues/2492) Added missing `--huge-pages-jit` command line option.
|
||||
- [#2512](https://github.com/xmrig/xmrig/pull/2512) Added show the number of transactions in pool job.
|
||||
|
||||
# v6.13.1
|
||||
- [#2468](https://github.com/xmrig/xmrig/pull/2468) Fixed regression in previous version: don't send miner signature during regular mining.
|
||||
|
||||
# v6.13.0
|
||||
- [#2445](https://github.com/xmrig/xmrig/pull/2445) Added support for solo mining with miner signatures for the upcoming Wownero fork.
|
||||
|
||||
# v6.12.2
|
||||
- [#2280](https://github.com/xmrig/xmrig/issues/2280) GPU backends are now disabled in benchmark mode.
|
||||
- [#2322](https://github.com/xmrig/xmrig/pull/2322) Improved MSR compatibility with recent Linux kernels and updated `randomx_boost.sh`.
|
||||
- [#2340](https://github.com/xmrig/xmrig/pull/2340) Fixed AES detection on FreeBSD on ARM.
|
||||
- [#2341](https://github.com/xmrig/xmrig/pull/2341) `sse2neon` updated to the latest version.
|
||||
- [#2351](https://github.com/xmrig/xmrig/issues/2351) Fixed help output for `--cpu-priority` and `--cpu-affinity` option.
|
||||
- [#2375](https://github.com/xmrig/xmrig/pull/2375) Fixed macOS CUDA backend default loader name.
|
||||
- [#2378](https://github.com/xmrig/xmrig/pull/2378) Fixed broken light mode mining on x86.
|
||||
- [#2379](https://github.com/xmrig/xmrig/pull/2379) Fixed CL code for KawPow where it assumes everything is AMD.
|
||||
- [#2386](https://github.com/xmrig/xmrig/pull/2386) RandomX: enabled `IMUL_RCP` optimization for light mode mining.
|
||||
- [#2393](https://github.com/xmrig/xmrig/pull/2393) RandomX: added BMI2 version for scratchpad prefetch.
|
||||
- [#2395](https://github.com/xmrig/xmrig/pull/2395) RandomX: rewrote dataset read code.
|
||||
- [#2398](https://github.com/xmrig/xmrig/pull/2398) RandomX: optimized ARMv8 dataset read.
|
||||
- Added `argon2/ninja` alias for `argon2/wrkz` algorithm.
|
||||
|
||||
# v6.12.1
|
||||
- [#2296](https://github.com/xmrig/xmrig/pull/2296) Fixed Zen3 assembly code for `cn/upx2` algorithm.
|
||||
|
||||
# v6.12.0
|
||||
- [#2276](https://github.com/xmrig/xmrig/pull/2276) Added support for Uplexa (`cn/upx2` algorithm).
|
||||
- [#2261](https://github.com/xmrig/xmrig/pull/2261) Show total hashrate if compiled without OpenCL.
|
||||
- [#2289](https://github.com/xmrig/xmrig/pull/2289) RandomX: optimized `IMUL_RCP` instruction.
|
||||
- Added support for `--user` command line option for online benchmark.
|
||||
|
||||
# v6.11.2
|
||||
- [#2207](https://github.com/xmrig/xmrig/issues/2207) Fixed regression in HTTP parser and llhttp updated to v5.1.0.
|
||||
|
||||
# v6.11.1
|
||||
- [#2239](https://github.com/xmrig/xmrig/pull/2239) Fixed broken `coin` setting functionality.
|
||||
|
||||
# v6.11.0
|
||||
- [#2196](https://github.com/xmrig/xmrig/pull/2196) Improved DNS subsystem and added new DNS specific options.
|
||||
- [#2172](https://github.com/xmrig/xmrig/pull/2172) Fixed build on Alpine 3.13.
|
||||
- [#2177](https://github.com/xmrig/xmrig/pull/2177) Fixed ARM specific compilation error with GCC 10.2.
|
||||
- [#2214](https://github.com/xmrig/xmrig/pull/2214) [#2216](https://github.com/xmrig/xmrig/pull/2216) [#2235](https://github.com/xmrig/xmrig/pull/2235) Optimized `cn-heavy` algorithm.
|
||||
- [#2217](https://github.com/xmrig/xmrig/pull/2217) Fixed mining job creation sequence.
|
||||
- [#2225](https://github.com/xmrig/xmrig/pull/2225) Fixed build without OpenCL support on some systems.
|
||||
- [#2229](https://github.com/xmrig/xmrig/pull/2229) Don't use RandomX JIT if `WITH_ASM=OFF`.
|
||||
- [#2228](https://github.com/xmrig/xmrig/pull/2228) Removed useless code for cryptonight algorithms.
|
||||
- [#2234](https://github.com/xmrig/xmrig/pull/2234) Fixed build error on gcc 4.8.
|
||||
|
||||
# v6.10.0
|
||||
- [#2122](https://github.com/xmrig/xmrig/pull/2122) Fixed pause logic when both pause on battery and user activity are enabled.
|
||||
- [#2123](https://github.com/xmrig/xmrig/issues/2123) Fixed compatibility with gcc 4.8.
|
||||
- [#2147](https://github.com/xmrig/xmrig/pull/2147) Fixed many `new job` messages when solo mining.
|
||||
- [#2150](https://github.com/xmrig/xmrig/pull/2150) Updated `sse2neon.h` to the latest master, fixes build on ARMv7.
|
||||
- [#2157](https://github.com/xmrig/xmrig/pull/2157) Fixed crash in `cn-heavy` on Zen3 with manual thread count.
|
||||
- Fixed possible out of order write to log file.
|
||||
- [http-parser](https://github.com/nodejs/http-parser) replaced to [llhttp](https://github.com/nodejs/llhttp).
|
||||
- For official builds: libuv, hwloc and OpenSSL updated to latest versions.
|
||||
|
||||
# v6.9.0
|
||||
- [#2104](https://github.com/xmrig/xmrig/pull/2104) Added [pause-on-active](https://xmrig.com/docs/miner/config/misc#pause-on-active) config option and `--pause-on-active=N` command line option.
|
||||
- [#2112](https://github.com/xmrig/xmrig/pull/2112) Added support for [Tari merge mining](https://github.com/tari-project/tari/blob/development/README.md#tari-merge-mining).
|
||||
- [#2117](https://github.com/xmrig/xmrig/pull/2117) Fixed crash when GPU mining `cn-heavy` on Zen3 system.
|
||||
|
||||
# v6.8.2
|
||||
- [#2080](https://github.com/xmrig/xmrig/pull/2080) Fixed compile error in Termux.
|
||||
- [#2089](https://github.com/xmrig/xmrig/pull/2089) Optimized CryptoNight-Heavy for Zen3, 7-8% speedup.
|
||||
|
||||
# v6.8.1
|
||||
- [#2064](https://github.com/xmrig/xmrig/pull/2064) Added documentation for config.json CPU options.
|
||||
- [#2066](https://github.com/xmrig/xmrig/issues/2066) Fixed AMD GPUs health data readings on Linux.
|
||||
- [#2067](https://github.com/xmrig/xmrig/pull/2067) Fixed compilation error when RandomX and Argon2 are disabled.
|
||||
- [#2076](https://github.com/xmrig/xmrig/pull/2076) Added support for flexible huge page sizes on Linux.
|
||||
- [#2077](https://github.com/xmrig/xmrig/pull/2077) Fixed `illegal instruction` crash on ARM.
|
||||
|
||||
# v6.8.0
|
||||
- [#2052](https://github.com/xmrig/xmrig/pull/2052) Added DMI/SMBIOS reader.
|
||||
- Added information about memory modules on the miner startup and for online benchmark.
|
||||
- Added new HTTP API endpoint: `GET /2/dmi`.
|
||||
- Added new command line option `--no-dmi` or config option `"dmi"`.
|
||||
- Added new CMake option `-DWITH_DMI=OFF`.
|
||||
- [#2057](https://github.com/xmrig/xmrig/pull/2057) Improved MSR subsystem code quality.
|
||||
- [#2058](https://github.com/xmrig/xmrig/pull/2058) RandomX JIT x86: removed unnecessary instructions.
|
||||
|
||||
# v6.7.2
|
||||
- [#2039](https://github.com/xmrig/xmrig/pull/2039) Fixed solo mining.
|
||||
|
||||
# v6.7.1
|
||||
- [#1995](https://github.com/xmrig/xmrig/issues/1995) Fixed log initialization.
|
||||
- [#1998](https://github.com/xmrig/xmrig/pull/1998) Added hashrate in the benchmark finished message.
|
||||
- [#2009](https://github.com/xmrig/xmrig/pull/2009) AstroBWT OpenCL fixes.
|
||||
- [#2028](https://github.com/xmrig/xmrig/pull/2028) RandomX x86 JIT: removed redundant `CFROUND`.
|
||||
|
||||
# v6.7.0
|
||||
- **[#1991](https://github.com/xmrig/xmrig/issues/1991) Added Apple M1 processor support.**
|
||||
- **[#1986](https://github.com/xmrig/xmrig/pull/1986) Up to 20-30% faster RandomX dataset initialization with AVX2 on some CPUs.**
|
||||
- [#1964](https://github.com/xmrig/xmrig/pull/1964) Cleanup and refactoring.
|
||||
- [#1966](https://github.com/xmrig/xmrig/pull/1966) Removed libcpuid support.
|
||||
- [#1968](https://github.com/xmrig/xmrig/pull/1968) Added virtual machine detection.
|
||||
- [#1969](https://github.com/xmrig/xmrig/pull/1969) [#1970](https://github.com/xmrig/xmrig/pull/1970) Fixed errors found by static analysis.
|
||||
- [#1977](https://github.com/xmrig/xmrig/pull/1977) Fixed: secure JIT and huge pages are incompatible on Windows.
|
||||
- [#1979](https://github.com/xmrig/xmrig/pull/1979) Term `x64` replaced to `64-bit`.
|
||||
- [#1980](https://github.com/xmrig/xmrig/pull/1980) Fixed build on gcc 11.
|
||||
- [#1989](https://github.com/xmrig/xmrig/pull/1989) Fixed broken Dero solo mining.
|
||||
|
||||
# v6.6.2
|
||||
- [#1958](https://github.com/xmrig/xmrig/pull/1958) Added example mining scripts to help new miners.
|
||||
- [#1959](https://github.com/xmrig/xmrig/pull/1959) Optimized JIT compiler.
|
||||
- [#1960](https://github.com/xmrig/xmrig/pull/1960) Fixed RandomX init when switching to other algo and back.
|
||||
|
||||
# v6.6.1
|
||||
- Fixed, benchmark validation on NUMA hardware produced incorrect results in some conditions.
|
||||
|
||||
# v6.6.0
|
||||
- Online benchmark protocol upgraded to v2, validation not compatible with previous versions.
|
||||
- Single thread benchmark now is cheat-resistant, not possible speedup it with multiple threads.
|
||||
- RandomX dataset is now always initialized with static seed, to prevent time cheat by report slow dataset initialization.
|
||||
- Zero delay online submission, to make time validation much more precise and strict.
|
||||
- DNS cache for online benchmark to prevent unexpected delays.
|
||||
|
||||
# v6.5.3
|
||||
- [#1946](https://github.com/xmrig/xmrig/pull/1946) Fixed MSR mod names in JSON API (v6.5.2 affected).
|
||||
|
||||
# v6.5.2
|
||||
- [#1935](https://github.com/xmrig/xmrig/pull/1935) Separate MSR mod for Zen/Zen2 and Zen3.
|
||||
- [#1937](https://github.com/xmrig/xmrig/issues/1937) Print path to existing WinRing0 service without verbose option.
|
||||
- [#1939](https://github.com/xmrig/xmrig/pull/1939) Fixed build with gcc 4.8.
|
||||
- [#1941](https://github.com/xmrig/xmrig/pull/1941) Added CPUID info to JSON report.
|
||||
- [#1941](https://github.com/xmrig/xmrig/pull/1942) Fixed alignment modification in memory pool.
|
||||
- [#1944](https://github.com/xmrig/xmrig/pull/1944) Updated `randomx_boost.sh` with new MSR mod.
|
||||
- Added `250K` and `500K` offline benchmarks.
|
||||
|
||||
# v6.5.1
|
||||
- [#1932](https://github.com/xmrig/xmrig/pull/1932) New MSR mod for Ryzen, up to +3.5% on Zen2 and +1-2% on Zen3.
|
||||
- [#1918](https://github.com/xmrig/xmrig/issues/1918) Fixed 1GB huge pages support on ARMv8.
|
||||
- [#1926](https://github.com/xmrig/xmrig/pull/1926) Fixed compilation on ARMv8 with GCC 9.3.0.
|
||||
- [#1929](https://github.com/xmrig/xmrig/issues/1929) Fixed build without HTTP.
|
||||
|
||||
# v6.5.0
|
||||
- **Added [online benchmark](https://xmrig.com/benchmark) mode for sharing results.**
|
||||
- Added new command line options: `--submit`, ` --verify=ID`, ` --seed=SEED`, `--hash=HASH`.
|
||||
- [#1912](https://github.com/xmrig/xmrig/pull/1912) Fixed MSR kernel module warning with new Linux kernels.
|
||||
- [#1925](https://github.com/xmrig/xmrig/pull/1925) Add checking for config files in user home directory.
|
||||
- Added vendor to ARM CPUs name and added `"arch"` field to API.
|
||||
- Removed legacy CUDA plugin API.
|
||||
|
||||
# v6.4.0
|
||||
- [#1862](https://github.com/xmrig/xmrig/pull/1862) **RandomX: removed `rx/loki` algorithm.**
|
||||
- [#1890](https://github.com/xmrig/xmrig/pull/1890) **Added `argon2/chukwav2` algorithm.**
|
||||
- [#1895](https://github.com/xmrig/xmrig/pull/1895) [#1897](https://github.com/xmrig/xmrig/pull/1897) **Added [benchmark and stress test](https://github.com/xmrig/xmrig/blob/dev/doc/BENCHMARK.md).**
|
||||
- [#1864](https://github.com/xmrig/xmrig/pull/1864) RandomX: improved software AES performance.
|
||||
- [#1870](https://github.com/xmrig/xmrig/pull/1870) RandomX: fixed unexpected resume due to disconnect during dataset init.
|
||||
- [#1872](https://github.com/xmrig/xmrig/pull/1872) RandomX: fixed `randomx_create_vm` call.
|
||||
- [#1875](https://github.com/xmrig/xmrig/pull/1875) RandomX: fixed crash on x86.
|
||||
- [#1876](https://github.com/xmrig/xmrig/pull/1876) RandomX: added `huge-pages-jit` config parameter.
|
||||
- [#1881](https://github.com/xmrig/xmrig/pull/1881) Fixed possible race condition in hashrate counting code.
|
||||
- [#1882](https://github.com/xmrig/xmrig/pull/1882) [#1886](https://github.com/xmrig/xmrig/pull/1886) [#1887](https://github.com/xmrig/xmrig/pull/1887) [#1893](https://github.com/xmrig/xmrig/pull/1893) General code improvements.
|
||||
- [#1885](https://github.com/xmrig/xmrig/pull/1885) Added more precise hashrate calculation.
|
||||
- [#1889](https://github.com/xmrig/xmrig/pull/1889) Fixed libuv performance issue on Linux.
|
||||
|
||||
# v6.3.5
|
||||
- [#1845](https://github.com/xmrig/xmrig/pull/1845) [#1861](https://github.com/xmrig/xmrig/pull/1861) Fixed ARM build and added CMake option `WITH_SSE4_1`.
|
||||
- [#1846](https://github.com/xmrig/xmrig/pull/1846) KawPow: fixed OpenCL memory leak.
|
||||
- [#1849](https://github.com/xmrig/xmrig/pull/1849) [#1859](https://github.com/xmrig/xmrig/pull/1859) RandomX: optimized soft AES code.
|
||||
- [#1850](https://github.com/xmrig/xmrig/pull/1850) [#1852](https://github.com/xmrig/xmrig/pull/1852) General code improvements.
|
||||
- [#1853](https://github.com/xmrig/xmrig/issues/1853) [#1856](https://github.com/xmrig/xmrig/pull/1856) [#1857](https://github.com/xmrig/xmrig/pull/1857) Fixed crash on old CPUs.
|
||||
|
||||
# v6.3.4
|
||||
- [#1823](https://github.com/xmrig/xmrig/pull/1823) RandomX: added new option `scratchpad_prefetch_mode`.
|
||||
- [#1827](https://github.com/xmrig/xmrig/pull/1827) [#1831](https://github.com/xmrig/xmrig/pull/1831) Improved nonce iteration performance.
|
||||
- [#1828](https://github.com/xmrig/xmrig/pull/1828) RandomX: added SSE4.1-optimized Blake2b.
|
||||
- [#1830](https://github.com/xmrig/xmrig/pull/1830) RandomX: added performance profiler (for developers).
|
||||
- [#1835](https://github.com/xmrig/xmrig/pull/1835) RandomX: returned old soft AES implementation and added auto-select between the two.
|
||||
- [#1840](https://github.com/xmrig/xmrig/pull/1840) RandomX: moved more stuff to compile time, small x86 JIT compiler speedup.
|
||||
- [#1841](https://github.com/xmrig/xmrig/pull/1841) Fixed Cryptonight OpenCL for AMD 20.7.2 drivers.
|
||||
- [#1842](https://github.com/xmrig/xmrig/pull/1842) RandomX: AES improvements, a bit faster hardware AES code when compiled with MSVC.
|
||||
- [#1843](https://github.com/xmrig/xmrig/pull/1843) RandomX: improved performance of GCC compiled binaries.
|
||||
|
||||
# v6.3.3
|
||||
- [#1817](https://github.com/xmrig/xmrig/pull/1817) Fixed self-select login sequence.
|
||||
- Added brand new [build from source](https://xmrig.com/docs/miner/build) documentation.
|
||||
- New binary downloads for macOS (`macos-x64`), FreeBSD (`freebsd-static-x64`), Linux (`linux-static-x64`), Ubuntu 18.04 (`bionic-x64`), Ubuntu 20.04 (`focal-x64`).
|
||||
- Generic Linux download `xenial-x64` renamed to `linux-x64`.
|
||||
- Builds without SSL/TLS support are no longer provided.
|
||||
- Improved CUDA loader error reporting and fixed plugin load on Linux.
|
||||
- Fixed build warnings with Clang compiler.
|
||||
- Fixed colors on macOS.
|
||||
|
||||
# v6.3.2
|
||||
- [#1794](https://github.com/xmrig/xmrig/pull/1794) More robust 1 GB pages handling.
|
||||
- Don't allocate 1 GB per thread if 1 GB is the default huge page size.
|
||||
- Try to allocate scratchpad from dataset's 1 GB huge pages, if normal huge pages are not available.
|
||||
- Correctly initialize RandomX cache if 1 GB pages fail to allocate on a first NUMA node.
|
||||
- [#1806](https://github.com/xmrig/xmrig/pull/1806) Fixed macOS battery detection.
|
||||
- [#1809](https://github.com/xmrig/xmrig/issues/1809) Improved auto configuration on ARM CPUs.
|
||||
- Added retrieving ARM CPU names, based on lscpu code and database.
|
||||
|
||||
# v6.3.1
|
||||
- [#1786](https://github.com/xmrig/xmrig/pull/1786) Added `pause-on-battery` option, supported on Windows and Linux.
|
||||
- Added command line options `--randomx-cache-qos` and `--argon2-impl`.
|
||||
|
||||
# v6.3.0
|
||||
- [#1771](https://github.com/xmrig/xmrig/pull/1771) Adopted new SSE2NEON and reduced ARM-specific changes.
|
||||
- [#1774](https://github.com/xmrig/xmrig/pull/1774) RandomX: Added new option `cache_qos` in `randomx` object for cache QoS support.
|
||||
- [#1777](https://github.com/xmrig/xmrig/pull/1777) Added support for upcoming Haven offshore fork.
|
||||
- [#1780](https://github.com/xmrig/xmrig/pull/1780) CryptoNight OpenCL: fix for long input data.
|
||||
|
||||
# v6.2.3
|
||||
- [#1745](https://github.com/xmrig/xmrig/pull/1745) AstroBWT: fixed OpenCL compilation on some systems.
|
||||
- [#1749](https://github.com/xmrig/xmrig/pull/1749) KawPow: optimized CPU share verification.
|
||||
- [#1752](https://github.com/xmrig/xmrig/pull/1752) RandomX: added error message when MSR mod fails.
|
||||
- [#1754](https://github.com/xmrig/xmrig/issues/1754) Fixed GPU health readings for pre Vega GPUs on Linux.
|
||||
- [#1756](https://github.com/xmrig/xmrig/issues/1756) Added results and connection reports.
|
||||
- [#1759](https://github.com/xmrig/xmrig/pull/1759) KawPow: fixed DAG initialization on slower AMD GPUs.
|
||||
- [#1763](https://github.com/xmrig/xmrig/pull/1763) KawPow: fixed rare duplicate share errors.
|
||||
- [#1766](https://github.com/xmrig/xmrig/pull/1766) RandomX: small speedup on Ryzen CPUs.
|
||||
|
||||
# v6.2.2
|
||||
- [#1742](https://github.com/xmrig/xmrig/issues/1742) Fixed crash when use HTTP API.
|
||||
|
||||
# v6.2.1
|
||||
- [#1726](https://github.com/xmrig/xmrig/issues/1726) Fixed detection of AVX2/AVX512.
|
||||
- [#1728](https://github.com/xmrig/xmrig/issues/1728) Fixed, 32 bit Windows builds was crash on start.
|
||||
- [#1729](https://github.com/xmrig/xmrig/pull/1729) Fixed KawPow crash on old CPUs.
|
||||
- [#1730](https://github.com/xmrig/xmrig/pull/1730) Improved displaying information for compute errors on GPUs.
|
||||
- [#1732](https://github.com/xmrig/xmrig/pull/1732) Fixed NiceHash disconnects for KawPow.
|
||||
- Fixed AMD GPU health (temperatures/power/clocks/fans) readings on Linux.
|
||||
|
||||
# v6.2.0-beta
|
||||
- [#1717](https://github.com/xmrig/xmrig/pull/1717) Added new algorithm `cn/ccx` for Conceal.
|
||||
- [#1718](https://github.com/xmrig/xmrig/pull/1718) Fixed, linker on Linux was marking entire executable as having an executable stack.
|
||||
|
||||
6
CHANGELOG_NEXT.md
Normal file
6
CHANGELOG_NEXT.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# v7.0.0
|
||||
- `src/base` is now a git submodule for the [base](https://github.com/xmrig/base) project, build instructions require slight update.
|
||||
- Removed config option `background` (only command line available). Switching to background now happens on a very early stage before any I/O.
|
||||
|
||||
# Previous versions
|
||||
[doc/CHANGELOG_OLD.md](doc/CHANGELOG_OLD.md)
|
||||
177
CMakeLists.txt
177
CMakeLists.txt
@@ -1,15 +1,15 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(xmrig)
|
||||
|
||||
option(WITH_LIBCPUID "Enable libcpuid support" ON)
|
||||
option(WITH_HWLOC "Enable hwloc support" ON)
|
||||
option(WITH_CN_LITE "Enable CryptoNight-Lite algorithms family" ON)
|
||||
option(WITH_CN_HEAVY "Enable CryptoNight-Heavy algorithms family" ON)
|
||||
option(WITH_CN_PICO "Enable CryptoNight-Pico algorithm" ON)
|
||||
option(WITH_CN_FEMTO "Enable CryptoNight-UPX2 algorithm" ON)
|
||||
option(WITH_RANDOMX "Enable RandomX algorithms family" ON)
|
||||
option(WITH_ARGON2 "Enable Argon2 algorithms family" ON)
|
||||
option(WITH_ASTROBWT "Enable AstroBWT algorithms family" ON)
|
||||
option(WITH_KAWPOW "Enable KawPow algorithms family" ON)
|
||||
option(WITH_GHOSTRIDER "Enable GhostRider algorithm" ON)
|
||||
option(WITH_HTTP "Enable HTTP protocol support (client/server)" ON)
|
||||
option(WITH_DEBUG_LOG "Enable debug log output" OFF)
|
||||
option(WITH_TLS "Enable OpenSSL support" ON)
|
||||
@@ -18,32 +18,43 @@ option(WITH_MSR "Enable MSR mod & 1st-gen Ryzen fix" ON)
|
||||
option(WITH_ENV_VARS "Enable environment variables support in config file" ON)
|
||||
option(WITH_EMBEDDED_CONFIG "Enable internal embedded JSON config" OFF)
|
||||
option(WITH_OPENCL "Enable OpenCL backend" ON)
|
||||
set(WITH_OPENCL_VERSION 200 CACHE STRING "Target OpenCL version")
|
||||
set_property(CACHE WITH_OPENCL_VERSION PROPERTY STRINGS 120 200 210 220)
|
||||
option(WITH_CUDA "Enable CUDA backend" ON)
|
||||
option(WITH_NVML "Enable NVML (NVIDIA Management Library) support (only if CUDA backend enabled)" ON)
|
||||
option(WITH_ADL "Enable ADL (AMD Display Library) or sysfs support (only if OpenCL backend enabled)" ON)
|
||||
option(WITH_STRICT_CACHE "Enable strict checks for OpenCL cache" ON)
|
||||
option(WITH_INTERLEAVE_DEBUG_LOG "Enable debug log for threads interleave" OFF)
|
||||
option(WITH_PROFILING "Enable profiling for developers" OFF)
|
||||
option(WITH_SSE4_1 "Enable SSE 4.1 for Blake2" ON)
|
||||
option(WITH_VAES "Enable VAES instructions for Cryptonight" ON)
|
||||
option(WITH_BENCHMARK "Enable builtin RandomX benchmark and stress test" ON)
|
||||
option(WITH_SECURE_JIT "Enable secure access to JIT memory" OFF)
|
||||
option(WITH_DMI "Enable DMI/SMBIOS reader" ON)
|
||||
|
||||
option(BUILD_STATIC "Build static binary" OFF)
|
||||
option(ARM_TARGET "Force use specific ARM target 8 or 7" 0)
|
||||
option(HWLOC_DEBUG "Enable hwloc debug helpers and log" OFF)
|
||||
|
||||
add_definitions(-DXMRIG_MINER_PROJECT)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
||||
set(WITH_SODIUM OFF)
|
||||
set(WITH_CRYPTONOTE ON)
|
||||
set(WITH_CRYPTO_OPS ON)
|
||||
set(WITH_COM ON)
|
||||
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/src/base/cmake" "${CMAKE_SOURCE_DIR}/cmake")
|
||||
set(LIBS base)
|
||||
|
||||
include (CheckIncludeFile)
|
||||
include (cmake/cpu.cmake)
|
||||
include (cmake/os.cmake)
|
||||
include (src/base/base.cmake)
|
||||
include (src/backend/backend.cmake)
|
||||
include(base)
|
||||
add_subdirectory(src/base)
|
||||
|
||||
include(src/backend/backend.cmake)
|
||||
|
||||
|
||||
set(HEADERS
|
||||
"${HEADERS_BASE}"
|
||||
"${HEADERS_BASE_HTTP}"
|
||||
"${HEADERS_BACKEND}"
|
||||
src/App.h
|
||||
src/backend/common/interfaces/IMemoryPool.h
|
||||
src/core/config/Config_default.h
|
||||
src/core/config/Config_platform.h
|
||||
src/core/config/Config.h
|
||||
@@ -51,17 +62,6 @@ set(HEADERS
|
||||
src/core/config/usage.h
|
||||
src/core/Controller.h
|
||||
src/core/Miner.h
|
||||
src/net/interfaces/IJobResultListener.h
|
||||
src/net/JobResult.h
|
||||
src/net/JobResults.h
|
||||
src/net/Network.h
|
||||
src/net/strategies/DonateStrategy.h
|
||||
src/Summary.h
|
||||
src/version.h
|
||||
)
|
||||
|
||||
set(HEADERS_CRYPTO
|
||||
src/backend/common/interfaces/IMemoryPool.h
|
||||
src/crypto/cn/asm/CryptonightR_template.h
|
||||
src/crypto/cn/c_blake256.h
|
||||
src/crypto/cn/c_groestl.h
|
||||
@@ -82,31 +82,28 @@ set(HEADERS_CRYPTO
|
||||
src/crypto/common/Nonce.h
|
||||
src/crypto/common/portable/mm_malloc.h
|
||||
src/crypto/common/VirtualMemory.h
|
||||
src/MinerApp.h
|
||||
src/net/interfaces/IJobResultListener.h
|
||||
src/net/JobResult.h
|
||||
src/net/JobResults.h
|
||||
src/net/Network.h
|
||||
src/net/strategies/DonateStrategy.h
|
||||
src/Summary.h
|
||||
src/version.h
|
||||
)
|
||||
|
||||
if (XMRIG_ARM)
|
||||
set(HEADERS_CRYPTO "${HEADERS_CRYPTO}" src/crypto/cn/CryptoNight_arm.h)
|
||||
list(APPEND HEADERS src/crypto/cn/CryptoNight_arm.h)
|
||||
else()
|
||||
set(HEADERS_CRYPTO "${HEADERS_CRYPTO}" src/crypto/cn/CryptoNight_x86.h)
|
||||
list(APPEND HEADERS src/crypto/cn/CryptoNight_x86.h)
|
||||
endif()
|
||||
|
||||
set(SOURCES
|
||||
"${SOURCES_BASE}"
|
||||
"${SOURCES_BASE_HTTP}"
|
||||
"${SOURCES_BACKEND}"
|
||||
src/App.cpp
|
||||
src/core/config/Config.cpp
|
||||
src/core/config/ConfigTransform.cpp
|
||||
src/core/Controller.cpp
|
||||
src/core/Miner.cpp
|
||||
src/net/JobResults.cpp
|
||||
src/net/Network.cpp
|
||||
src/net/strategies/DonateStrategy.cpp
|
||||
src/Summary.cpp
|
||||
src/xmrig.cpp
|
||||
)
|
||||
|
||||
set(SOURCES_CRYPTO
|
||||
src/crypto/cn/c_blake256.c
|
||||
src/crypto/cn/c_groestl.c
|
||||
src/crypto/cn/c_jh.c
|
||||
@@ -117,97 +114,81 @@ set(SOURCES_CRYPTO
|
||||
src/crypto/common/MemoryPool.cpp
|
||||
src/crypto/common/Nonce.cpp
|
||||
src/crypto/common/VirtualMemory.cpp
|
||||
src/MinerApp.cpp
|
||||
src/net/JobResults.cpp
|
||||
src/net/Network.cpp
|
||||
src/net/strategies/DonateStrategy.cpp
|
||||
src/Summary.cpp
|
||||
src/xmrig.cpp
|
||||
)
|
||||
|
||||
if (CMAKE_C_COMPILER_ID MATCHES GNU)
|
||||
set_source_files_properties(src/crypto/cn/CnHash.cpp PROPERTIES COMPILE_FLAGS "-Ofast -fno-tree-vectorize")
|
||||
endif()
|
||||
|
||||
if (WITH_VAES)
|
||||
add_definitions(-DXMRIG_VAES)
|
||||
list(APPEND HEADERS src/crypto/cn/CryptoNight_x86_vaes.h)
|
||||
list(APPEND SOURCES src/crypto/cn/CryptoNight_x86_vaes.cpp)
|
||||
if (CMAKE_C_COMPILER_ID MATCHES GNU OR CMAKE_C_COMPILER_ID MATCHES Clang)
|
||||
set_source_files_properties(src/crypto/cn/CryptoNight_x86_vaes.cpp PROPERTIES COMPILE_FLAGS "-Ofast -fno-tree-vectorize -mavx2 -mvaes")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WITH_HWLOC)
|
||||
list(APPEND HEADERS_CRYPTO
|
||||
list(APPEND HEADERS
|
||||
src/crypto/common/NUMAMemoryPool.h
|
||||
)
|
||||
|
||||
list(APPEND SOURCES_CRYPTO
|
||||
list(APPEND SOURCES
|
||||
src/crypto/common/NUMAMemoryPool.cpp
|
||||
src/crypto/common/VirtualMemory_hwloc.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if (XMRIG_OS_WIN)
|
||||
list(APPEND SOURCES_OS
|
||||
list(APPEND SOURCES
|
||||
res/app.rc
|
||||
src/App_win.cpp
|
||||
src/crypto/common/VirtualMemory_win.cpp
|
||||
)
|
||||
|
||||
set(EXTRA_LIBS ws2_32 psapi iphlpapi userenv)
|
||||
elseif (XMRIG_OS_APPLE)
|
||||
list(APPEND SOURCES_OS
|
||||
src/App_unix.cpp
|
||||
src/crypto/common/VirtualMemory_unix.cpp
|
||||
)
|
||||
else()
|
||||
list(APPEND SOURCES_OS
|
||||
src/App_unix.cpp
|
||||
src/crypto/common/VirtualMemory_unix.cpp
|
||||
)
|
||||
list(APPEND SOURCES src/crypto/common/VirtualMemory_unix.cpp)
|
||||
|
||||
if (XMRIG_OS_ANDROID)
|
||||
set(EXTRA_LIBS pthread rt dl log)
|
||||
elseif (XMRIG_OS_LINUX)
|
||||
list(APPEND SOURCES_OS
|
||||
if (XMRIG_OS_LINUX AND NOT XMRIG_OS_ANDROID)
|
||||
list(APPEND SOURCES
|
||||
src/crypto/common/LinuxMemory.h
|
||||
src/crypto/common/LinuxMemory.cpp
|
||||
)
|
||||
|
||||
set(EXTRA_LIBS pthread rt dl)
|
||||
elseif (XMRIG_OS_FREEBSD)
|
||||
set(EXTRA_LIBS kvm pthread)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_definitions(-DXMRIG_MINER_PROJECT)
|
||||
add_definitions(-D__STDC_FORMAT_MACROS -DUNICODE)
|
||||
|
||||
find_package(UV REQUIRED)
|
||||
|
||||
include(cmake/flags.cmake)
|
||||
include(cmake/randomx.cmake)
|
||||
include(cmake/argon2.cmake)
|
||||
include(cmake/astrobwt.cmake)
|
||||
include(cmake/kawpow.cmake)
|
||||
include(cmake/OpenSSL.cmake)
|
||||
include(cmake/asm.cmake)
|
||||
|
||||
if (WITH_CN_LITE)
|
||||
add_definitions(/DXMRIG_ALGO_CN_LITE)
|
||||
endif()
|
||||
|
||||
if (WITH_CN_HEAVY)
|
||||
add_definitions(/DXMRIG_ALGO_CN_HEAVY)
|
||||
endif()
|
||||
|
||||
if (WITH_CN_PICO)
|
||||
add_definitions(/DXMRIG_ALGO_CN_PICO)
|
||||
endif()
|
||||
|
||||
if (WITH_EMBEDDED_CONFIG)
|
||||
add_definitions(/DXMRIG_FEATURE_EMBEDDED_CONFIG)
|
||||
endif()
|
||||
|
||||
include_directories(src)
|
||||
include_directories(src/3rdparty)
|
||||
include_directories(${UV_INCLUDE_DIR})
|
||||
|
||||
if (BUILD_STATIC)
|
||||
set(CMAKE_EXE_LINKER_FLAGS " -static")
|
||||
include(randomx)
|
||||
include(argon2)
|
||||
include(kawpow)
|
||||
include(asm)
|
||||
|
||||
if (WITH_EMBEDDED_CONFIG)
|
||||
add_definitions(-DXMRIG_FEATURE_EMBEDDED_CONFIG)
|
||||
endif()
|
||||
|
||||
if (WITH_DEBUG_LOG)
|
||||
add_definitions(/DAPP_DEBUG)
|
||||
endif()
|
||||
include(src/hw/api/api.cmake)
|
||||
include(src/hw/dmi/dmi.cmake)
|
||||
|
||||
add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES} ${SOURCES_OS} ${SOURCES_CPUID} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${TLS_SOURCES} ${XMRIG_ASM_SOURCES})
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME} ${XMRIG_ASM_LIBRARY} ${OPENSSL_LIBRARIES} ${UV_LIBRARIES} ${EXTRA_LIBS} ${CPUID_LIB} ${ARGON2_LIBRARY} ${ETHASH_LIBRARY})
|
||||
add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES})
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME} ${LIBS})
|
||||
|
||||
if (WIN32)
|
||||
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/bin/WinRing0/WinRing0x64.sys" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
|
||||
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/bin/WinRing0/WinRing0x64.sys" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
|
||||
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/scripts/benchmark_1M.cmd" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
|
||||
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/scripts/benchmark_10M.cmd" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
|
||||
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/scripts/pool_mine_example.cmd" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
|
||||
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/scripts/solo_mine_example.cmd" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
|
||||
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/scripts/rtm_ghostrider_example.cmd" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES Clang AND CMAKE_BUILD_TYPE STREQUAL Release AND NOT CMAKE_GENERATOR STREQUAL Xcode)
|
||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} ${CMAKE_PROJECT_NAME})
|
||||
endif()
|
||||
|
||||
121
README.md
121
README.md
@@ -2,130 +2,35 @@
|
||||
|
||||
[](https://github.com/xmrig/xmrig/releases)
|
||||
[](https://github.com/xmrig/xmrig/releases)
|
||||
[](https://github.com/xmrig/xmrig/releases)
|
||||
[](https://github.com/xmrig/xmrig/releases)
|
||||
[](https://github.com/xmrig/xmrig/blob/master/LICENSE)
|
||||
[](https://github.com/xmrig/xmrig/stargazers)
|
||||
[](https://github.com/xmrig/xmrig/network)
|
||||
|
||||
XMRig High performance, open source, cross platform RandomX, KawPow, CryptoNight, AstroBWT and Argon2 CPU/GPU miner, with official support for Windows.
|
||||
XMRig is a high performance, open source, cross platform RandomX, KawPow, CryptoNight and [GhostRider](https://github.com/xmrig/xmrig/tree/master/src/crypto/ghostrider#readme) unified CPU/GPU miner and [RandomX benchmark](https://xmrig.com/benchmark). Official binaries are available for Windows, Linux, macOS and FreeBSD.
|
||||
|
||||
## Mining backends
|
||||
- **CPU** (x64/x86/ARM)
|
||||
- **CPU** (x64/ARMv7/ARMv8)
|
||||
- **OpenCL** for AMD GPUs.
|
||||
- **CUDA** for NVIDIA GPUs via external [CUDA plugin](https://github.com/xmrig/xmrig-cuda).
|
||||
|
||||
<img src="doc/screenshot_v5_2_0.png" width="833" >
|
||||
|
||||
## Download
|
||||
* Binary releases: https://github.com/xmrig/xmrig/releases
|
||||
* Git tree: https://github.com/xmrig/xmrig.git
|
||||
* Clone with `git clone https://github.com/xmrig/xmrig.git` :hammer: [Build instructions](https://github.com/xmrig/xmrig/wiki/Build).
|
||||
* **[Binary releases](https://github.com/xmrig/xmrig/releases)**
|
||||
* **[Build from source](https://xmrig.com/docs/miner/build)**
|
||||
|
||||
## Usage
|
||||
The preferred way to configure the miner is the [JSON config file](src/config.json) as it is more flexible and human friendly. The command line interface does not cover all features, such as mining profiles for different algorithms. Important options can be changed during runtime without miner restart by editing the config file or executing API calls.
|
||||
The preferred way to configure the miner is the [JSON config file](https://xmrig.com/docs/miner/config) as it is more flexible and human friendly. The [command line interface](https://xmrig.com/docs/miner/command-line-options) does not cover all features, such as mining profiles for different algorithms. Important options can be changed during runtime without miner restart by editing the config file or executing [API](https://xmrig.com/docs/miner/api) calls.
|
||||
|
||||
* **[xmrig.com/wizard](https://xmrig.com/wizard)** helps you create initial configuration for the miner.
|
||||
* **[workers.xmrig.info](http://workers.xmrig.info)** helps manage your miners via HTTP API.
|
||||
|
||||
### Command line options
|
||||
```
|
||||
Network:
|
||||
-o, --url=URL URL of mining server
|
||||
-a, --algo=ALGO mining algorithm https://xmrig.com/docs/algorithms
|
||||
--coin=COIN specify coin instead of algorithm
|
||||
-u, --user=USERNAME username for mining server
|
||||
-p, --pass=PASSWORD password for mining server
|
||||
-O, --userpass=U:P username:password pair for mining server
|
||||
-x, --proxy=HOST:PORT connect through a SOCKS5 proxy
|
||||
-k, --keepalive send keepalive packet for prevent timeout (needs pool support)
|
||||
--nicehash enable nicehash.com support
|
||||
--rig-id=ID rig identifier for pool-side statistics (needs pool support)
|
||||
--tls enable SSL/TLS support (needs pool support)
|
||||
--tls-fingerprint=HEX pool TLS certificate fingerprint for strict certificate pinning
|
||||
--daemon use daemon RPC instead of pool for solo mining
|
||||
--daemon-poll-interval=N daemon poll interval in milliseconds (default: 1000)
|
||||
-r, --retries=N number of times to retry before switch to backup server (default: 5)
|
||||
-R, --retry-pause=N time to pause between retries (default: 5)
|
||||
--user-agent set custom user-agent string for pool
|
||||
--donate-level=N donate level, default 5%% (5 minutes in 100 minutes)
|
||||
--donate-over-proxy=N control donate over xmrig-proxy feature
|
||||
|
||||
CPU backend:
|
||||
--no-cpu disable CPU mining backend
|
||||
-t, --threads=N number of CPU threads
|
||||
-v, --av=N algorithm variation, 0 auto select
|
||||
--cpu-affinity set process affinity to CPU core(s), mask 0x3 for cores 0 and 1
|
||||
--cpu-priority set process priority (0 idle, 2 normal to 5 highest)
|
||||
--cpu-max-threads-hint=N maximum CPU threads count (in percentage) hint for autoconfig
|
||||
--cpu-memory-pool=N number of 2 MB pages for persistent memory pool, -1 (auto), 0 (disable)
|
||||
--cpu-no-yield prefer maximum hashrate rather than system response/stability
|
||||
--no-huge-pages disable huge pages support
|
||||
--asm=ASM ASM optimizations, possible values: auto, none, intel, ryzen, bulldozer
|
||||
--randomx-init=N thread count to initialize RandomX dataset
|
||||
--randomx-no-numa disable NUMA support for RandomX
|
||||
--randomx-mode=MODE RandomX mode: auto, fast, light
|
||||
--randomx-1gb-pages use 1GB hugepages for dataset (Linux only)
|
||||
--randomx-wrmsr=N write custom value (0-15) to Intel MSR register 0x1a4 or disable MSR mod (-1)
|
||||
--randomx-no-rdmsr disable reverting initial MSR values on exit
|
||||
--astrobwt-max-size=N skip hashes with large stage 2 size, default: 550, min: 400, max: 1200
|
||||
--astrobwt-avx2 enable AVX2 optimizations for AstroBWT algorithm
|
||||
|
||||
API:
|
||||
--api-worker-id=ID custom worker-id for API
|
||||
--api-id=ID custom instance ID for API
|
||||
--http-host=HOST bind host for HTTP API (default: 127.0.0.1)
|
||||
--http-port=N bind port for HTTP API
|
||||
--http-access-token=T access token for HTTP API
|
||||
--http-no-restricted enable full remote access to HTTP API (only if access token set)
|
||||
|
||||
OpenCL backend:
|
||||
--opencl enable OpenCL mining backend
|
||||
--opencl-devices=N comma separated list of OpenCL devices to use
|
||||
--opencl-platform=N OpenCL platform index or name
|
||||
--opencl-loader=PATH path to OpenCL-ICD-Loader (OpenCL.dll or libOpenCL.so)
|
||||
--opencl-no-cache disable OpenCL cache
|
||||
--print-platforms print available OpenCL platforms and exit
|
||||
|
||||
CUDA backend:
|
||||
--cuda enable CUDA mining backend
|
||||
--cuda-loader=PATH path to CUDA plugin (xmrig-cuda.dll or libxmrig-cuda.so)
|
||||
--cuda-devices=N comma separated list of CUDA devices to use
|
||||
--cuda-bfactor-hint=N bfactor hint for autoconfig (0-12)
|
||||
--cuda-bsleep-hint=N bsleep hint for autoconfig
|
||||
--no-nvml disable NVML (NVIDIA Management Library) support
|
||||
|
||||
TLS:
|
||||
--tls-gen=HOSTNAME generate TLS certificate for specific hostname
|
||||
--tls-cert=FILE load TLS certificate chain from a file in the PEM format
|
||||
--tls-cert-key=FILE load TLS certificate private key from a file in the PEM format
|
||||
--tls-dhparam=FILE load DH parameters for DHE ciphers from a file in the PEM format
|
||||
--tls-protocols=N enable specified TLS protocols, example: "TLSv1 TLSv1.1 TLSv1.2 TLSv1.3"
|
||||
--tls-ciphers=S set list of available ciphers (TLSv1.2 and below)
|
||||
--tls-ciphersuites=S set list of available TLSv1.3 ciphersuites
|
||||
|
||||
Logging:
|
||||
-S, --syslog use system log for output messages
|
||||
-l, --log-file=FILE log all output to a file
|
||||
--print-time=N print hashrate report every N seconds
|
||||
--health-print-time=N print health report every N seconds
|
||||
--no-color disable colored output
|
||||
--verbose verbose output
|
||||
|
||||
Misc:
|
||||
-c, --config=FILE load a JSON-format configuration file
|
||||
-B, --background run the miner in the background
|
||||
-V, --version output version information and exit
|
||||
-h, --help display this help and exit
|
||||
--dry-run test configuration and exit
|
||||
--export-topology export hwloc topology to a XML file and exit
|
||||
--title set custom console window title
|
||||
--no-title disable setting console window title
|
||||
```
|
||||
* **[Wizard](https://xmrig.com/wizard)** helps you create initial configuration for the miner.
|
||||
* **[Workers](http://workers.xmrig.info)** helps manage your miners via HTTP API.
|
||||
|
||||
## Donations
|
||||
* Default donation 5% (5 minutes in 100 minutes) can be reduced to 1% via option `donate-level` or disabled in source code.
|
||||
* Default donation 1% (1 minute in 100 minutes) can be increased via option `donate-level` or disabled in source code.
|
||||
* XMR: `48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD`
|
||||
* BTC: `1P7ujsXeX7GxQwHNnJsRMgAdNkFZmNVqJT`
|
||||
|
||||
## Developers
|
||||
* **[xmrig](https://github.com/xmrig)**
|
||||
* **[sech1](https://github.com/SChernykh)**
|
||||
|
||||
## Contacts
|
||||
* support@xmrig.com
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
find_path(
|
||||
HWLOC_INCLUDE_DIR
|
||||
NAMES hwloc.h
|
||||
PATHS "${XMRIG_DEPS}" ENV "XMRIG_DEPS"
|
||||
PATH_SUFFIXES "include"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
find_path(HWLOC_INCLUDE_DIR NAMES hwloc.h)
|
||||
|
||||
find_library(
|
||||
HWLOC_LIBRARY
|
||||
NAMES hwloc.a hwloc libhwloc
|
||||
PATHS "${XMRIG_DEPS}" ENV "XMRIG_DEPS"
|
||||
PATH_SUFFIXES "lib"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
find_library(HWLOC_LIBRARY NAMES hwloc.a hwloc libhwloc)
|
||||
|
||||
set(HWLOC_LIBRARIES ${HWLOC_LIBRARY})
|
||||
set(HWLOC_INCLUDE_DIRS ${HWLOC_INCLUDE_DIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(HWLOC DEFAULT_MSG HWLOC_LIBRARY HWLOC_INCLUDE_DIR)
|
||||
@@ -1,25 +0,0 @@
|
||||
find_path(
|
||||
UV_INCLUDE_DIR
|
||||
NAMES uv.h
|
||||
PATHS "${XMRIG_DEPS}" ENV "XMRIG_DEPS"
|
||||
PATH_SUFFIXES "include"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
find_path(UV_INCLUDE_DIR NAMES uv.h)
|
||||
|
||||
find_library(
|
||||
UV_LIBRARY
|
||||
NAMES libuv.a uv libuv
|
||||
PATHS "${XMRIG_DEPS}" ENV "XMRIG_DEPS"
|
||||
PATH_SUFFIXES "lib"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
find_library(UV_LIBRARY NAMES libuv.a uv libuv)
|
||||
|
||||
set(UV_LIBRARIES ${UV_LIBRARY})
|
||||
set(UV_INCLUDE_DIRS ${UV_INCLUDE_DIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(UV DEFAULT_MSG UV_LIBRARY UV_INCLUDE_DIR)
|
||||
@@ -1,59 +0,0 @@
|
||||
if (WITH_TLS)
|
||||
set(OPENSSL_ROOT_DIR ${XMRIG_DEPS})
|
||||
|
||||
if (WIN32)
|
||||
set(OPENSSL_USE_STATIC_LIBS TRUE)
|
||||
set(OPENSSL_MSVC_STATIC_RT TRUE)
|
||||
|
||||
set(EXTRA_LIBS ${EXTRA_LIBS} crypt32)
|
||||
elseif (APPLE)
|
||||
set(OPENSSL_USE_STATIC_LIBS TRUE)
|
||||
endif()
|
||||
|
||||
find_package(OpenSSL)
|
||||
|
||||
if (OPENSSL_FOUND)
|
||||
set(TLS_SOURCES
|
||||
src/base/net/stratum/Tls.cpp
|
||||
src/base/net/stratum/Tls.h
|
||||
src/base/net/tls/ServerTls.cpp
|
||||
src/base/net/tls/ServerTls.h
|
||||
src/base/net/tls/TlsConfig.cpp
|
||||
src/base/net/tls/TlsConfig.h
|
||||
src/base/net/tls/TlsContext.cpp
|
||||
src/base/net/tls/TlsContext.h
|
||||
src/base/net/tls/TlsGen.cpp
|
||||
src/base/net/tls/TlsGen.h
|
||||
)
|
||||
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
|
||||
if (WITH_HTTP)
|
||||
set(TLS_SOURCES ${TLS_SOURCES}
|
||||
src/base/net/https/HttpsClient.cpp
|
||||
src/base/net/https/HttpsClient.h
|
||||
src/base/net/https/HttpsContext.cpp
|
||||
src/base/net/https/HttpsContext.h
|
||||
src/base/net/https/HttpsServer.cpp
|
||||
src/base/net/https/HttpsServer.h
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "OpenSSL NOT found: use `-DWITH_TLS=OFF` to build without TLS support")
|
||||
endif()
|
||||
|
||||
add_definitions(/DXMRIG_FEATURE_TLS)
|
||||
else()
|
||||
set(TLS_SOURCES "")
|
||||
set(OPENSSL_LIBRARIES "")
|
||||
remove_definitions(/DXMRIG_FEATURE_TLS)
|
||||
|
||||
if (WITH_HTTP)
|
||||
set(TLS_SOURCES ${TLS_SOURCES}
|
||||
src/base/net/http/HttpServer.cpp
|
||||
src/base/net/http/HttpServer.h
|
||||
)
|
||||
endif()
|
||||
|
||||
set(CMAKE_PROJECT_NAME "${CMAKE_PROJECT_NAME}-notls")
|
||||
endif()
|
||||
@@ -1,18 +1,13 @@
|
||||
if (WITH_ARGON2)
|
||||
add_definitions(/DXMRIG_ALGO_ARGON2)
|
||||
|
||||
list(APPEND HEADERS_CRYPTO
|
||||
list(APPEND HEADERS
|
||||
src/crypto/argon2/Hash.h
|
||||
src/crypto/argon2/Impl.h
|
||||
)
|
||||
|
||||
list(APPEND SOURCES_CRYPTO
|
||||
list(APPEND SOURCES
|
||||
src/crypto/argon2/Impl.cpp
|
||||
)
|
||||
|
||||
add_subdirectory(src/3rdparty/argon2)
|
||||
set(ARGON2_LIBRARY argon2)
|
||||
else()
|
||||
remove_definitions(/DXMRIG_ALGO_ARGON2)
|
||||
set(ARGON2_LIBRARY "")
|
||||
list(APPEND LIBS argon2)
|
||||
endif()
|
||||
|
||||
@@ -36,17 +36,16 @@ if (WITH_ASM AND NOT XMRIG_ARM AND CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
endif()
|
||||
|
||||
add_library(${XMRIG_ASM_LIBRARY} STATIC ${XMRIG_ASM_FILES})
|
||||
set(XMRIG_ASM_SOURCES
|
||||
src/crypto/common/Assembly.h
|
||||
list(APPEND HEADERS src/crypto/common/Assembly.h)
|
||||
|
||||
list(APPEND SOURCES
|
||||
src/crypto/common/Assembly.cpp
|
||||
src/crypto/cn/r/CryptonightR_gen.cpp
|
||||
)
|
||||
set_property(TARGET ${XMRIG_ASM_LIBRARY} PROPERTY LINKER_LANGUAGE C)
|
||||
|
||||
add_definitions(/DXMRIG_FEATURE_ASM)
|
||||
list(APPEND LIBS ${XMRIG_ASM_LIBRARY})
|
||||
add_definitions(-DXMRIG_FEATURE_ASM)
|
||||
else()
|
||||
set(XMRIG_ASM_SOURCES "")
|
||||
set(XMRIG_ASM_LIBRARY "")
|
||||
|
||||
remove_definitions(/DXMRIG_FEATURE_ASM)
|
||||
set(WITH_ASM OFF)
|
||||
endif()
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
if (WITH_ASTROBWT)
|
||||
add_definitions(/DXMRIG_ALGO_ASTROBWT)
|
||||
|
||||
list(APPEND HEADERS_CRYPTO
|
||||
src/crypto/astrobwt/AstroBWT.h
|
||||
)
|
||||
|
||||
list(APPEND SOURCES_CRYPTO
|
||||
src/crypto/astrobwt/AstroBWT.cpp
|
||||
)
|
||||
|
||||
if (XMRIG_ARM)
|
||||
list(APPEND HEADERS_CRYPTO
|
||||
src/crypto/astrobwt/salsa20_ref/ecrypt-config.h
|
||||
src/crypto/astrobwt/salsa20_ref/ecrypt-machine.h
|
||||
src/crypto/astrobwt/salsa20_ref/ecrypt-portable.h
|
||||
src/crypto/astrobwt/salsa20_ref/ecrypt-sync.h
|
||||
)
|
||||
|
||||
list(APPEND SOURCES_CRYPTO
|
||||
src/crypto/astrobwt/salsa20_ref/salsa20.c
|
||||
)
|
||||
else()
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
add_definitions(/DASTROBWT_AVX2)
|
||||
if (CMAKE_C_COMPILER_ID MATCHES MSVC)
|
||||
enable_language(ASM_MASM)
|
||||
list(APPEND SOURCES_CRYPTO src/crypto/astrobwt/sha3_256_avx2.asm)
|
||||
else()
|
||||
enable_language(ASM)
|
||||
list(APPEND SOURCES_CRYPTO src/crypto/astrobwt/sha3_256_avx2.S)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND HEADERS_CRYPTO
|
||||
src/crypto/astrobwt/Salsa20.hpp
|
||||
)
|
||||
|
||||
list(APPEND SOURCES_CRYPTO
|
||||
src/crypto/astrobwt/Salsa20.cpp
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
remove_definitions(/DXMRIG_ALGO_ASTROBWT)
|
||||
endif()
|
||||
@@ -1,43 +0,0 @@
|
||||
if (NOT CMAKE_SYSTEM_PROCESSOR)
|
||||
message(WARNING "CMAKE_SYSTEM_PROCESSOR not defined")
|
||||
endif()
|
||||
|
||||
|
||||
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64)$")
|
||||
add_definitions(/DRAPIDJSON_SSE2)
|
||||
endif()
|
||||
|
||||
if (NOT ARM_TARGET)
|
||||
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64|armv8-a)$")
|
||||
set(ARM_TARGET 8)
|
||||
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv7|armv7f|armv7s|armv7k|armv7-a|armv7l)$")
|
||||
set(ARM_TARGET 7)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (ARM_TARGET AND ARM_TARGET GREATER 6)
|
||||
set(XMRIG_ARM ON)
|
||||
set(WITH_LIBCPUID OFF)
|
||||
add_definitions(/DXMRIG_ARM)
|
||||
|
||||
message(STATUS "Use ARM_TARGET=${ARM_TARGET} (${CMAKE_SYSTEM_PROCESSOR})")
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
if (ARM_TARGET EQUAL 8)
|
||||
set(XMRIG_ARMv8 ON)
|
||||
add_definitions(/DXMRIG_ARMv8)
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG(-march=armv8-a+crypto XMRIG_ARM_CRYPTO)
|
||||
|
||||
if (XMRIG_ARM_CRYPTO)
|
||||
add_definitions(/DXMRIG_ARM_CRYPTO)
|
||||
set(ARM8_CXX_FLAGS "-march=armv8-a+crypto")
|
||||
else()
|
||||
set(ARM8_CXX_FLAGS "-march=armv8-a")
|
||||
endif()
|
||||
elseif (ARM_TARGET EQUAL 7)
|
||||
set(XMRIG_ARMv7 ON)
|
||||
add_definitions(/DXMRIG_ARMv7)
|
||||
endif()
|
||||
endif()
|
||||
@@ -1,99 +0,0 @@
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
|
||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
add_definitions(/DNDEBUG)
|
||||
endif()
|
||||
|
||||
include(CheckSymbolExists)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-strict-aliasing")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Ofast")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fexceptions -fno-rtti -Wno-strict-aliasing -Wno-class-memaccess")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast -s")
|
||||
|
||||
if (XMRIG_ARMv8)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARM8_CXX_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARM8_CXX_FLAGS} -flax-vector-conversions")
|
||||
elseif (XMRIG_ARMv7)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -flax-vector-conversions")
|
||||
else()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes")
|
||||
|
||||
add_definitions(/DHAVE_ROTR)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
|
||||
else()
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -Wl,--large-address-aware")
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
|
||||
endif()
|
||||
|
||||
add_definitions(/D_GNU_SOURCE)
|
||||
|
||||
if (${CMAKE_VERSION} VERSION_LESS "3.1.0")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
endif()
|
||||
|
||||
#set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -gdwarf-2")
|
||||
|
||||
add_definitions(/DHAVE_BUILTIN_CLEAR_CACHE)
|
||||
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
set(CMAKE_C_FLAGS_RELEASE "/MT /O2 /Oi /DNDEBUG /GL")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "/MT /O2 /Oi /DNDEBUG /GL")
|
||||
|
||||
add_definitions(/D_CRT_SECURE_NO_WARNINGS)
|
||||
add_definitions(/D_CRT_NONSTDC_NO_WARNINGS)
|
||||
add_definitions(/DNOMINMAX)
|
||||
add_definitions(/DHAVE_ROTR)
|
||||
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Ofast -funroll-loops -fmerge-all-constants")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fexceptions -fno-rtti -Wno-missing-braces")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast -funroll-loops -fmerge-all-constants")
|
||||
|
||||
if (XMRIG_ARMv8)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARM8_CXX_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARM8_CXX_FLAGS}")
|
||||
elseif (XMRIG_ARMv7)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon -march=${CMAKE_SYSTEM_PROCESSOR}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -march=${CMAKE_SYSTEM_PROCESSOR}")
|
||||
else()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes")
|
||||
|
||||
check_symbol_exists("_rotr" "x86intrin.h" HAVE_ROTR)
|
||||
if (HAVE_ROTR)
|
||||
add_definitions(/DHAVE_ROTR)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if (NOT WIN32)
|
||||
check_symbol_exists("__builtin___clear_cache" "stdlib.h" HAVE_BUILTIN_CLEAR_CACHE)
|
||||
if (HAVE_BUILTIN_CLEAR_CACHE)
|
||||
add_definitions(/DHAVE_BUILTIN_CLEAR_CACHE)
|
||||
endif()
|
||||
endif()
|
||||
8
cmake/ghostrider.cmake
Normal file
8
cmake/ghostrider.cmake
Normal file
@@ -0,0 +1,8 @@
|
||||
if (WITH_GHOSTRIDER)
|
||||
add_definitions(/DXMRIG_ALGO_GHOSTRIDER)
|
||||
add_subdirectory(src/crypto/ghostrider)
|
||||
set(GHOSTRIDER_LIBRARY ghostrider)
|
||||
else()
|
||||
remove_definitions(/DXMRIG_ALGO_GHOSTRIDER)
|
||||
set(GHOSTRIDER_LIBRARY "")
|
||||
endif()
|
||||
@@ -1,19 +1,14 @@
|
||||
if (WITH_KAWPOW)
|
||||
add_definitions(/DXMRIG_ALGO_KAWPOW)
|
||||
|
||||
list(APPEND HEADERS_CRYPTO
|
||||
list(APPEND HEADERS
|
||||
src/crypto/kawpow/KPCache.h
|
||||
src/crypto/kawpow/KPHash.h
|
||||
)
|
||||
|
||||
list(APPEND SOURCES_CRYPTO
|
||||
list(APPEND SOURCES
|
||||
src/crypto/kawpow/KPCache.cpp
|
||||
src/crypto/kawpow/KPHash.cpp
|
||||
)
|
||||
|
||||
add_subdirectory(src/3rdparty/libethash)
|
||||
set(ETHASH_LIBRARY ethash)
|
||||
else()
|
||||
remove_definitions(/DXMRIG_ALGO_KAWPOW)
|
||||
set(ETHASH_LIBRARY "")
|
||||
add_subdirectory(src/base/3rdparty/libethash)
|
||||
list(INSERT LIBS 0 ethash)
|
||||
endif()
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
if (WIN32)
|
||||
set(XMRIG_OS_WIN ON)
|
||||
elseif (APPLE)
|
||||
set(XMRIG_OS_APPLE ON)
|
||||
|
||||
if (IOS OR CMAKE_SYSTEM_NAME STREQUAL iOS)
|
||||
set(XMRIG_OS_IOS ON)
|
||||
else()
|
||||
set(XMRIG_OS_MACOS ON)
|
||||
endif()
|
||||
else()
|
||||
set(XMRIG_OS_UNIX ON)
|
||||
|
||||
if (ANDROID OR CMAKE_SYSTEM_NAME MATCHES "Android")
|
||||
set(XMRIG_OS_ANDROID ON)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
set(XMRIG_OS_LINUX ON)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
|
||||
set(XMRIG_OS_FREEBSD ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
if (XMRIG_OS_WIN)
|
||||
add_definitions(/DWIN32)
|
||||
add_definitions(/DXMRIG_OS_WIN)
|
||||
elseif(XMRIG_OS_APPLE)
|
||||
add_definitions(/DXMRIG_OS_APPLE)
|
||||
|
||||
if (XMRIG_OS_IOS)
|
||||
add_definitions(/DXMRIG_OS_IOS)
|
||||
else()
|
||||
add_definitions(/DXMRIG_OS_MACOS)
|
||||
endif()
|
||||
elseif(XMRIG_OS_UNIX)
|
||||
add_definitions(/DXMRIG_OS_UNIX)
|
||||
|
||||
if (XMRIG_OS_ANDROID)
|
||||
add_definitions(/DXMRIG_OS_ANDROID)
|
||||
elseif (XMRIG_OS_LINUX)
|
||||
add_definitions(/DXMRIG_OS_LINUX)
|
||||
elseif (XMRIG_OS_FREEBSD)
|
||||
add_definitions(/DXMRIG_OS_FREEBSD)
|
||||
endif()
|
||||
endif()
|
||||
@@ -1,8 +1,5 @@
|
||||
if (WITH_RANDOMX)
|
||||
add_definitions(/DXMRIG_ALGO_RANDOMX)
|
||||
set(WITH_ARGON2 ON)
|
||||
|
||||
list(APPEND HEADERS_CRYPTO
|
||||
list(APPEND HEADERS
|
||||
src/crypto/rx/Rx.h
|
||||
src/crypto/rx/RxAlgo.h
|
||||
src/crypto/rx/RxBasicStorage.h
|
||||
@@ -14,7 +11,7 @@ if (WITH_RANDOMX)
|
||||
src/crypto/rx/RxVm.h
|
||||
)
|
||||
|
||||
list(APPEND SOURCES_CRYPTO
|
||||
list(APPEND SOURCES
|
||||
src/crypto/randomx/aes_hash.cpp
|
||||
src/crypto/randomx/allocator.cpp
|
||||
src/crypto/randomx/blake2_generator.cpp
|
||||
@@ -42,26 +39,40 @@ if (WITH_RANDOMX)
|
||||
src/crypto/rx/RxVm.cpp
|
||||
)
|
||||
|
||||
if (CMAKE_C_COMPILER_ID MATCHES MSVC)
|
||||
if (WITH_ASM AND CMAKE_C_COMPILER_ID MATCHES MSVC)
|
||||
enable_language(ASM_MASM)
|
||||
list(APPEND SOURCES_CRYPTO
|
||||
list(APPEND SOURCES
|
||||
src/crypto/randomx/jit_compiler_x86_static.asm
|
||||
src/crypto/randomx/jit_compiler_x86.cpp
|
||||
)
|
||||
elseif (NOT XMRIG_ARM AND CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
list(APPEND SOURCES_CRYPTO
|
||||
elseif (WITH_ASM AND NOT XMRIG_ARM AND CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
list(APPEND SOURCES
|
||||
src/crypto/randomx/jit_compiler_x86_static.S
|
||||
src/crypto/randomx/jit_compiler_x86.cpp
|
||||
)
|
||||
# cheat because cmake and ccache hate each other
|
||||
set_property(SOURCE src/crypto/randomx/jit_compiler_x86_static.S PROPERTY LANGUAGE C)
|
||||
elseif (XMRIG_ARM AND CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
list(APPEND SOURCES_CRYPTO
|
||||
list(APPEND SOURCES
|
||||
src/crypto/randomx/jit_compiler_a64_static.S
|
||||
src/crypto/randomx/jit_compiler_a64.cpp
|
||||
)
|
||||
# cheat because cmake and ccache hate each other
|
||||
set_property(SOURCE src/crypto/randomx/jit_compiler_a64_static.S PROPERTY LANGUAGE C)
|
||||
if (CMAKE_GENERATOR STREQUAL Xcode)
|
||||
set_property(SOURCE src/crypto/randomx/jit_compiler_a64_static.S PROPERTY LANGUAGE ASM)
|
||||
else()
|
||||
set_property(SOURCE src/crypto/randomx/jit_compiler_a64_static.S PROPERTY LANGUAGE C)
|
||||
endif()
|
||||
else()
|
||||
list(APPEND SOURCES src/crypto/randomx/jit_compiler_fallback.cpp)
|
||||
endif()
|
||||
|
||||
if (WITH_SSE4_1)
|
||||
list(APPEND SOURCES src/crypto/randomx/blake2/blake2b_sse41.c)
|
||||
|
||||
if (CMAKE_C_COMPILER_ID MATCHES GNU OR CMAKE_C_COMPILER_ID MATCHES Clang)
|
||||
set_source_files_properties(src/crypto/randomx/blake2/blake2b_sse41.c PROPERTIES COMPILE_FLAGS -msse4.1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES Clang)
|
||||
@@ -69,33 +80,49 @@ if (WITH_RANDOMX)
|
||||
endif()
|
||||
|
||||
if (WITH_HWLOC)
|
||||
list(APPEND HEADERS_CRYPTO
|
||||
src/crypto/rx/RxNUMAStorage.h
|
||||
)
|
||||
|
||||
list(APPEND SOURCES_CRYPTO
|
||||
src/crypto/rx/RxNUMAStorage.cpp
|
||||
)
|
||||
list(APPEND HEADERS src/crypto/rx/RxNUMAStorage.h)
|
||||
list(APPEND SOURCES src/crypto/rx/RxNUMAStorage.cpp)
|
||||
endif()
|
||||
|
||||
if (WITH_MSR AND NOT XMRIG_ARM AND CMAKE_SIZEOF_VOID_P EQUAL 8 AND (XMRIG_OS_WIN OR XMRIG_OS_LINUX))
|
||||
add_definitions(/DXMRIG_FEATURE_MSR)
|
||||
add_definitions(/DXMRIG_FIX_RYZEN)
|
||||
message("-- WITH_MSR=ON")
|
||||
add_definitions(-DXMRIG_FEATURE_MSR -DXMRIG_FIX_RYZEN)
|
||||
|
||||
if (XMRIG_OS_WIN)
|
||||
list(APPEND SOURCES_CRYPTO src/crypto/rx/Rx_win.cpp)
|
||||
list(APPEND SOURCES
|
||||
src/crypto/rx/RxFix_win.cpp
|
||||
src/hw/msr/Msr_win.cpp
|
||||
)
|
||||
elseif (XMRIG_OS_LINUX)
|
||||
list(APPEND SOURCES_CRYPTO src/crypto/rx/Rx_linux.cpp)
|
||||
list(APPEND SOURCES
|
||||
src/crypto/rx/RxFix_linux.cpp
|
||||
src/hw/msr/Msr_linux.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
list(APPEND HEADERS_CRYPTO src/crypto/rx/msr/MsrItem.h)
|
||||
list(APPEND SOURCES_CRYPTO src/crypto/rx/msr/MsrItem.cpp)
|
||||
list(APPEND HEADERS
|
||||
src/crypto/rx/RxFix.h
|
||||
src/crypto/rx/RxMsr.h
|
||||
src/hw/msr/Msr.h
|
||||
src/hw/msr/MsrItem.h
|
||||
)
|
||||
|
||||
list(APPEND SOURCES
|
||||
src/crypto/rx/RxMsr.cpp
|
||||
src/hw/msr/Msr.cpp
|
||||
src/hw/msr/MsrItem.cpp
|
||||
)
|
||||
else()
|
||||
remove_definitions(/DXMRIG_FEATURE_MSR)
|
||||
remove_definitions(/DXMRIG_FIX_RYZEN)
|
||||
message("-- WITH_MSR=OFF")
|
||||
set(WITH_MSR OFF)
|
||||
endif()
|
||||
|
||||
if (WITH_PROFILING)
|
||||
add_definitions(-DXMRIG_FEATURE_PROFILING)
|
||||
|
||||
list(APPEND HEADERS src/crypto/rx/Profiler.h)
|
||||
list(APPEND SOURCES src/crypto/rx/Profiler.cpp)
|
||||
endif()
|
||||
else()
|
||||
remove_definitions(/DXMRIG_ALGO_RANDOMX)
|
||||
endif()
|
||||
|
||||
|
||||
message(STATUS "WITH_MSR \t= ${WITH_MSR}")
|
||||
message(STATUS "WITH_PROFILING \t= ${WITH_PROFILING}")
|
||||
|
||||
29
doc/BENCHMARK.md
Normal file
29
doc/BENCHMARK.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Embedded benchmark
|
||||
|
||||
You can run with XMRig with the following commands:
|
||||
```
|
||||
xmrig --bench=1M
|
||||
xmrig --bench=10M
|
||||
xmrig --bench=1M -a rx/wow
|
||||
xmrig --bench=10M -a rx/wow
|
||||
```
|
||||
This will run between 1 and 10 million RandomX hashes, depending on `bench` parameter, and print the time it took. First two commands use Monero variant (2 MB per thread, best for Zen2/Zen3 CPUs), second two commands use Wownero variant (1 MB per thread, useful for Intel and 1st gen Zen/Zen+ CPUs).
|
||||
|
||||
Checksum of all the hashes will be also printed to check stability of your hardware: if it's green then it's correct, if it's red then there was hardware error during computation. No Internet connection is required for the benchmark.
|
||||
|
||||
Double check that you see `Huge pages 100%` both for dataset and for all threads, and also check for `msr register values ... has been set successfully` - without this result will be far from the best. Running as administrator is required for MSR and huge pages to be set up properly.
|
||||
|
||||

|
||||
|
||||
### Benchmark with custom config
|
||||
|
||||
You can run benchmark with any configuration you want. Just start without command line parameteres, use regular config.json and add `"benchmark":"1M",` on the next line after pool url.
|
||||
|
||||
# Stress test
|
||||
|
||||
You can also run continuous stress-test that is as close to the real RandomX mining as possible and doesn't require any configuration:
|
||||
```
|
||||
xmrig --stress
|
||||
xmrig --stress -a rx/wow
|
||||
```
|
||||
This will require Internet connection and will run indefinitely.
|
||||
56
doc/CPU.md
56
doc/CPU.md
@@ -1,3 +1,5 @@
|
||||
**:warning: Recent version of this page https://xmrig.com/docs/miner/config/cpu.**
|
||||
|
||||
# CPU backend
|
||||
|
||||
All CPU related settings contains in one `cpu` object in config file, CPU backend allow specify multiple profiles and allow switch between them without restrictions by pool request or config change. Default auto-configuration create reasonable minimum of profiles which cover all supported algorithms.
|
||||
@@ -75,6 +77,35 @@ Each number represent one thread and means CPU affinity, this is default format
|
||||
```
|
||||
Internal format, but can be user defined.
|
||||
|
||||
## RandomX options
|
||||
|
||||
#### `init`
|
||||
Thread count to initialize RandomX dataset. Auto-detect (`-1`) or any number greater than 0 to use that many threads.
|
||||
|
||||
#### `init-avx2`
|
||||
Use AVX2 for dataset initialization. Faster on some CPUs. Auto-detect (`-1`), disabled (`0`), always enabled on CPUs that support AVX2 (`1`).
|
||||
|
||||
#### `mode`
|
||||
RandomX mining mode: `auto`, `fast` (2 GB memory), `light` (256 MB memory).
|
||||
|
||||
#### `1gb-pages`
|
||||
Use 1GB hugepages for RandomX dataset (Linux only). Enabled (`true`) or disabled (`false`). It gives 1-3% speedup.
|
||||
|
||||
#### `wrmsr`
|
||||
[MSR mod](https://xmrig.com/docs/miner/randomx-optimization-guide/msr). Enabled (`true`) or disabled (`false`). It gives up to 15% speedup depending on your system. _(**Note**: Userspace MSR writes are no longer enabled by default; the flag `msr.allow_writes=on` must be set for Linux Kernels 5.9 and after.)_
|
||||
|
||||
#### `rdmsr`
|
||||
Restore MSR register values to their original values on exit. Used together with `wrmsr`. Enabled (`true`) or disabled (`false`).
|
||||
|
||||
#### `cache_qos`
|
||||
[Cache QoS](https://xmrig.com/docs/miner/randomx-optimization-guide/qos). Enabled (`true`) or disabled (`false`). It's useful when you can't or don't want to mine on all CPU cores to make mining hashrate more stable.
|
||||
|
||||
#### `numa`
|
||||
NUMA support (better hashrate on multi-CPU servers and Ryzen Threadripper 1xxx/2xxx). Enabled (`true`) or disabled (`false`).
|
||||
|
||||
#### `scratchpad_prefetch_mode`
|
||||
Which instruction to use in RandomX loop to prefetch data from scratchpad. `1` is default and fastest in most cases. Can be off (`0`), `prefetcht0` instruction (`1`), `prefetchnta` instruction (`2`, a bit faster on Coffee Lake and a few other CPUs), `mov` instruction (`3`).
|
||||
|
||||
## Shared options
|
||||
|
||||
#### `enabled`
|
||||
@@ -83,23 +114,32 @@ Enable (`true`) or disable (`false`) CPU backend, by default `true`.
|
||||
#### `huge-pages`
|
||||
Enable (`true`) or disable (`false`) huge pages support, by default `true`.
|
||||
|
||||
#### `huge-pages-jit`
|
||||
Enable (`true`) or disable (`false`) huge pages support for RandomX JIT code, by default `false`. It gives a very small boost on Ryzen CPUs, but hashrate is unstable between launches. Use with caution.
|
||||
|
||||
#### `hw-aes`
|
||||
Force enable (`true`) or disable (`false`) hardware AES support. Default value `null` means miner autodetect this feature. Usually don't need change this option, this option useful for some rare cases when miner can't detect hardware AES, but it available. If you force enable this option, but your hardware not support it, miner will crash.
|
||||
|
||||
#### `priority`
|
||||
Mining threads priority, value from `1` (lowest priority) to `5` (highest possible priority). Default value `null` means miner don't change threads priority at all.
|
||||
Mining threads priority, value from `1` (lowest priority) to `5` (highest possible priority). Default value `null` means miner don't change threads priority at all. Setting priority higher than 2 can make your PC unresponsive.
|
||||
|
||||
#### `memory-pool` (since v4.3.0)
|
||||
Use continuous, persistent memory block for mining threads, useful for preserve huge pages allocation while algorithm switching. Possible values `false` (feature disabled, by default) or `true` or specific count of 2 MB huge pages. It helps to avoid loosing huge pages for scratchpads when RandomX dataset is updated and mining threads restart after a 2-3 days of mining.
|
||||
|
||||
#### `yield` (since v5.1.1)
|
||||
Prefer system better system response/stability `true` (default value) or maximum hashrate `false`.
|
||||
|
||||
#### `asm`
|
||||
Enable/configure or disable ASM optimizations. Possible values: `true`, `false`, `"intel"`, `"ryzen"`, `"bulldozer"`.
|
||||
|
||||
#### `argon2-impl` (since v3.1.0)
|
||||
Allow override automatically detected Argon2 implementation, this option added mostly for debug purposes, default value `null` means autodetect. Other possible values: `"x86_64"`, `"SSE2"`, `"SSSE3"`, `"XOP"`, `"AVX2"`, `"AVX-512F"`. Manual selection has no safe guards, if you CPU not support required instuctions, miner will crash.
|
||||
Allow override automatically detected Argon2 implementation, this option added mostly for debug purposes, default value `null` means autodetect. This is used in RandomX dataset initialization and also in some other mining algorithms. Other possible values: `"x86_64"`, `"SSE2"`, `"SSSE3"`, `"XOP"`, `"AVX2"`, `"AVX-512F"`. Manual selection has no safe guards - if your CPU doesn't support required instuctions, miner will crash.
|
||||
|
||||
#### `astrobwt-max-size`
|
||||
AstroBWT algorithm: skip hashes with large stage 2 size, default: `550`, min: `400`, max: `1200`. Optimal value depends on your CPU/GPU
|
||||
|
||||
#### `astrobwt-avx2`
|
||||
AstroBWT algorithm: use AVX2 code. It's faster on some CPUs and slower on other
|
||||
|
||||
#### `max-threads-hint` (since v4.2.0)
|
||||
Maximum CPU threads count (in percentage) hint for autoconfig. [CPU_MAX_USAGE.md](CPU_MAX_USAGE.md)
|
||||
|
||||
#### `memory-pool` (since v4.3.0)
|
||||
Use continuous, persistent memory block for mining threads, useful for preserve huge pages allocation while algorithm swithing. Possible values `false` (feature disabled, by default) or `true` or specific count of 2 MB huge pages.
|
||||
|
||||
#### `yield` (since v5.1.1)
|
||||
Prefer system better system response/stability `true` (default value) or maximum hashrate `false`.
|
||||
|
||||
1
doc/build/CMAKE_OPTIONS.md
vendored
1
doc/build/CMAKE_OPTIONS.md
vendored
@@ -22,6 +22,7 @@ This feature add external dependency to libhwloc (1.10.0+) (except MSVC builds).
|
||||
* **`-DWITH_EMBEDDED_CONFIG=ON`** Enable [embedded](https://github.com/xmrig/xmrig/issues/957) config support.
|
||||
* **`-DWITH_OPENCL=OFF`** Disable OpenCL backend.
|
||||
* **`-DWITH_CUDA=OFF`** Disable CUDA backend.
|
||||
* **`-DWITH_SSE4_1=OFF`** Disable SSE 4.1 for Blake2 (useful for arm builds).
|
||||
|
||||
## Debug options
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
6bb1a2e3a0fbca5195be6022f2a9fbff8a353c37c7542e7ab89420cb45b64505 xmrig-5.0.1-gcc-win32.zip
|
||||
24dba9ec281acfb2ea2c401ebd0e4e2d1f1ee5fd557da5ff3c7049020c1f78b6 xmrig-5.0.1-gcc-win64.zip
|
||||
86d65c6693ec9e35cd7547329580638b85c9eb0cf8383892a1c15199de5b556f xmrig-5.0.1-msvc-cuda10_1-win64.zip
|
||||
0fbfe518b1c4b6993b0f66ff01302626375b15620ccf8f64d6fb97845068ffca xmrig-5.0.1-msvc-win64.zip
|
||||
aa34890738a3494de2fa0e44db346937fea7339852f5f10b5d4655f95e2d8f1f xmrig-5.0.1-xenial-x64.tar.gz
|
||||
@@ -1,11 +0,0 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQEzBAABCgAdFiEEmsTOqOZuNaXHzdwbRGpTY4vpRAkFAl3VcsoACgkQRGpTY4vp
|
||||
RAm9vQgA1MyTUU2jley2TCYLUzQy2Fffc8fbXYv64r44jbWOjC/6qo2iIlRgPhIc
|
||||
oVyPKr5TYS3QjDzCEm8IvozS0YudS6soESbPzqDonboK8pd0K4bsML9TQY2feV7A
|
||||
NL5vln0rfVHp1wxLLrQpfBqAgvJUXEyaHece6gFQN79JOGhEo2bHL2NyrOl+FViS
|
||||
b2BaMtXq410Fh+XT6ShnOaG/2EuO8ZqSGdCO6A/2LHQw1UY+mZiCvue6P6B06HmB
|
||||
WD/urOv38V389v+V+Sp4UlEW6VpBOOjvtChoVWtLt+tKzydrnt2EmoWWWg475pka
|
||||
4G6whHuMWS8CTt5/PDhJpvVXNQTIOw==
|
||||
=C764
|
||||
-----END PGP SIGNATURE-----
|
||||
@@ -20,7 +20,7 @@ VS_VERSION_INFO VERSIONINFO
|
||||
BEGIN
|
||||
BLOCK "000004b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", APP_SITE
|
||||
VALUE "CompanyName", APP_DOMAIN
|
||||
VALUE "FileDescription", APP_DESC
|
||||
VALUE "FileVersion", APP_VERSION
|
||||
VALUE "LegalCopyright", APP_COPYRIGHT
|
||||
|
||||
4
scripts/benchmark_10M.cmd
Normal file
4
scripts/benchmark_10M.cmd
Normal file
@@ -0,0 +1,4 @@
|
||||
@echo off
|
||||
cd %~dp0
|
||||
xmrig.exe --bench=10M --submit
|
||||
pause
|
||||
4
scripts/benchmark_1M.cmd
Normal file
4
scripts/benchmark_1M.cmd
Normal file
@@ -0,0 +1,4 @@
|
||||
@echo off
|
||||
cd %~dp0
|
||||
xmrig.exe --bench=1M --submit
|
||||
pause
|
||||
@@ -1,6 +1,10 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
HWLOC_VERSION="2.2.0"
|
||||
HWLOC_VERSION_MAJOR="2"
|
||||
HWLOC_VERSION_MINOR="7"
|
||||
HWLOC_VERSION_PATCH="1"
|
||||
|
||||
HWLOC_VERSION="${HWLOC_VERSION_MAJOR}.${HWLOC_VERSION_MINOR}.${HWLOC_VERSION_PATCH}"
|
||||
|
||||
mkdir -p deps
|
||||
mkdir -p deps/include
|
||||
@@ -8,12 +12,12 @@ mkdir -p deps/lib
|
||||
|
||||
mkdir -p build && cd build
|
||||
|
||||
wget https://download.open-mpi.org/release/hwloc/v2.2/hwloc-${HWLOC_VERSION}.tar.bz2 -O hwloc-${HWLOC_VERSION}.tar.bz2
|
||||
tar -xjf hwloc-${HWLOC_VERSION}.tar.bz2
|
||||
wget https://download.open-mpi.org/release/hwloc/v${HWLOC_VERSION_MAJOR}.${HWLOC_VERSION_MINOR}/hwloc-${HWLOC_VERSION}.tar.gz -O hwloc-${HWLOC_VERSION}.tar.gz
|
||||
tar -xzf hwloc-${HWLOC_VERSION}.tar.gz
|
||||
|
||||
cd hwloc-${HWLOC_VERSION}
|
||||
./configure --disable-shared --enable-static --disable-io --disable-libudev --disable-libxml2
|
||||
make -j$(nproc)
|
||||
cp -fr include/ ../../deps
|
||||
make -j$(nproc || sysctl -n hw.ncpu || sysctl -n hw.logicalcpu)
|
||||
cp -fr include ../../deps
|
||||
cp hwloc/.libs/libhwloc.a ../../deps/lib
|
||||
cd ..
|
||||
cd ..
|
||||
|
||||
19
scripts/build.hwloc1.sh
Executable file
19
scripts/build.hwloc1.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
HWLOC_VERSION="1.11.13"
|
||||
|
||||
mkdir -p deps
|
||||
mkdir -p deps/include
|
||||
mkdir -p deps/lib
|
||||
|
||||
mkdir -p build && cd build
|
||||
|
||||
wget https://download.open-mpi.org/release/hwloc/v1.11/hwloc-${HWLOC_VERSION}.tar.gz -O hwloc-${HWLOC_VERSION}.tar.gz
|
||||
tar -xzf hwloc-${HWLOC_VERSION}.tar.gz
|
||||
|
||||
cd hwloc-${HWLOC_VERSION}
|
||||
./configure --disable-shared --enable-static --disable-io --disable-libudev --disable-libxml2
|
||||
make -j$(nproc || sysctl -n hw.ncpu || sysctl -n hw.logicalcpu)
|
||||
cp -fr include ../../deps
|
||||
cp src/.libs/libhwloc.a ../../deps/lib
|
||||
cd ..
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
LIBRESSL_VERSION="3.0.2"
|
||||
LIBRESSL_VERSION="3.5.2"
|
||||
|
||||
mkdir -p deps
|
||||
mkdir -p deps/include
|
||||
@@ -13,8 +13,8 @@ tar -xzf libressl-${LIBRESSL_VERSION}.tar.gz
|
||||
|
||||
cd libressl-${LIBRESSL_VERSION}
|
||||
./configure --disable-shared
|
||||
make -j$(nproc)
|
||||
cp -fr include/ ../../deps
|
||||
make -j$(nproc || sysctl -n hw.ncpu || sysctl -n hw.logicalcpu)
|
||||
cp -fr include ../../deps
|
||||
cp crypto/.libs/libcrypto.a ../../deps/lib
|
||||
cp ssl/.libs/libssl.a ../../deps/lib
|
||||
cd ..
|
||||
cd ..
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
OPENSSL_VERSION="1.1.1g"
|
||||
OPENSSL_VERSION="1.1.1o"
|
||||
|
||||
mkdir -p deps
|
||||
mkdir -p deps/include
|
||||
@@ -13,8 +13,8 @@ tar -xzf openssl-${OPENSSL_VERSION}.tar.gz
|
||||
|
||||
cd openssl-${OPENSSL_VERSION}
|
||||
./config -no-shared -no-asm -no-zlib -no-comp -no-dgram -no-filenames -no-cms
|
||||
make -j$(nproc)
|
||||
cp -fr include/ ../../deps
|
||||
make -j$(nproc || sysctl -n hw.ncpu || sysctl -n hw.logicalcpu)
|
||||
cp -fr include ../../deps
|
||||
cp libcrypto.a ../../deps/lib
|
||||
cp libssl.a ../../deps/lib
|
||||
cd ..
|
||||
cd ..
|
||||
|
||||
20
scripts/build.openssl3.sh
Executable file
20
scripts/build.openssl3.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
OPENSSL_VERSION="3.0.3"
|
||||
|
||||
mkdir -p deps
|
||||
mkdir -p deps/include
|
||||
mkdir -p deps/lib
|
||||
|
||||
mkdir -p build && cd build
|
||||
|
||||
wget https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz -O openssl-${OPENSSL_VERSION}.tar.gz
|
||||
tar -xzf openssl-${OPENSSL_VERSION}.tar.gz
|
||||
|
||||
cd openssl-${OPENSSL_VERSION}
|
||||
./config -no-shared -no-asm -no-zlib -no-comp -no-dgram -no-filenames -no-cms
|
||||
make -j$(nproc || sysctl -n hw.ncpu || sysctl -n hw.logicalcpu)
|
||||
cp -fr include ../../deps
|
||||
cp libcrypto.a ../../deps/lib
|
||||
cp libssl.a ../../deps/lib
|
||||
cd ..
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
UV_VERSION="1.38.0"
|
||||
UV_VERSION="1.44.1"
|
||||
|
||||
mkdir -p deps
|
||||
mkdir -p deps/include
|
||||
@@ -14,7 +14,7 @@ tar -xzf v${UV_VERSION}.tar.gz
|
||||
cd libuv-${UV_VERSION}
|
||||
sh autogen.sh
|
||||
./configure --disable-shared
|
||||
make -j$(nproc)
|
||||
cp -fr include/ ../../deps
|
||||
make -j$(nproc || sysctl -n hw.ncpu || sysctl -n hw.logicalcpu)
|
||||
cp -fr include ../../deps
|
||||
cp .libs/libuv.a ../../deps/lib
|
||||
cd ..
|
||||
cd ..
|
||||
|
||||
@@ -49,9 +49,9 @@ function rx()
|
||||
'../cn/algorithm.cl',
|
||||
'randomx_constants_monero.h',
|
||||
'randomx_constants_wow.h',
|
||||
'randomx_constants_loki.h',
|
||||
'randomx_constants_arqma.h',
|
||||
'randomx_constants_keva.h',
|
||||
'randomx_constants_graft.h',
|
||||
'aes.cl',
|
||||
'blake2b.cl',
|
||||
'randomx_vm.cl',
|
||||
@@ -67,15 +67,6 @@ function rx()
|
||||
}
|
||||
|
||||
|
||||
function astrobwt()
|
||||
{
|
||||
const astrobwt = opencl_minify(addIncludes('astrobwt.cl', [ 'BWT.cl', 'salsa20.cl', 'sha3.cl' ]));
|
||||
|
||||
// fs.writeFileSync('astrobwt_gen.cl', astrobwt);
|
||||
fs.writeFileSync('astrobwt_cl.h', text2h(astrobwt, 'xmrig', 'astrobwt_cl'));
|
||||
}
|
||||
|
||||
|
||||
function kawpow()
|
||||
{
|
||||
const kawpow = opencl_minify(addIncludes('kawpow.cl', [ 'defs.h' ]));
|
||||
@@ -97,11 +88,6 @@ process.chdir(path.resolve('src/backend/opencl/cl/rx'));
|
||||
|
||||
rx();
|
||||
|
||||
process.chdir(cwd);
|
||||
process.chdir(path.resolve('src/backend/opencl/cl/astrobwt'));
|
||||
|
||||
astrobwt();
|
||||
|
||||
process.chdir(cwd);
|
||||
process.chdir(path.resolve('src/backend/opencl/cl/kawpow'));
|
||||
|
||||
|
||||
20
scripts/pool_mine_example.cmd
Normal file
20
scripts/pool_mine_example.cmd
Normal file
@@ -0,0 +1,20 @@
|
||||
:: Example batch file for mining Monero at a pool
|
||||
::
|
||||
:: Format:
|
||||
:: xmrig.exe -o <pool address>:<pool port> -u <pool username/wallet> -p <pool password>
|
||||
::
|
||||
:: Fields:
|
||||
:: pool address The host name of the pool stratum or its IP address, for example pool.hashvault.pro
|
||||
:: pool port The port of the pool's stratum to connect to, for example 3333. Check your pool's getting started page.
|
||||
:: pool username/wallet For most pools, this is the wallet address you want to mine to. Some pools require a username
|
||||
:: pool password For most pools this can be just 'x'. For pools using usernames, you may need to provide a password as configured on the pool.
|
||||
::
|
||||
:: List of Monero mining pools:
|
||||
:: https://miningpoolstats.stream/monero
|
||||
::
|
||||
:: Choose pools outside of top 5 to help Monero network be more decentralized!
|
||||
:: Smaller pools also often have smaller fees/payout limits.
|
||||
|
||||
cd %~dp0
|
||||
xmrig.exe -o pool.hashvault.pro:3333 -u 48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD -p x
|
||||
pause
|
||||
@@ -1,18 +1,34 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh -e
|
||||
|
||||
modprobe msr
|
||||
MSR_FILE=/sys/module/msr/parameters/allow_writes
|
||||
|
||||
if cat /proc/cpuinfo | grep "AMD Ryzen" > /dev/null;
|
||||
if test -e "$MSR_FILE"; then
|
||||
echo on > $MSR_FILE
|
||||
else
|
||||
modprobe msr allow_writes=on
|
||||
fi
|
||||
|
||||
if grep -E 'AMD Ryzen|AMD EPYC' /proc/cpuinfo > /dev/null;
|
||||
then
|
||||
echo "Detected Ryzen"
|
||||
wrmsr -a 0xc0011022 0x510000
|
||||
wrmsr -a 0xc001102b 0x1808cc16
|
||||
wrmsr -a 0xc0011020 0
|
||||
wrmsr -a 0xc0011021 0x40
|
||||
echo "MSR register values for Ryzen applied"
|
||||
elif cat /proc/cpuinfo | grep "Intel" > /dev/null;
|
||||
if grep "cpu family[[:space:]]:[[:space:]]25" /proc/cpuinfo > /dev/null;
|
||||
then
|
||||
echo "Detected Zen3 CPU"
|
||||
wrmsr -a 0xc0011020 0x4480000000000
|
||||
wrmsr -a 0xc0011021 0x1c000200000040
|
||||
wrmsr -a 0xc0011022 0xc000000401500000
|
||||
wrmsr -a 0xc001102b 0x2000cc14
|
||||
echo "MSR register values for Zen3 applied"
|
||||
else
|
||||
echo "Detected Zen1/Zen2 CPU"
|
||||
wrmsr -a 0xc0011020 0
|
||||
wrmsr -a 0xc0011021 0x40
|
||||
wrmsr -a 0xc0011022 0x1510000
|
||||
wrmsr -a 0xc001102b 0x2000cc16
|
||||
echo "MSR register values for Zen1/Zen2 applied"
|
||||
fi
|
||||
elif grep "Intel" /proc/cpuinfo > /dev/null;
|
||||
then
|
||||
echo "Detected Intel"
|
||||
echo "Detected Intel CPU"
|
||||
wrmsr -a 0x1a4 0xf
|
||||
echo "MSR register values for Intel applied"
|
||||
else
|
||||
|
||||
23
scripts/rtm_ghostrider_example.cmd
Normal file
23
scripts/rtm_ghostrider_example.cmd
Normal file
@@ -0,0 +1,23 @@
|
||||
:: Example batch file for mining Raptoreum at a pool
|
||||
::
|
||||
:: Format:
|
||||
:: xmrig.exe -a gr -o <pool address>:<pool port> -u <pool username/wallet> -p <pool password>
|
||||
::
|
||||
:: Fields:
|
||||
:: pool address The host name of the pool stratum or its IP address, for example raptoreumemporium.com
|
||||
:: pool port The port of the pool's stratum to connect to, for example 3333. Check your pool's getting started page.
|
||||
:: pool username/wallet For most pools, this is the wallet address you want to mine to. Some pools require a username
|
||||
:: pool password For most pools this can be just 'x'. For pools using usernames, you may need to provide a password as configured on the pool.
|
||||
::
|
||||
:: List of Raptoreum mining pools:
|
||||
:: https://miningpoolstats.stream/raptoreum
|
||||
::
|
||||
:: Choose pools outside of top 5 to help Raptoreum network be more decentralized!
|
||||
:: Smaller pools also often have smaller fees/payout limits.
|
||||
|
||||
cd %~dp0
|
||||
:: Use this command line to connect to non-SSL port
|
||||
xmrig.exe -a gr -o raptoreumemporium.com:3008 -u WALLET_ADDRESS -p x
|
||||
:: Or use this command line to connect to an SSL port
|
||||
:: xmrig.exe -a gr -o rtm.suprnova.cc:4273 --tls -u WALLET_ADDRESS -p x
|
||||
pause
|
||||
16
scripts/solo_mine_example.cmd
Normal file
16
scripts/solo_mine_example.cmd
Normal file
@@ -0,0 +1,16 @@
|
||||
:: Example batch file for mining Monero solo
|
||||
::
|
||||
:: Format:
|
||||
:: xmrig.exe -o <node address>:<node port> -a rx/0 -u <wallet address> --daemon
|
||||
::
|
||||
:: Fields:
|
||||
:: node address The host name of your monerod node or its IP address. It can also be a public node with RPC enabled, for example node.xmr.to
|
||||
:: node port The RPC port of your monerod node to connect to, usually 18081.
|
||||
:: wallet address Check your Monero CLI or GUI wallet to see your wallet's address.
|
||||
::
|
||||
:: Mining solo is the best way to help Monero network be more decentralized!
|
||||
:: But you will only get a payout when you find a block which can take more than a year for a single low-end PC.
|
||||
|
||||
cd %~dp0
|
||||
xmrig.exe -o node.xmr.to:18081 -a rx/0 -u 48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD --daemon
|
||||
pause
|
||||
4
src/3rdparty/CL/cl_dx9_media_sharing.h
vendored
4
src/3rdparty/CL/cl_dx9_media_sharing.h
vendored
@@ -44,7 +44,7 @@ extern "C" {
|
||||
|
||||
typedef cl_uint cl_dx9_media_adapter_type_khr;
|
||||
typedef cl_uint cl_dx9_media_adapter_set_khr;
|
||||
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <d3d9.h>
|
||||
typedef struct _cl_dx9_surface_info_khr
|
||||
@@ -105,7 +105,7 @@ typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromDX9MediaSurfaceKHR_fn)(
|
||||
cl_mem_flags flags,
|
||||
cl_dx9_media_adapter_type_khr adapter_type,
|
||||
void * surface_info,
|
||||
cl_uint plane,
|
||||
cl_uint plane,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireDX9MediaSurfacesKHR_fn)(
|
||||
|
||||
2
src/3rdparty/CL/cl_gl_ext.h
vendored
2
src/3rdparty/CL/cl_gl_ext.h
vendored
@@ -35,7 +35,7 @@ extern "C" {
|
||||
|
||||
#include <CL/cl_gl.h>
|
||||
|
||||
/*
|
||||
/*
|
||||
* cl_khr_gl_event extension
|
||||
*/
|
||||
#define CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR 0x200D
|
||||
|
||||
12
src/3rdparty/adl/adl_defines.h
vendored
12
src/3rdparty/adl/adl_defines.h
vendored
@@ -1471,7 +1471,7 @@ typedef enum _ADLProfilePropertyType
|
||||
#define ADL_HDR_FREESYNC_HDR 0x0004 ///< FreeSync HDR supported
|
||||
/// @}
|
||||
|
||||
/// \defgroup define_FreesyncFlags ADLDDCInfo2 Freesync HDR flags
|
||||
/// \defgroup define_FreesyncFlags ADLDDCInfo2 Freesync HDR flags
|
||||
/// @{
|
||||
/// defines for iFreesyncFlags in ADLDDCInfo2
|
||||
#define ADL_HDR_FREESYNC_BACKLIGHT_SUPPORT 0x0001 ///< Global backlight control supported
|
||||
@@ -1738,7 +1738,7 @@ enum ADLODNDPMMaskType
|
||||
ADL_ODN_DPM_MASK = 1 << 2,
|
||||
};
|
||||
|
||||
//ODN features Bits for ADLODNCapabilitiesX2
|
||||
//ODN features Bits for ADLODNCapabilitiesX2
|
||||
enum ADLODNFeatureControl
|
||||
{
|
||||
ADL_ODN_SCLK_DPM = 1 << 0,
|
||||
@@ -1764,7 +1764,7 @@ enum ADLODNFeatureControl
|
||||
|
||||
//If any new feature is added, PPLIB only needs to add ext feature ID and Item ID(Seeting ID). These IDs should match the drive defined in CWDDEPM.h
|
||||
enum ADLODNExtFeatureControl
|
||||
{
|
||||
{
|
||||
ADL_ODN_EXT_FEATURE_MEMORY_TIMING_TUNE = 1 << 0,
|
||||
ADL_ODN_EXT_FEATURE_FAN_ZERO_RPM_CONTROL = 1 << 1,
|
||||
ADL_ODN_EXT_FEATURE_AUTO_UV_ENGINE = 1 << 2, //Auto under voltage
|
||||
@@ -1794,7 +1794,7 @@ enum ADLODNExtSettingId
|
||||
ADL_ODN_PARAMETER_FAN_CURVE_SPEED_5,
|
||||
ADL_ODN_POWERGAUGE,
|
||||
ODN_COUNT
|
||||
|
||||
|
||||
} ;
|
||||
|
||||
//OD8 Capability features bits
|
||||
@@ -1811,7 +1811,7 @@ enum ADLOD8FeatureControl
|
||||
ADL_OD8_MEMORY_TIMING_TUNE = 1 << 8,
|
||||
ADL_OD8_FAN_ZERO_RPM_CONTROL = 1 << 9 ,
|
||||
ADL_OD8_AUTO_UV_ENGINE = 1 << 10, //Auto under voltage
|
||||
ADL_OD8_AUTO_OC_ENGINE = 1 << 11, //Auto overclock engine
|
||||
ADL_OD8_AUTO_OC_ENGINE = 1 << 11, //Auto overclock engine
|
||||
ADL_OD8_AUTO_OC_MEMORY = 1 << 12, //Auto overclock memory
|
||||
ADL_OD8_FAN_CURVE = 1 << 13, //Fan curve
|
||||
ADL_OD8_WS_AUTO_FAN_ACOUSTIC_LIMIT = 1 << 14, //Workstation Manual Fan controller
|
||||
@@ -1888,7 +1888,7 @@ typedef enum _ADLSensorType
|
||||
PMLOG_TEMPERATURE_VRSOC = 24,
|
||||
PMLOG_TEMPERATURE_VRMVDD0 = 25,
|
||||
PMLOG_TEMPERATURE_VRMVDD1 = 26,
|
||||
PMLOG_TEMPERATURE_HOTSPOT = 27,
|
||||
PMLOG_TEMPERATURE_HOTSPOT = 27,
|
||||
PMLOG_TEMPERATURE_GFX = 28,
|
||||
PMLOG_TEMPERATURE_SOC = 29,
|
||||
PMLOG_GFX_POWER = 30,
|
||||
|
||||
2
src/3rdparty/adl/adl_sdk.h
vendored
2
src/3rdparty/adl/adl_sdk.h
vendored
@@ -37,7 +37,7 @@
|
||||
#define __stdcall
|
||||
#endif /* (LINUX) */
|
||||
|
||||
/// Memory Allocation Call back
|
||||
/// Memory Allocation Call back
|
||||
typedef void* ( __stdcall *ADL_MAIN_MALLOC_CALLBACK )( int );
|
||||
|
||||
|
||||
|
||||
2
src/3rdparty/adl/adl_structures.h
vendored
2
src/3rdparty/adl/adl_structures.h
vendored
@@ -1753,7 +1753,7 @@ typedef struct ADLPXConfigCaps
|
||||
///\brief Enum containing PX or HG type
|
||||
///
|
||||
/// This enum is used to get PX or hG type
|
||||
///
|
||||
///
|
||||
/// \nosubgrouping
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
enum ADLPxType
|
||||
|
||||
2
src/3rdparty/argon2/CMakeLists.txt
vendored
2
src/3rdparty/argon2/CMakeLists.txt
vendored
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project(argon2 C)
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
|
||||
10
src/3rdparty/getopt/getopt.h
vendored
10
src/3rdparty/getopt/getopt.h
vendored
@@ -3,9 +3,9 @@
|
||||
* DISCLAIMER
|
||||
* This file is part of the mingw-w64 runtime package.
|
||||
*
|
||||
* The mingw-w64 runtime package and its code is distributed in the hope that it
|
||||
* will be useful but WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESSED OR
|
||||
* IMPLIED ARE HEREBY DISCLAIMED. This includes but is not limited to
|
||||
* The mingw-w64 runtime package and its code is distributed in the hope that it
|
||||
* will be useful but WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESSED OR
|
||||
* IMPLIED ARE HEREBY DISCLAIMED. This includes but is not limited to
|
||||
* warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
/*
|
||||
@@ -109,11 +109,7 @@ char *optarg; /* argument associated with option */
|
||||
extern char __declspec(dllimport) *__progname;
|
||||
#endif
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
static char EMSG[] = "";
|
||||
#else
|
||||
#define EMSG ""
|
||||
#endif
|
||||
|
||||
static int getopt_internal(int, char * const *, const char *,
|
||||
const struct option *, int *, int);
|
||||
|
||||
68
src/3rdparty/http-parser/AUTHORS
vendored
68
src/3rdparty/http-parser/AUTHORS
vendored
@@ -1,68 +0,0 @@
|
||||
# Authors ordered by first contribution.
|
||||
Ryan Dahl <ry@tinyclouds.org>
|
||||
Jeremy Hinegardner <jeremy@hinegardner.org>
|
||||
Sergey Shepelev <temotor@gmail.com>
|
||||
Joe Damato <ice799@gmail.com>
|
||||
tomika <tomika_nospam@freemail.hu>
|
||||
Phoenix Sol <phoenix@burninglabs.com>
|
||||
Cliff Frey <cliff@meraki.com>
|
||||
Ewen Cheslack-Postava <ewencp@cs.stanford.edu>
|
||||
Santiago Gala <sgala@apache.org>
|
||||
Tim Becker <tim.becker@syngenio.de>
|
||||
Jeff Terrace <jterrace@gmail.com>
|
||||
Ben Noordhuis <info@bnoordhuis.nl>
|
||||
Nathan Rajlich <nathan@tootallnate.net>
|
||||
Mark Nottingham <mnot@mnot.net>
|
||||
Aman Gupta <aman@tmm1.net>
|
||||
Tim Becker <tim.becker@kuriositaet.de>
|
||||
Sean Cunningham <sean.cunningham@mandiant.com>
|
||||
Peter Griess <pg@std.in>
|
||||
Salman Haq <salman.haq@asti-usa.com>
|
||||
Cliff Frey <clifffrey@gmail.com>
|
||||
Jon Kolb <jon@b0g.us>
|
||||
Fouad Mardini <f.mardini@gmail.com>
|
||||
Paul Querna <pquerna@apache.org>
|
||||
Felix Geisendörfer <felix@debuggable.com>
|
||||
koichik <koichik@improvement.jp>
|
||||
Andre Caron <andre.l.caron@gmail.com>
|
||||
Ivo Raisr <ivosh@ivosh.net>
|
||||
James McLaughlin <jamie@lacewing-project.org>
|
||||
David Gwynne <loki@animata.net>
|
||||
Thomas LE ROUX <thomas@november-eleven.fr>
|
||||
Randy Rizun <rrizun@ortivawireless.com>
|
||||
Andre Louis Caron <andre.louis.caron@usherbrooke.ca>
|
||||
Simon Zimmermann <simonz05@gmail.com>
|
||||
Erik Dubbelboer <erik@dubbelboer.com>
|
||||
Martell Malone <martellmalone@gmail.com>
|
||||
Bertrand Paquet <bpaquet@octo.com>
|
||||
BogDan Vatra <bogdan@kde.org>
|
||||
Peter Faiman <peter@thepicard.org>
|
||||
Corey Richardson <corey@octayn.net>
|
||||
Tóth Tamás <tomika_nospam@freemail.hu>
|
||||
Cam Swords <cam.swords@gmail.com>
|
||||
Chris Dickinson <christopher.s.dickinson@gmail.com>
|
||||
Uli Köhler <ukoehler@btronik.de>
|
||||
Charlie Somerville <charlie@charliesomerville.com>
|
||||
Patrik Stutz <patrik.stutz@gmail.com>
|
||||
Fedor Indutny <fedor.indutny@gmail.com>
|
||||
runner <runner.mei@gmail.com>
|
||||
Alexis Campailla <alexis@janeasystems.com>
|
||||
David Wragg <david@wragg.org>
|
||||
Vinnie Falco <vinnie.falco@gmail.com>
|
||||
Alex Butum <alexbutum@linux.com>
|
||||
Rex Feng <rexfeng@gmail.com>
|
||||
Alex Kocharin <alex@kocharin.ru>
|
||||
Mark Koopman <markmontymark@yahoo.com>
|
||||
Helge Heß <me@helgehess.eu>
|
||||
Alexis La Goutte <alexis.lagoutte@gmail.com>
|
||||
George Miroshnykov <george.miroshnykov@gmail.com>
|
||||
Maciej Małecki <me@mmalecki.com>
|
||||
Marc O'Morain <github.com@marcomorain.com>
|
||||
Jeff Pinner <jpinner@twitter.com>
|
||||
Timothy J Fontaine <tjfontaine@gmail.com>
|
||||
Akagi201 <akagi201@gmail.com>
|
||||
Romain Giraud <giraud.romain@gmail.com>
|
||||
Jay Satiro <raysatiro@yahoo.com>
|
||||
Arne Steen <Arne.Steen@gmx.de>
|
||||
Kjell Schubert <kjell.schubert@gmail.com>
|
||||
Olivier Mengué <dolmen@cpan.org>
|
||||
19
src/3rdparty/http-parser/LICENSE-MIT
vendored
19
src/3rdparty/http-parser/LICENSE-MIT
vendored
@@ -1,19 +0,0 @@
|
||||
Copyright Joyent, Inc. and other Node contributors.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
246
src/3rdparty/http-parser/README.md
vendored
246
src/3rdparty/http-parser/README.md
vendored
@@ -1,246 +0,0 @@
|
||||
HTTP Parser
|
||||
===========
|
||||
|
||||
[](https://travis-ci.org/nodejs/http-parser)
|
||||
|
||||
This is a parser for HTTP messages written in C. It parses both requests and
|
||||
responses. The parser is designed to be used in performance HTTP
|
||||
applications. It does not make any syscalls nor allocations, it does not
|
||||
buffer data, it can be interrupted at anytime. Depending on your
|
||||
architecture, it only requires about 40 bytes of data per message
|
||||
stream (in a web server that is per connection).
|
||||
|
||||
Features:
|
||||
|
||||
* No dependencies
|
||||
* Handles persistent streams (keep-alive).
|
||||
* Decodes chunked encoding.
|
||||
* Upgrade support
|
||||
* Defends against buffer overflow attacks.
|
||||
|
||||
The parser extracts the following information from HTTP messages:
|
||||
|
||||
* Header fields and values
|
||||
* Content-Length
|
||||
* Request method
|
||||
* Response status code
|
||||
* Transfer-Encoding
|
||||
* HTTP version
|
||||
* Request URL
|
||||
* Message body
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
One `http_parser` object is used per TCP connection. Initialize the struct
|
||||
using `http_parser_init()` and set the callbacks. That might look something
|
||||
like this for a request parser:
|
||||
```c
|
||||
http_parser_settings settings;
|
||||
settings.on_url = my_url_callback;
|
||||
settings.on_header_field = my_header_field_callback;
|
||||
/* ... */
|
||||
|
||||
http_parser *parser = malloc(sizeof(http_parser));
|
||||
http_parser_init(parser, HTTP_REQUEST);
|
||||
parser->data = my_socket;
|
||||
```
|
||||
|
||||
When data is received on the socket execute the parser and check for errors.
|
||||
|
||||
```c
|
||||
size_t len = 80*1024, nparsed;
|
||||
char buf[len];
|
||||
ssize_t recved;
|
||||
|
||||
recved = recv(fd, buf, len, 0);
|
||||
|
||||
if (recved < 0) {
|
||||
/* Handle error. */
|
||||
}
|
||||
|
||||
/* Start up / continue the parser.
|
||||
* Note we pass recved==0 to signal that EOF has been received.
|
||||
*/
|
||||
nparsed = http_parser_execute(parser, &settings, buf, recved);
|
||||
|
||||
if (parser->upgrade) {
|
||||
/* handle new protocol */
|
||||
} else if (nparsed != recved) {
|
||||
/* Handle error. Usually just close the connection. */
|
||||
}
|
||||
```
|
||||
|
||||
`http_parser` needs to know where the end of the stream is. For example, sometimes
|
||||
servers send responses without Content-Length and expect the client to
|
||||
consume input (for the body) until EOF. To tell `http_parser` about EOF, give
|
||||
`0` as the fourth parameter to `http_parser_execute()`. Callbacks and errors
|
||||
can still be encountered during an EOF, so one must still be prepared
|
||||
to receive them.
|
||||
|
||||
Scalar valued message information such as `status_code`, `method`, and the
|
||||
HTTP version are stored in the parser structure. This data is only
|
||||
temporally stored in `http_parser` and gets reset on each new message. If
|
||||
this information is needed later, copy it out of the structure during the
|
||||
`headers_complete` callback.
|
||||
|
||||
The parser decodes the transfer-encoding for both requests and responses
|
||||
transparently. That is, a chunked encoding is decoded before being sent to
|
||||
the on_body callback.
|
||||
|
||||
|
||||
The Special Problem of Upgrade
|
||||
------------------------------
|
||||
|
||||
`http_parser` supports upgrading the connection to a different protocol. An
|
||||
increasingly common example of this is the WebSocket protocol which sends
|
||||
a request like
|
||||
|
||||
GET /demo HTTP/1.1
|
||||
Upgrade: WebSocket
|
||||
Connection: Upgrade
|
||||
Host: example.com
|
||||
Origin: http://example.com
|
||||
WebSocket-Protocol: sample
|
||||
|
||||
followed by non-HTTP data.
|
||||
|
||||
(See [RFC6455](https://tools.ietf.org/html/rfc6455) for more information the
|
||||
WebSocket protocol.)
|
||||
|
||||
To support this, the parser will treat this as a normal HTTP message without a
|
||||
body, issuing both on_headers_complete and on_message_complete callbacks. However
|
||||
http_parser_execute() will stop parsing at the end of the headers and return.
|
||||
|
||||
The user is expected to check if `parser->upgrade` has been set to 1 after
|
||||
`http_parser_execute()` returns. Non-HTTP data begins at the buffer supplied
|
||||
offset by the return value of `http_parser_execute()`.
|
||||
|
||||
|
||||
Callbacks
|
||||
---------
|
||||
|
||||
During the `http_parser_execute()` call, the callbacks set in
|
||||
`http_parser_settings` will be executed. The parser maintains state and
|
||||
never looks behind, so buffering the data is not necessary. If you need to
|
||||
save certain data for later usage, you can do that from the callbacks.
|
||||
|
||||
There are two types of callbacks:
|
||||
|
||||
* notification `typedef int (*http_cb) (http_parser*);`
|
||||
Callbacks: on_message_begin, on_headers_complete, on_message_complete.
|
||||
* data `typedef int (*http_data_cb) (http_parser*, const char *at, size_t length);`
|
||||
Callbacks: (requests only) on_url,
|
||||
(common) on_header_field, on_header_value, on_body;
|
||||
|
||||
Callbacks must return 0 on success. Returning a non-zero value indicates
|
||||
error to the parser, making it exit immediately.
|
||||
|
||||
For cases where it is necessary to pass local information to/from a callback,
|
||||
the `http_parser` object's `data` field can be used.
|
||||
An example of such a case is when using threads to handle a socket connection,
|
||||
parse a request, and then give a response over that socket. By instantiation
|
||||
of a thread-local struct containing relevant data (e.g. accepted socket,
|
||||
allocated memory for callbacks to write into, etc), a parser's callbacks are
|
||||
able to communicate data between the scope of the thread and the scope of the
|
||||
callback in a threadsafe manner. This allows `http_parser` to be used in
|
||||
multi-threaded contexts.
|
||||
|
||||
Example:
|
||||
```c
|
||||
typedef struct {
|
||||
socket_t sock;
|
||||
void* buffer;
|
||||
int buf_len;
|
||||
} custom_data_t;
|
||||
|
||||
|
||||
int my_url_callback(http_parser* parser, const char *at, size_t length) {
|
||||
/* access to thread local custom_data_t struct.
|
||||
Use this access save parsed data for later use into thread local
|
||||
buffer, or communicate over socket
|
||||
*/
|
||||
parser->data;
|
||||
...
|
||||
return 0;
|
||||
}
|
||||
|
||||
...
|
||||
|
||||
void http_parser_thread(socket_t sock) {
|
||||
int nparsed = 0;
|
||||
/* allocate memory for user data */
|
||||
custom_data_t *my_data = malloc(sizeof(custom_data_t));
|
||||
|
||||
/* some information for use by callbacks.
|
||||
* achieves thread -> callback information flow */
|
||||
my_data->sock = sock;
|
||||
|
||||
/* instantiate a thread-local parser */
|
||||
http_parser *parser = malloc(sizeof(http_parser));
|
||||
http_parser_init(parser, HTTP_REQUEST); /* initialise parser */
|
||||
/* this custom data reference is accessible through the reference to the
|
||||
parser supplied to callback functions */
|
||||
parser->data = my_data;
|
||||
|
||||
http_parser_settings settings; /* set up callbacks */
|
||||
settings.on_url = my_url_callback;
|
||||
|
||||
/* execute parser */
|
||||
nparsed = http_parser_execute(parser, &settings, buf, recved);
|
||||
|
||||
...
|
||||
/* parsed information copied from callback.
|
||||
can now perform action on data copied into thread-local memory from callbacks.
|
||||
achieves callback -> thread information flow */
|
||||
my_data->buffer;
|
||||
...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
In case you parse HTTP message in chunks (i.e. `read()` request line
|
||||
from socket, parse, read half headers, parse, etc) your data callbacks
|
||||
may be called more than once. `http_parser` guarantees that data pointer is only
|
||||
valid for the lifetime of callback. You can also `read()` into a heap allocated
|
||||
buffer to avoid copying memory around if this fits your application.
|
||||
|
||||
Reading headers may be a tricky task if you read/parse headers partially.
|
||||
Basically, you need to remember whether last header callback was field or value
|
||||
and apply the following logic:
|
||||
|
||||
(on_header_field and on_header_value shortened to on_h_*)
|
||||
------------------------ ------------ --------------------------------------------
|
||||
| State (prev. callback) | Callback | Description/action |
|
||||
------------------------ ------------ --------------------------------------------
|
||||
| nothing (first call) | on_h_field | Allocate new buffer and copy callback data |
|
||||
| | | into it |
|
||||
------------------------ ------------ --------------------------------------------
|
||||
| value | on_h_field | New header started. |
|
||||
| | | Copy current name,value buffers to headers |
|
||||
| | | list and allocate new buffer for new name |
|
||||
------------------------ ------------ --------------------------------------------
|
||||
| field | on_h_field | Previous name continues. Reallocate name |
|
||||
| | | buffer and append callback data to it |
|
||||
------------------------ ------------ --------------------------------------------
|
||||
| field | on_h_value | Value for current header started. Allocate |
|
||||
| | | new buffer and copy callback data to it |
|
||||
------------------------ ------------ --------------------------------------------
|
||||
| value | on_h_value | Value continues. Reallocate value buffer |
|
||||
| | | and append callback data to it |
|
||||
------------------------ ------------ --------------------------------------------
|
||||
|
||||
|
||||
Parsing URLs
|
||||
------------
|
||||
|
||||
A simplistic zero-copy URL parser is provided as `http_parser_parse_url()`.
|
||||
Users of this library may wish to use it to parse URLs constructed from
|
||||
consecutive `on_url` callbacks.
|
||||
|
||||
See examples of reading in headers:
|
||||
|
||||
* [partial example](http://gist.github.com/155877) in C
|
||||
* [from http-parser tests](http://github.com/joyent/http-parser/blob/37a0ff8/test.c#L403) in C
|
||||
* [from Node library](http://github.com/joyent/node/blob/842eaf4/src/http.js#L284) in Javascript
|
||||
2565
src/3rdparty/http-parser/http_parser.c
vendored
2565
src/3rdparty/http-parser/http_parser.c
vendored
File diff suppressed because it is too large
Load Diff
442
src/3rdparty/http-parser/http_parser.h
vendored
442
src/3rdparty/http-parser/http_parser.h
vendored
@@ -1,442 +0,0 @@
|
||||
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef http_parser_h
|
||||
#define http_parser_h
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Also update SONAME in the Makefile whenever you change these. */
|
||||
#define HTTP_PARSER_VERSION_MAJOR 2
|
||||
#define HTTP_PARSER_VERSION_MINOR 9
|
||||
#define HTTP_PARSER_VERSION_PATCH 3
|
||||
|
||||
#include <stddef.h>
|
||||
#if defined(_WIN32) && !defined(__MINGW32__) && \
|
||||
(!defined(_MSC_VER) || _MSC_VER<1600) && !defined(__WINE__)
|
||||
#include <BaseTsd.h>
|
||||
typedef __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
/* Compile with -DHTTP_PARSER_STRICT=0 to make less checks, but run
|
||||
* faster
|
||||
*/
|
||||
#ifndef HTTP_PARSER_STRICT
|
||||
# define HTTP_PARSER_STRICT 1
|
||||
#endif
|
||||
|
||||
/* Maximium header size allowed. If the macro is not defined
|
||||
* before including this header then the default is used. To
|
||||
* change the maximum header size, define the macro in the build
|
||||
* environment (e.g. -DHTTP_MAX_HEADER_SIZE=<value>). To remove
|
||||
* the effective limit on the size of the header, define the macro
|
||||
* to a very large number (e.g. -DHTTP_MAX_HEADER_SIZE=0x7fffffff)
|
||||
*/
|
||||
#ifndef HTTP_MAX_HEADER_SIZE
|
||||
# define HTTP_MAX_HEADER_SIZE (80*1024)
|
||||
#endif
|
||||
|
||||
typedef struct http_parser http_parser;
|
||||
typedef struct http_parser_settings http_parser_settings;
|
||||
|
||||
|
||||
/* Callbacks should return non-zero to indicate an error. The parser will
|
||||
* then halt execution.
|
||||
*
|
||||
* The one exception is on_headers_complete. In a HTTP_RESPONSE parser
|
||||
* returning '1' from on_headers_complete will tell the parser that it
|
||||
* should not expect a body. This is used when receiving a response to a
|
||||
* HEAD request which may contain 'Content-Length' or 'Transfer-Encoding:
|
||||
* chunked' headers that indicate the presence of a body.
|
||||
*
|
||||
* Returning `2` from on_headers_complete will tell parser that it should not
|
||||
* expect neither a body nor any futher responses on this connection. This is
|
||||
* useful for handling responses to a CONNECT request which may not contain
|
||||
* `Upgrade` or `Connection: upgrade` headers.
|
||||
*
|
||||
* http_data_cb does not return data chunks. It will be called arbitrarily
|
||||
* many times for each string. E.G. you might get 10 callbacks for "on_url"
|
||||
* each providing just a few characters more data.
|
||||
*/
|
||||
typedef int (*http_data_cb) (http_parser*, const char *at, size_t length);
|
||||
typedef int (*http_cb) (http_parser*);
|
||||
|
||||
|
||||
/* Status Codes */
|
||||
#define HTTP_STATUS_MAP(XX) \
|
||||
XX(100, CONTINUE, Continue) \
|
||||
XX(101, SWITCHING_PROTOCOLS, Switching Protocols) \
|
||||
XX(102, PROCESSING, Processing) \
|
||||
XX(200, OK, OK) \
|
||||
XX(201, CREATED, Created) \
|
||||
XX(202, ACCEPTED, Accepted) \
|
||||
XX(203, NON_AUTHORITATIVE_INFORMATION, Non-Authoritative Information) \
|
||||
XX(204, NO_CONTENT, No Content) \
|
||||
XX(205, RESET_CONTENT, Reset Content) \
|
||||
XX(206, PARTIAL_CONTENT, Partial Content) \
|
||||
XX(207, MULTI_STATUS, Multi-Status) \
|
||||
XX(208, ALREADY_REPORTED, Already Reported) \
|
||||
XX(226, IM_USED, IM Used) \
|
||||
XX(300, MULTIPLE_CHOICES, Multiple Choices) \
|
||||
XX(301, MOVED_PERMANENTLY, Moved Permanently) \
|
||||
XX(302, FOUND, Found) \
|
||||
XX(303, SEE_OTHER, See Other) \
|
||||
XX(304, NOT_MODIFIED, Not Modified) \
|
||||
XX(305, USE_PROXY, Use Proxy) \
|
||||
XX(307, TEMPORARY_REDIRECT, Temporary Redirect) \
|
||||
XX(308, PERMANENT_REDIRECT, Permanent Redirect) \
|
||||
XX(400, BAD_REQUEST, Bad Request) \
|
||||
XX(401, UNAUTHORIZED, Unauthorized) \
|
||||
XX(402, PAYMENT_REQUIRED, Payment Required) \
|
||||
XX(403, FORBIDDEN, Forbidden) \
|
||||
XX(404, NOT_FOUND, Not Found) \
|
||||
XX(405, METHOD_NOT_ALLOWED, Method Not Allowed) \
|
||||
XX(406, NOT_ACCEPTABLE, Not Acceptable) \
|
||||
XX(407, PROXY_AUTHENTICATION_REQUIRED, Proxy Authentication Required) \
|
||||
XX(408, REQUEST_TIMEOUT, Request Timeout) \
|
||||
XX(409, CONFLICT, Conflict) \
|
||||
XX(410, GONE, Gone) \
|
||||
XX(411, LENGTH_REQUIRED, Length Required) \
|
||||
XX(412, PRECONDITION_FAILED, Precondition Failed) \
|
||||
XX(413, PAYLOAD_TOO_LARGE, Payload Too Large) \
|
||||
XX(414, URI_TOO_LONG, URI Too Long) \
|
||||
XX(415, UNSUPPORTED_MEDIA_TYPE, Unsupported Media Type) \
|
||||
XX(416, RANGE_NOT_SATISFIABLE, Range Not Satisfiable) \
|
||||
XX(417, EXPECTATION_FAILED, Expectation Failed) \
|
||||
XX(421, MISDIRECTED_REQUEST, Misdirected Request) \
|
||||
XX(422, UNPROCESSABLE_ENTITY, Unprocessable Entity) \
|
||||
XX(423, LOCKED, Locked) \
|
||||
XX(424, FAILED_DEPENDENCY, Failed Dependency) \
|
||||
XX(426, UPGRADE_REQUIRED, Upgrade Required) \
|
||||
XX(428, PRECONDITION_REQUIRED, Precondition Required) \
|
||||
XX(429, TOO_MANY_REQUESTS, Too Many Requests) \
|
||||
XX(431, REQUEST_HEADER_FIELDS_TOO_LARGE, Request Header Fields Too Large) \
|
||||
XX(451, UNAVAILABLE_FOR_LEGAL_REASONS, Unavailable For Legal Reasons) \
|
||||
XX(500, INTERNAL_SERVER_ERROR, Internal Server Error) \
|
||||
XX(501, NOT_IMPLEMENTED, Not Implemented) \
|
||||
XX(502, BAD_GATEWAY, Bad Gateway) \
|
||||
XX(503, SERVICE_UNAVAILABLE, Service Unavailable) \
|
||||
XX(504, GATEWAY_TIMEOUT, Gateway Timeout) \
|
||||
XX(505, HTTP_VERSION_NOT_SUPPORTED, HTTP Version Not Supported) \
|
||||
XX(506, VARIANT_ALSO_NEGOTIATES, Variant Also Negotiates) \
|
||||
XX(507, INSUFFICIENT_STORAGE, Insufficient Storage) \
|
||||
XX(508, LOOP_DETECTED, Loop Detected) \
|
||||
XX(510, NOT_EXTENDED, Not Extended) \
|
||||
XX(511, NETWORK_AUTHENTICATION_REQUIRED, Network Authentication Required) \
|
||||
|
||||
enum http_status
|
||||
{
|
||||
#define XX(num, name, string) HTTP_STATUS_##name = num,
|
||||
HTTP_STATUS_MAP(XX)
|
||||
#undef XX
|
||||
};
|
||||
|
||||
|
||||
/* Request Methods */
|
||||
#define HTTP_METHOD_MAP(XX) \
|
||||
XX(0, DELETE, DELETE) \
|
||||
XX(1, GET, GET) \
|
||||
XX(2, HEAD, HEAD) \
|
||||
XX(3, POST, POST) \
|
||||
XX(4, PUT, PUT) \
|
||||
/* pathological */ \
|
||||
XX(5, CONNECT, CONNECT) \
|
||||
XX(6, OPTIONS, OPTIONS) \
|
||||
XX(7, TRACE, TRACE) \
|
||||
/* WebDAV */ \
|
||||
XX(8, COPY, COPY) \
|
||||
XX(9, LOCK, LOCK) \
|
||||
XX(10, MKCOL, MKCOL) \
|
||||
XX(11, MOVE, MOVE) \
|
||||
XX(12, PROPFIND, PROPFIND) \
|
||||
XX(13, PROPPATCH, PROPPATCH) \
|
||||
XX(14, SEARCH, SEARCH) \
|
||||
XX(15, UNLOCK, UNLOCK) \
|
||||
XX(16, BIND, BIND) \
|
||||
XX(17, REBIND, REBIND) \
|
||||
XX(18, UNBIND, UNBIND) \
|
||||
XX(19, ACL, ACL) \
|
||||
/* subversion */ \
|
||||
XX(20, REPORT, REPORT) \
|
||||
XX(21, MKACTIVITY, MKACTIVITY) \
|
||||
XX(22, CHECKOUT, CHECKOUT) \
|
||||
XX(23, MERGE, MERGE) \
|
||||
/* upnp */ \
|
||||
XX(24, MSEARCH, M-SEARCH) \
|
||||
XX(25, NOTIFY, NOTIFY) \
|
||||
XX(26, SUBSCRIBE, SUBSCRIBE) \
|
||||
XX(27, UNSUBSCRIBE, UNSUBSCRIBE) \
|
||||
/* RFC-5789 */ \
|
||||
XX(28, PATCH, PATCH) \
|
||||
XX(29, PURGE, PURGE) \
|
||||
/* CalDAV */ \
|
||||
XX(30, MKCALENDAR, MKCALENDAR) \
|
||||
/* RFC-2068, section 19.6.1.2 */ \
|
||||
XX(31, LINK, LINK) \
|
||||
XX(32, UNLINK, UNLINK) \
|
||||
/* icecast */ \
|
||||
XX(33, SOURCE, SOURCE) \
|
||||
|
||||
enum http_method
|
||||
{
|
||||
#define XX(num, name, string) HTTP_##name = num,
|
||||
HTTP_METHOD_MAP(XX)
|
||||
#undef XX
|
||||
};
|
||||
|
||||
|
||||
enum http_parser_type { HTTP_REQUEST, HTTP_RESPONSE, HTTP_BOTH };
|
||||
|
||||
|
||||
/* Flag values for http_parser.flags field */
|
||||
enum flags
|
||||
{ F_CHUNKED = 1 << 0
|
||||
, F_CONNECTION_KEEP_ALIVE = 1 << 1
|
||||
, F_CONNECTION_CLOSE = 1 << 2
|
||||
, F_CONNECTION_UPGRADE = 1 << 3
|
||||
, F_TRAILING = 1 << 4
|
||||
, F_UPGRADE = 1 << 5
|
||||
, F_SKIPBODY = 1 << 6
|
||||
, F_CONTENTLENGTH = 1 << 7
|
||||
, F_TRANSFER_ENCODING = 1 << 8
|
||||
};
|
||||
|
||||
|
||||
/* Map for errno-related constants
|
||||
*
|
||||
* The provided argument should be a macro that takes 2 arguments.
|
||||
*/
|
||||
#define HTTP_ERRNO_MAP(XX) \
|
||||
/* No error */ \
|
||||
XX(OK, "success") \
|
||||
\
|
||||
/* Callback-related errors */ \
|
||||
XX(CB_message_begin, "the on_message_begin callback failed") \
|
||||
XX(CB_url, "the on_url callback failed") \
|
||||
XX(CB_header_field, "the on_header_field callback failed") \
|
||||
XX(CB_header_value, "the on_header_value callback failed") \
|
||||
XX(CB_headers_complete, "the on_headers_complete callback failed") \
|
||||
XX(CB_body, "the on_body callback failed") \
|
||||
XX(CB_message_complete, "the on_message_complete callback failed") \
|
||||
XX(CB_status, "the on_status callback failed") \
|
||||
XX(CB_chunk_header, "the on_chunk_header callback failed") \
|
||||
XX(CB_chunk_complete, "the on_chunk_complete callback failed") \
|
||||
\
|
||||
/* Parsing-related errors */ \
|
||||
XX(INVALID_EOF_STATE, "stream ended at an unexpected time") \
|
||||
XX(HEADER_OVERFLOW, \
|
||||
"too many header bytes seen; overflow detected") \
|
||||
XX(CLOSED_CONNECTION, \
|
||||
"data received after completed connection: close message") \
|
||||
XX(INVALID_VERSION, "invalid HTTP version") \
|
||||
XX(INVALID_STATUS, "invalid HTTP status code") \
|
||||
XX(INVALID_METHOD, "invalid HTTP method") \
|
||||
XX(INVALID_URL, "invalid URL") \
|
||||
XX(INVALID_HOST, "invalid host") \
|
||||
XX(INVALID_PORT, "invalid port") \
|
||||
XX(INVALID_PATH, "invalid path") \
|
||||
XX(INVALID_QUERY_STRING, "invalid query string") \
|
||||
XX(INVALID_FRAGMENT, "invalid fragment") \
|
||||
XX(LF_EXPECTED, "LF character expected") \
|
||||
XX(INVALID_HEADER_TOKEN, "invalid character in header") \
|
||||
XX(INVALID_CONTENT_LENGTH, \
|
||||
"invalid character in content-length header") \
|
||||
XX(UNEXPECTED_CONTENT_LENGTH, \
|
||||
"unexpected content-length header") \
|
||||
XX(INVALID_CHUNK_SIZE, \
|
||||
"invalid character in chunk size header") \
|
||||
XX(INVALID_TRANSFER_ENCODING, \
|
||||
"request has invalid transfer-encoding") \
|
||||
XX(INVALID_CONSTANT, "invalid constant string") \
|
||||
XX(INVALID_INTERNAL_STATE, "encountered unexpected internal state")\
|
||||
XX(STRICT, "strict mode assertion failed") \
|
||||
XX(PAUSED, "parser is paused") \
|
||||
XX(UNKNOWN, "an unknown error occurred")
|
||||
|
||||
|
||||
/* Define HPE_* values for each errno value above */
|
||||
#define HTTP_ERRNO_GEN(n, s) HPE_##n,
|
||||
enum http_errno {
|
||||
HTTP_ERRNO_MAP(HTTP_ERRNO_GEN)
|
||||
};
|
||||
#undef HTTP_ERRNO_GEN
|
||||
|
||||
|
||||
/* Get an http_errno value from an http_parser */
|
||||
#define HTTP_PARSER_ERRNO(p) ((enum http_errno) (p)->http_errno)
|
||||
|
||||
|
||||
struct http_parser {
|
||||
/** PRIVATE **/
|
||||
unsigned int type : 2; /* enum http_parser_type */
|
||||
unsigned int state : 7; /* enum state from http_parser.c */
|
||||
unsigned int header_state : 7; /* enum header_state from http_parser.c */
|
||||
unsigned int index : 7; /* index into current matcher */
|
||||
unsigned int lenient_http_headers : 1;
|
||||
unsigned int flags : 16; /* F_* values from 'flags' enum; semi-public */
|
||||
|
||||
uint32_t nread; /* # bytes read in various scenarios */
|
||||
uint64_t content_length; /* # bytes in body (0 if no Content-Length header) */
|
||||
|
||||
/** READ-ONLY **/
|
||||
unsigned short http_major;
|
||||
unsigned short http_minor;
|
||||
unsigned int status_code : 16; /* responses only */
|
||||
unsigned int method : 8; /* requests only */
|
||||
unsigned int http_errno : 7;
|
||||
|
||||
/* 1 = Upgrade header was present and the parser has exited because of that.
|
||||
* 0 = No upgrade header present.
|
||||
* Should be checked when http_parser_execute() returns in addition to
|
||||
* error checking.
|
||||
*/
|
||||
unsigned int upgrade : 1;
|
||||
|
||||
/** PUBLIC **/
|
||||
void *data; /* A pointer to get hook to the "connection" or "socket" object */
|
||||
};
|
||||
|
||||
|
||||
struct http_parser_settings {
|
||||
http_cb on_message_begin;
|
||||
http_data_cb on_url;
|
||||
http_data_cb on_status;
|
||||
http_data_cb on_header_field;
|
||||
http_data_cb on_header_value;
|
||||
http_cb on_headers_complete;
|
||||
http_data_cb on_body;
|
||||
http_cb on_message_complete;
|
||||
/* When on_chunk_header is called, the current chunk length is stored
|
||||
* in parser->content_length.
|
||||
*/
|
||||
http_cb on_chunk_header;
|
||||
http_cb on_chunk_complete;
|
||||
};
|
||||
|
||||
|
||||
enum http_parser_url_fields
|
||||
{ UF_SCHEMA = 0
|
||||
, UF_HOST = 1
|
||||
, UF_PORT = 2
|
||||
, UF_PATH = 3
|
||||
, UF_QUERY = 4
|
||||
, UF_FRAGMENT = 5
|
||||
, UF_USERINFO = 6
|
||||
, UF_MAX = 7
|
||||
};
|
||||
|
||||
|
||||
/* Result structure for http_parser_parse_url().
|
||||
*
|
||||
* Callers should index into field_data[] with UF_* values iff field_set
|
||||
* has the relevant (1 << UF_*) bit set. As a courtesy to clients (and
|
||||
* because we probably have padding left over), we convert any port to
|
||||
* a uint16_t.
|
||||
*/
|
||||
struct http_parser_url {
|
||||
uint16_t field_set; /* Bitmask of (1 << UF_*) values */
|
||||
uint16_t port; /* Converted UF_PORT string */
|
||||
|
||||
struct {
|
||||
uint16_t off; /* Offset into buffer in which field starts */
|
||||
uint16_t len; /* Length of run in buffer */
|
||||
} field_data[UF_MAX];
|
||||
};
|
||||
|
||||
|
||||
/* Returns the library version. Bits 16-23 contain the major version number,
|
||||
* bits 8-15 the minor version number and bits 0-7 the patch level.
|
||||
* Usage example:
|
||||
*
|
||||
* unsigned long version = http_parser_version();
|
||||
* unsigned major = (version >> 16) & 255;
|
||||
* unsigned minor = (version >> 8) & 255;
|
||||
* unsigned patch = version & 255;
|
||||
* printf("http_parser v%u.%u.%u\n", major, minor, patch);
|
||||
*/
|
||||
unsigned long http_parser_version(void);
|
||||
|
||||
void http_parser_init(http_parser *parser, enum http_parser_type type);
|
||||
|
||||
|
||||
/* Initialize http_parser_settings members to 0
|
||||
*/
|
||||
void http_parser_settings_init(http_parser_settings *settings);
|
||||
|
||||
|
||||
/* Executes the parser. Returns number of parsed bytes. Sets
|
||||
* `parser->http_errno` on error. */
|
||||
size_t http_parser_execute(http_parser *parser,
|
||||
const http_parser_settings *settings,
|
||||
const char *data,
|
||||
size_t len);
|
||||
|
||||
|
||||
/* If http_should_keep_alive() in the on_headers_complete or
|
||||
* on_message_complete callback returns 0, then this should be
|
||||
* the last message on the connection.
|
||||
* If you are the server, respond with the "Connection: close" header.
|
||||
* If you are the client, close the connection.
|
||||
*/
|
||||
int http_should_keep_alive(const http_parser *parser);
|
||||
|
||||
/* Returns a string version of the HTTP method. */
|
||||
const char *http_method_str(enum http_method m);
|
||||
|
||||
/* Returns a string version of the HTTP status code. */
|
||||
const char *http_status_str(enum http_status s);
|
||||
|
||||
/* Return a string name of the given error */
|
||||
const char *http_errno_name(enum http_errno err);
|
||||
|
||||
/* Return a string description of the given error */
|
||||
const char *http_errno_description(enum http_errno err);
|
||||
|
||||
/* Initialize all http_parser_url members to 0 */
|
||||
void http_parser_url_init(struct http_parser_url *u);
|
||||
|
||||
/* Parse a URL; return nonzero on failure */
|
||||
int http_parser_parse_url(const char *buf, size_t buflen,
|
||||
int is_connect,
|
||||
struct http_parser_url *u);
|
||||
|
||||
/* Pause or un-pause the parser; a nonzero value pauses */
|
||||
void http_parser_pause(http_parser *parser, int paused);
|
||||
|
||||
/* Checks if this is the final chunk of the body. */
|
||||
int http_body_is_final(const http_parser *parser);
|
||||
|
||||
/* Change the maximum header size provided at compile time. */
|
||||
void http_parser_set_max_header_size(uint32_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
45
src/3rdparty/hwloc/AUTHORS
vendored
45
src/3rdparty/hwloc/AUTHORS
vendored
@@ -1,45 +0,0 @@
|
||||
hwloc Authors
|
||||
=============
|
||||
|
||||
The following cumulative list contains the names of most individuals
|
||||
who have committed code to the hwloc repository
|
||||
(either directly or through a third party).
|
||||
|
||||
Name Affiliation(s)
|
||||
--------------------------- --------------------
|
||||
Grzegorz Andrejczuk Intel
|
||||
Cédric Augonnet University of Bordeaux
|
||||
Guillaume Beauchamp Inria
|
||||
Ahmad Boissetri Binzagr Inria
|
||||
Cyril Bordage Inria
|
||||
Nicholas Buroker UWL
|
||||
Christopher M. Cantalupo Intel
|
||||
Jérôme Clet-Ortega University of Bordeaux
|
||||
Ludovic Courtès Inria
|
||||
Clément Foyer Inria
|
||||
Nathalie Furmento CNRS
|
||||
Bryon Gloden
|
||||
Brice Goglin Inria
|
||||
Gilles Gouaillardet RIST
|
||||
Valentin Hoyet Inria
|
||||
Joshua Hursey UWL
|
||||
Alexey Kardashevskiy IBM
|
||||
Rob Latham ANL
|
||||
Douglas MacFarland UWL
|
||||
Marc Marí BSC
|
||||
Jonathan L Peyton Intel
|
||||
Piotr Luc Intel
|
||||
Antoine Rougier intern from University of Bordeaux
|
||||
Jeff Squyres Cisco
|
||||
Samuel Thibault University of Bordeaux
|
||||
Jean-Yves VET DDN
|
||||
Benjamin Worpitz
|
||||
Jeff Zhao Zhaoxin
|
||||
|
||||
Affiliaion abbreviations:
|
||||
-------------------------
|
||||
ANL = Argonne National Lab
|
||||
BSC = Barcelona Supercomputing Center
|
||||
Cisco = Cisco Systems, Inc.
|
||||
CNRS = Centre national de la recherche scientifique (France)
|
||||
UWL = University of Wisconsin-La Crosse
|
||||
38
src/3rdparty/hwloc/CMakeLists.txt
vendored
38
src/3rdparty/hwloc/CMakeLists.txt
vendored
@@ -1,38 +0,0 @@
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
project (hwloc C)
|
||||
|
||||
include_directories(include)
|
||||
include_directories(src)
|
||||
|
||||
add_definitions(/D_CRT_SECURE_NO_WARNINGS)
|
||||
set(CMAKE_C_FLAGS_RELEASE "/MT /O2 /Ob2 /DNDEBUG")
|
||||
|
||||
set(HEADERS
|
||||
include/hwloc.h
|
||||
src/static-components.h
|
||||
)
|
||||
|
||||
set(SOURCES
|
||||
src/base64.c
|
||||
src/bind.c
|
||||
src/bitmap.c
|
||||
src/components.c
|
||||
src/diff.c
|
||||
src/distances.c
|
||||
src/misc.c
|
||||
src/pci-common.c
|
||||
src/shmem.c
|
||||
src/topology.c
|
||||
src/topology-noos.c
|
||||
src/topology-synthetic.c
|
||||
src/topology-windows.c
|
||||
src/topology-x86.c
|
||||
src/topology-xml.c
|
||||
src/topology-xml-nolibxml.c
|
||||
src/traversal.c
|
||||
)
|
||||
|
||||
add_library(hwloc STATIC
|
||||
${HEADERS}
|
||||
${SOURCES}
|
||||
)
|
||||
39
src/3rdparty/hwloc/COPYING
vendored
39
src/3rdparty/hwloc/COPYING
vendored
@@ -1,39 +0,0 @@
|
||||
Copyright © 2004-2006 The Trustees of Indiana University and Indiana University Research and Technology Corporation. All rights reserved.
|
||||
Copyright © 2004-2005 The University of Tennessee and The University of Tennessee Research Foundation. All rights reserved.
|
||||
Copyright © 2004-2005 High Performance Computing Center Stuttgart, University of Stuttgart. All rights reserved.
|
||||
Copyright © 2004-2005 The Regents of the University of California. All rights reserved.
|
||||
Copyright © 2009 CNRS
|
||||
Copyright © 2009-2016 Inria. All rights reserved.
|
||||
Copyright © 2009-2015 Université Bordeaux
|
||||
Copyright © 2009-2015 Cisco Systems, Inc. All rights reserved.
|
||||
Copyright © 2009-2012 Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright © 2010 IBM
|
||||
Copyright © 2010 Jirka Hladky
|
||||
Copyright © 2012 Aleksej Saushev, The NetBSD Foundation
|
||||
Copyright © 2012 Blue Brain Project, EPFL. All rights reserved.
|
||||
Copyright © 2013-2014 University of Wisconsin-La Crosse. All rights reserved.
|
||||
Copyright © 2015 Research Organization for Information Science and Technology (RIST). All rights reserved.
|
||||
Copyright © 2015-2016 Intel, Inc. All rights reserved.
|
||||
See COPYING in top-level directory.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
1755
src/3rdparty/hwloc/NEWS
vendored
1755
src/3rdparty/hwloc/NEWS
vendored
File diff suppressed because it is too large
Load Diff
85
src/3rdparty/hwloc/README
vendored
85
src/3rdparty/hwloc/README
vendored
@@ -1,85 +0,0 @@
|
||||
Introduction
|
||||
|
||||
The Hardware Locality (hwloc) software project aims at easing the process of
|
||||
discovering hardware resources in parallel architectures. It offers
|
||||
command-line tools and a C API for consulting these resources, their locality,
|
||||
attributes, and interconnection. hwloc primarily aims at helping
|
||||
high-performance computing (HPC) applications, but is also applicable to any
|
||||
project seeking to exploit code and/or data locality on modern computing
|
||||
platforms.
|
||||
|
||||
hwloc is actually made of two subprojects distributed together:
|
||||
|
||||
* The original hwloc project for describing the internals of computing nodes.
|
||||
It is described in details starting at section Hardware Locality (hwloc)
|
||||
Introduction.
|
||||
* The network-oriented companion called netloc (Network Locality), described
|
||||
in details starting with section Network Locality (netloc).
|
||||
|
||||
See also the Related pages tab above for links to other sections.
|
||||
|
||||
Netloc may be disabled, but the original hwloc cannot. Both hwloc and netloc
|
||||
APIs are documented after these sections.
|
||||
|
||||
Installation
|
||||
|
||||
hwloc (http://www.open-mpi.org/projects/hwloc/) is available under the BSD
|
||||
license. It is hosted as a sub-project of the overall Open MPI project (http://
|
||||
www.open-mpi.org/). Note that hwloc does not require any functionality from
|
||||
Open MPI -- it is a wholly separate (and much smaller!) project and code base.
|
||||
It just happens to be hosted as part of the overall Open MPI project.
|
||||
|
||||
Basic Installation
|
||||
|
||||
Installation is the fairly common GNU-based process:
|
||||
|
||||
shell$ ./configure --prefix=...
|
||||
shell$ make
|
||||
shell$ make install
|
||||
|
||||
hwloc- and netloc-specific configure options and requirements are documented in
|
||||
sections hwloc Installation and Netloc Installation respectively.
|
||||
|
||||
Also note that if you install supplemental libraries in non-standard locations,
|
||||
hwloc's configure script may not be able to find them without some help. You
|
||||
may need to specify additional CPPFLAGS, LDFLAGS, or PKG_CONFIG_PATH values on
|
||||
the configure command line.
|
||||
|
||||
For example, if libpciaccess was installed into /opt/pciaccess, hwloc's
|
||||
configure script may not find it be default. Try adding PKG_CONFIG_PATH to the
|
||||
./configure command line, like this:
|
||||
|
||||
./configure PKG_CONFIG_PATH=/opt/pciaccess/lib/pkgconfig ...
|
||||
|
||||
Running the "lstopo" tool is a good way to check as a graphical output whether
|
||||
hwloc properly detected the architecture of your node. Netloc command-line
|
||||
tools can be used to display the network topology interconnecting your nodes.
|
||||
|
||||
Installing from a Git clone
|
||||
|
||||
Additionally, the code can be directly cloned from Git:
|
||||
|
||||
shell$ git clone https://github.com/open-mpi/hwloc.git
|
||||
shell$ cd hwloc
|
||||
shell$ ./autogen.sh
|
||||
|
||||
Note that GNU Autoconf >=2.63, Automake >=1.11 and Libtool >=2.2.6 are required
|
||||
when building from a Git clone.
|
||||
|
||||
Nightly development snapshots are available on the web site, they can be
|
||||
configured and built without any need for Git or GNU Autotools.
|
||||
|
||||
Questions and Bugs
|
||||
|
||||
Bugs should be reported in the tracker (https://github.com/open-mpi/hwloc/
|
||||
issues). Opening a new issue automatically displays lots of hints about how to
|
||||
debug and report issues.
|
||||
|
||||
Questions may be sent to the users or developers mailing lists (http://
|
||||
www.open-mpi.org/community/lists/hwloc.php).
|
||||
|
||||
There is also a #hwloc IRC channel on Freenode (irc.freenode.net).
|
||||
|
||||
|
||||
|
||||
See https://www.open-mpi.org/projects/hwloc/doc/ for more hwloc documentation.
|
||||
47
src/3rdparty/hwloc/VERSION
vendored
47
src/3rdparty/hwloc/VERSION
vendored
@@ -1,47 +0,0 @@
|
||||
# This is the VERSION file for hwloc, describing the precise version
|
||||
# of hwloc in this distribution. The various components of the version
|
||||
# number below are combined to form a single version number string.
|
||||
|
||||
# major, minor, and release are generally combined in the form
|
||||
# <major>.<minor>.<release>. If release is zero, then it is omitted.
|
||||
|
||||
# Please update HWLOC_VERSION* in contrib/windows/hwloc_config.h too.
|
||||
|
||||
major=2
|
||||
minor=2
|
||||
release=0
|
||||
|
||||
# greek is used for alpha or beta release tags. If it is non-empty,
|
||||
# it will be appended to the version number. It does not have to be
|
||||
# numeric. Common examples include a1 (alpha release 1), b1 (beta
|
||||
# release 1), sc2005 (Super Computing 2005 release). The only
|
||||
# requirement is that it must be entirely printable ASCII characters
|
||||
# and have no white space.
|
||||
|
||||
greek=
|
||||
|
||||
# The date when this release was created
|
||||
|
||||
date="Mar 30, 2020"
|
||||
|
||||
# If snapshot=1, then use the value from snapshot_version as the
|
||||
# entire hwloc version (i.e., ignore major, minor, release, and
|
||||
# greek). This is only set to 1 when making snapshot tarballs.
|
||||
snapshot=0
|
||||
snapshot_version=${major}.${minor}.${release}${greek}-git
|
||||
|
||||
# The shared library version of hwloc's public library. This version
|
||||
# is maintained in accordance with the "Library Interface Versions"
|
||||
# chapter from the GNU Libtool documentation. Notes:
|
||||
|
||||
# 1. Since version numbers are associated with *releases*, the version
|
||||
# number maintained on the hwloc git master (and developer branches)
|
||||
# is always 0:0:0.
|
||||
|
||||
# 2. Version numbers are described in the Libtool current:revision:age
|
||||
# format.
|
||||
|
||||
libhwloc_so_version=17:0:2
|
||||
libnetloc_so_version=0:0:0
|
||||
|
||||
# Please also update the <TargetName> lines in contrib/windows/libhwloc.vcxproj
|
||||
2401
src/3rdparty/hwloc/include/hwloc.h
vendored
2401
src/3rdparty/hwloc/include/hwloc.h
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2019 Inria. All rights reserved.
|
||||
* Copyright © 2009-2012 Université Bordeaux
|
||||
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/* The configuration file */
|
||||
|
||||
#ifndef HWLOC_CONFIG_H
|
||||
#define HWLOC_CONFIG_H
|
||||
|
||||
#define HWLOC_VERSION "2.2.0"
|
||||
#define HWLOC_VERSION_MAJOR 2
|
||||
#define HWLOC_VERSION_MINOR 2
|
||||
#define HWLOC_VERSION_RELEASE 0
|
||||
#define HWLOC_VERSION_GREEK ""
|
||||
|
||||
#define __hwloc_restrict
|
||||
#define __hwloc_inline __inline
|
||||
|
||||
#define __hwloc_attribute_unused
|
||||
#define __hwloc_attribute_malloc
|
||||
#define __hwloc_attribute_const
|
||||
#define __hwloc_attribute_pure
|
||||
#define __hwloc_attribute_deprecated
|
||||
#define __hwloc_attribute_may_alias
|
||||
#define __hwloc_attribute_warn_unused_result
|
||||
|
||||
/* Defined to 1 if you have the `windows.h' header. */
|
||||
#define HWLOC_HAVE_WINDOWS_H 1
|
||||
#define hwloc_pid_t HANDLE
|
||||
#define hwloc_thread_t HANDLE
|
||||
|
||||
#include <windows.h>
|
||||
#include <BaseTsd.h>
|
||||
typedef DWORDLONG hwloc_uint64_t;
|
||||
|
||||
#if defined( _USRDLL ) /* dynamic linkage */
|
||||
#if defined( DECLSPEC_EXPORTS )
|
||||
#define HWLOC_DECLSPEC __declspec(dllexport)
|
||||
#else
|
||||
#define HWLOC_DECLSPEC __declspec(dllimport)
|
||||
#endif
|
||||
#else /* static linkage */
|
||||
#define HWLOC_DECLSPEC
|
||||
#endif
|
||||
|
||||
/* Whether we need to re-define all the hwloc public symbols or not */
|
||||
#define HWLOC_SYM_TRANSFORM 0
|
||||
|
||||
/* The hwloc symbol prefix */
|
||||
#define HWLOC_SYM_PREFIX hwloc_
|
||||
|
||||
/* The hwloc symbol prefix in all caps */
|
||||
#define HWLOC_SYM_PREFIX_CAPS HWLOC_
|
||||
|
||||
#endif /* HWLOC_CONFIG_H */
|
||||
494
src/3rdparty/hwloc/include/hwloc/bitmap.h
vendored
494
src/3rdparty/hwloc/include/hwloc/bitmap.h
vendored
@@ -1,494 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2018 Inria. All rights reserved.
|
||||
* Copyright © 2009-2012 Université Bordeaux
|
||||
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief The bitmap API, for use in hwloc itself.
|
||||
*/
|
||||
|
||||
#ifndef HWLOC_BITMAP_H
|
||||
#define HWLOC_BITMAP_H
|
||||
|
||||
#include "hwloc/autogen/config.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/** \defgroup hwlocality_bitmap The bitmap API
|
||||
*
|
||||
* The ::hwloc_bitmap_t type represents a set of integers (positive or null).
|
||||
* A bitmap may be of infinite size (all bits are set after some point).
|
||||
* A bitmap may even be full if all bits are set.
|
||||
*
|
||||
* Bitmaps are used by hwloc for sets of OS processors
|
||||
* (which may actually be hardware threads) as by ::hwloc_cpuset_t
|
||||
* (a typedef for ::hwloc_bitmap_t), or sets of NUMA memory nodes
|
||||
* as ::hwloc_nodeset_t (also a typedef for ::hwloc_bitmap_t).
|
||||
* Those are used for cpuset and nodeset fields in the ::hwloc_obj structure,
|
||||
* see \ref hwlocality_object_sets.
|
||||
*
|
||||
* <em>Both CPU and node sets are always indexed by OS physical number.</em>
|
||||
* However users should usually not build CPU and node sets manually
|
||||
* (e.g. with hwloc_bitmap_set()).
|
||||
* One should rather use existing object sets and combine them with
|
||||
* hwloc_bitmap_or(), etc.
|
||||
* For instance, binding the current thread on a pair of cores may be performed with:
|
||||
* \code
|
||||
* hwloc_obj_t core1 = ... , core2 = ... ;
|
||||
* hwloc_bitmap_t set = hwloc_bitmap_alloc();
|
||||
* hwloc_bitmap_or(set, core1->cpuset, core2->cpuset);
|
||||
* hwloc_set_cpubind(topology, set, HWLOC_CPUBIND_THREAD);
|
||||
* hwloc_bitmap_free(set);
|
||||
* \endcode
|
||||
*
|
||||
* \note Most functions below return an int that may be negative in case of
|
||||
* error. The usual error case would be an internal failure to realloc/extend
|
||||
* the storage of the bitmap (\p errno would be set to \c ENOMEM).
|
||||
*
|
||||
* \note Several examples of using the bitmap API are available under the
|
||||
* doc/examples/ directory in the source tree.
|
||||
* Regression tests such as tests/hwloc/hwloc_bitmap*.c also make intensive use
|
||||
* of this API.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** \brief
|
||||
* Set of bits represented as an opaque pointer to an internal bitmap.
|
||||
*/
|
||||
typedef struct hwloc_bitmap_s * hwloc_bitmap_t;
|
||||
/** \brief a non-modifiable ::hwloc_bitmap_t */
|
||||
typedef const struct hwloc_bitmap_s * hwloc_const_bitmap_t;
|
||||
|
||||
|
||||
/*
|
||||
* Bitmap allocation, freeing and copying.
|
||||
*/
|
||||
|
||||
/** \brief Allocate a new empty bitmap.
|
||||
*
|
||||
* \returns A valid bitmap or \c NULL.
|
||||
*
|
||||
* The bitmap should be freed by a corresponding call to
|
||||
* hwloc_bitmap_free().
|
||||
*/
|
||||
HWLOC_DECLSPEC hwloc_bitmap_t hwloc_bitmap_alloc(void) __hwloc_attribute_malloc;
|
||||
|
||||
/** \brief Allocate a new full bitmap. */
|
||||
HWLOC_DECLSPEC hwloc_bitmap_t hwloc_bitmap_alloc_full(void) __hwloc_attribute_malloc;
|
||||
|
||||
/** \brief Free bitmap \p bitmap.
|
||||
*
|
||||
* If \p bitmap is \c NULL, no operation is performed.
|
||||
*/
|
||||
HWLOC_DECLSPEC void hwloc_bitmap_free(hwloc_bitmap_t bitmap);
|
||||
|
||||
/** \brief Duplicate bitmap \p bitmap by allocating a new bitmap and copying \p bitmap contents.
|
||||
*
|
||||
* If \p bitmap is \c NULL, \c NULL is returned.
|
||||
*/
|
||||
HWLOC_DECLSPEC hwloc_bitmap_t hwloc_bitmap_dup(hwloc_const_bitmap_t bitmap) __hwloc_attribute_malloc;
|
||||
|
||||
/** \brief Copy the contents of bitmap \p src into the already allocated bitmap \p dst */
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_copy(hwloc_bitmap_t dst, hwloc_const_bitmap_t src);
|
||||
|
||||
|
||||
/*
|
||||
* Bitmap/String Conversion
|
||||
*/
|
||||
|
||||
/** \brief Stringify a bitmap.
|
||||
*
|
||||
* Up to \p buflen characters may be written in buffer \p buf.
|
||||
*
|
||||
* If \p buflen is 0, \p buf may safely be \c NULL.
|
||||
*
|
||||
* \return the number of character that were actually written if not truncating,
|
||||
* or that would have been written (not including the ending \\0).
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_snprintf(char * __hwloc_restrict buf, size_t buflen, hwloc_const_bitmap_t bitmap);
|
||||
|
||||
/** \brief Stringify a bitmap into a newly allocated string.
|
||||
*
|
||||
* \return -1 on error.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_asprintf(char ** strp, hwloc_const_bitmap_t bitmap);
|
||||
|
||||
/** \brief Parse a bitmap string and stores it in bitmap \p bitmap.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_sscanf(hwloc_bitmap_t bitmap, const char * __hwloc_restrict string);
|
||||
|
||||
/** \brief Stringify a bitmap in the list format.
|
||||
*
|
||||
* Lists are comma-separated indexes or ranges.
|
||||
* Ranges are dash separated indexes.
|
||||
* The last range may not have an ending indexes if the bitmap is infinitely set.
|
||||
*
|
||||
* Up to \p buflen characters may be written in buffer \p buf.
|
||||
*
|
||||
* If \p buflen is 0, \p buf may safely be \c NULL.
|
||||
*
|
||||
* \return the number of character that were actually written if not truncating,
|
||||
* or that would have been written (not including the ending \\0).
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_list_snprintf(char * __hwloc_restrict buf, size_t buflen, hwloc_const_bitmap_t bitmap);
|
||||
|
||||
/** \brief Stringify a bitmap into a newly allocated list string.
|
||||
*
|
||||
* \return -1 on error.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_list_asprintf(char ** strp, hwloc_const_bitmap_t bitmap);
|
||||
|
||||
/** \brief Parse a list string and stores it in bitmap \p bitmap.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_list_sscanf(hwloc_bitmap_t bitmap, const char * __hwloc_restrict string);
|
||||
|
||||
/** \brief Stringify a bitmap in the taskset-specific format.
|
||||
*
|
||||
* The taskset command manipulates bitmap strings that contain a single
|
||||
* (possible very long) hexadecimal number starting with 0x.
|
||||
*
|
||||
* Up to \p buflen characters may be written in buffer \p buf.
|
||||
*
|
||||
* If \p buflen is 0, \p buf may safely be \c NULL.
|
||||
*
|
||||
* \return the number of character that were actually written if not truncating,
|
||||
* or that would have been written (not including the ending \\0).
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_taskset_snprintf(char * __hwloc_restrict buf, size_t buflen, hwloc_const_bitmap_t bitmap);
|
||||
|
||||
/** \brief Stringify a bitmap into a newly allocated taskset-specific string.
|
||||
*
|
||||
* \return -1 on error.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_taskset_asprintf(char ** strp, hwloc_const_bitmap_t bitmap);
|
||||
|
||||
/** \brief Parse a taskset-specific bitmap string and stores it in bitmap \p bitmap.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_taskset_sscanf(hwloc_bitmap_t bitmap, const char * __hwloc_restrict string);
|
||||
|
||||
|
||||
/*
|
||||
* Building bitmaps.
|
||||
*/
|
||||
|
||||
/** \brief Empty the bitmap \p bitmap */
|
||||
HWLOC_DECLSPEC void hwloc_bitmap_zero(hwloc_bitmap_t bitmap);
|
||||
|
||||
/** \brief Fill bitmap \p bitmap with all possible indexes (even if those objects don't exist or are otherwise unavailable) */
|
||||
HWLOC_DECLSPEC void hwloc_bitmap_fill(hwloc_bitmap_t bitmap);
|
||||
|
||||
/** \brief Empty the bitmap \p bitmap and add bit \p id */
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_only(hwloc_bitmap_t bitmap, unsigned id);
|
||||
|
||||
/** \brief Fill the bitmap \p and clear the index \p id */
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_allbut(hwloc_bitmap_t bitmap, unsigned id);
|
||||
|
||||
/** \brief Setup bitmap \p bitmap from unsigned long \p mask */
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_from_ulong(hwloc_bitmap_t bitmap, unsigned long mask);
|
||||
|
||||
/** \brief Setup bitmap \p bitmap from unsigned long \p mask used as \p i -th subset */
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_from_ith_ulong(hwloc_bitmap_t bitmap, unsigned i, unsigned long mask);
|
||||
|
||||
/** \brief Setup bitmap \p bitmap from unsigned longs \p masks used as first \p nr subsets */
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_from_ulongs(hwloc_bitmap_t bitmap, unsigned nr, const unsigned long *masks);
|
||||
|
||||
|
||||
/*
|
||||
* Modifying bitmaps.
|
||||
*/
|
||||
|
||||
/** \brief Add index \p id in bitmap \p bitmap */
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_set(hwloc_bitmap_t bitmap, unsigned id);
|
||||
|
||||
/** \brief Add indexes from \p begin to \p end in bitmap \p bitmap.
|
||||
*
|
||||
* If \p end is \c -1, the range is infinite.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_set_range(hwloc_bitmap_t bitmap, unsigned begin, int end);
|
||||
|
||||
/** \brief Replace \p i -th subset of bitmap \p bitmap with unsigned long \p mask */
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_set_ith_ulong(hwloc_bitmap_t bitmap, unsigned i, unsigned long mask);
|
||||
|
||||
/** \brief Remove index \p id from bitmap \p bitmap */
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_clr(hwloc_bitmap_t bitmap, unsigned id);
|
||||
|
||||
/** \brief Remove indexes from \p begin to \p end in bitmap \p bitmap.
|
||||
*
|
||||
* If \p end is \c -1, the range is infinite.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_clr_range(hwloc_bitmap_t bitmap, unsigned begin, int end);
|
||||
|
||||
/** \brief Keep a single index among those set in bitmap \p bitmap
|
||||
*
|
||||
* May be useful before binding so that the process does not
|
||||
* have a chance of migrating between multiple logical CPUs
|
||||
* in the original mask.
|
||||
* Instead of running the task on any PU inside the given CPU set,
|
||||
* the operating system scheduler will be forced to run it on a single
|
||||
* of these PUs.
|
||||
* It avoids a migration overhead and cache-line ping-pongs between PUs.
|
||||
*
|
||||
* \note This function is NOT meant to distribute multiple processes
|
||||
* within a single CPU set. It always return the same single bit when
|
||||
* called multiple times on the same input set. hwloc_distrib() may
|
||||
* be used for generating CPU sets to distribute multiple tasks below
|
||||
* a single multi-PU object.
|
||||
*
|
||||
* \note This function cannot be applied to an object set directly. It
|
||||
* should be applied to a copy (which may be obtained with hwloc_bitmap_dup()).
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_singlify(hwloc_bitmap_t bitmap);
|
||||
|
||||
|
||||
/*
|
||||
* Consulting bitmaps.
|
||||
*/
|
||||
|
||||
/** \brief Convert the beginning part of bitmap \p bitmap into unsigned long \p mask */
|
||||
HWLOC_DECLSPEC unsigned long hwloc_bitmap_to_ulong(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
|
||||
|
||||
/** \brief Convert the \p i -th subset of bitmap \p bitmap into unsigned long mask */
|
||||
HWLOC_DECLSPEC unsigned long hwloc_bitmap_to_ith_ulong(hwloc_const_bitmap_t bitmap, unsigned i) __hwloc_attribute_pure;
|
||||
|
||||
/** \brief Convert the first \p nr subsets of bitmap \p bitmap into the array of \p nr unsigned long \p masks
|
||||
*
|
||||
* \p nr may be determined earlier with hwloc_bitmap_nr_ulongs().
|
||||
*
|
||||
* \return 0
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_to_ulongs(hwloc_const_bitmap_t bitmap, unsigned nr, unsigned long *masks);
|
||||
|
||||
/** \brief Return the number of unsigned longs required for storing bitmap \p bitmap entirely
|
||||
*
|
||||
* This is the number of contiguous unsigned longs from the very first bit of the bitmap
|
||||
* (even if unset) up to the last set bit.
|
||||
* This is useful for knowing the \p nr parameter to pass to hwloc_bitmap_to_ulongs()
|
||||
* (or which calls to hwloc_bitmap_to_ith_ulong() are needed)
|
||||
* to entirely convert a bitmap into multiple unsigned longs.
|
||||
*
|
||||
* When called on the output of hwloc_topology_get_topology_cpuset(),
|
||||
* the returned number is large enough for all cpusets of the topology.
|
||||
*
|
||||
* \return -1 if \p bitmap is infinite.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_nr_ulongs(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
|
||||
|
||||
/** \brief Test whether index \p id is part of bitmap \p bitmap.
|
||||
*
|
||||
* \return 1 if the bit at index \p id is set in bitmap \p bitmap, 0 otherwise.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_isset(hwloc_const_bitmap_t bitmap, unsigned id) __hwloc_attribute_pure;
|
||||
|
||||
/** \brief Test whether bitmap \p bitmap is empty
|
||||
*
|
||||
* \return 1 if bitmap is empty, 0 otherwise.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_iszero(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
|
||||
|
||||
/** \brief Test whether bitmap \p bitmap is completely full
|
||||
*
|
||||
* \return 1 if bitmap is full, 0 otherwise.
|
||||
*
|
||||
* \note A full bitmap is always infinitely set.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_isfull(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
|
||||
|
||||
/** \brief Compute the first index (least significant bit) in bitmap \p bitmap
|
||||
*
|
||||
* \return -1 if no index is set in \p bitmap.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_first(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
|
||||
|
||||
/** \brief Compute the next index in bitmap \p bitmap which is after index \p prev
|
||||
*
|
||||
* If \p prev is -1, the first index is returned.
|
||||
*
|
||||
* \return -1 if no index with higher index is set in \p bitmap.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_next(hwloc_const_bitmap_t bitmap, int prev) __hwloc_attribute_pure;
|
||||
|
||||
/** \brief Compute the last index (most significant bit) in bitmap \p bitmap
|
||||
*
|
||||
* \return -1 if no index is set in \p bitmap, or if \p bitmap is infinitely set.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_last(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
|
||||
|
||||
/** \brief Compute the "weight" of bitmap \p bitmap (i.e., number of
|
||||
* indexes that are in the bitmap).
|
||||
*
|
||||
* \return the number of indexes that are in the bitmap.
|
||||
*
|
||||
* \return -1 if \p bitmap is infinitely set.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_weight(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
|
||||
|
||||
/** \brief Compute the first unset index (least significant bit) in bitmap \p bitmap
|
||||
*
|
||||
* \return -1 if no index is unset in \p bitmap.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_first_unset(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
|
||||
|
||||
/** \brief Compute the next unset index in bitmap \p bitmap which is after index \p prev
|
||||
*
|
||||
* If \p prev is -1, the first unset index is returned.
|
||||
*
|
||||
* \return -1 if no index with higher index is unset in \p bitmap.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_next_unset(hwloc_const_bitmap_t bitmap, int prev) __hwloc_attribute_pure;
|
||||
|
||||
/** \brief Compute the last unset index (most significant bit) in bitmap \p bitmap
|
||||
*
|
||||
* \return -1 if no index is unset in \p bitmap, or if \p bitmap is infinitely set.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_last_unset(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
|
||||
|
||||
/** \brief Loop macro iterating on bitmap \p bitmap
|
||||
*
|
||||
* The loop must start with hwloc_bitmap_foreach_begin() and end
|
||||
* with hwloc_bitmap_foreach_end() followed by a terminating ';'.
|
||||
*
|
||||
* \p index is the loop variable; it should be an unsigned int. The
|
||||
* first iteration will set \p index to the lowest index in the bitmap.
|
||||
* Successive iterations will iterate through, in order, all remaining
|
||||
* indexes set in the bitmap. To be specific: each iteration will return a
|
||||
* value for \p index such that hwloc_bitmap_isset(bitmap, index) is true.
|
||||
*
|
||||
* The assert prevents the loop from being infinite if the bitmap is infinitely set.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define hwloc_bitmap_foreach_begin(id, bitmap) \
|
||||
do { \
|
||||
assert(hwloc_bitmap_weight(bitmap) != -1); \
|
||||
for (id = hwloc_bitmap_first(bitmap); \
|
||||
(unsigned) id != (unsigned) -1; \
|
||||
id = hwloc_bitmap_next(bitmap, id)) {
|
||||
|
||||
/** \brief End of loop macro iterating on a bitmap.
|
||||
*
|
||||
* Needs a terminating ';'.
|
||||
*
|
||||
* \sa hwloc_bitmap_foreach_begin()
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define hwloc_bitmap_foreach_end() \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
/*
|
||||
* Combining bitmaps.
|
||||
*/
|
||||
|
||||
/** \brief Or bitmaps \p bitmap1 and \p bitmap2 and store the result in bitmap \p res
|
||||
*
|
||||
* \p res can be the same as \p bitmap1 or \p bitmap2
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_or (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2);
|
||||
|
||||
/** \brief And bitmaps \p bitmap1 and \p bitmap2 and store the result in bitmap \p res
|
||||
*
|
||||
* \p res can be the same as \p bitmap1 or \p bitmap2
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_and (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2);
|
||||
|
||||
/** \brief And bitmap \p bitmap1 and the negation of \p bitmap2 and store the result in bitmap \p res
|
||||
*
|
||||
* \p res can be the same as \p bitmap1 or \p bitmap2
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_andnot (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2);
|
||||
|
||||
/** \brief Xor bitmaps \p bitmap1 and \p bitmap2 and store the result in bitmap \p res
|
||||
*
|
||||
* \p res can be the same as \p bitmap1 or \p bitmap2
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_xor (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2);
|
||||
|
||||
/** \brief Negate bitmap \p bitmap and store the result in bitmap \p res
|
||||
*
|
||||
* \p res can be the same as \p bitmap
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_not (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap);
|
||||
|
||||
|
||||
/*
|
||||
* Comparing bitmaps.
|
||||
*/
|
||||
|
||||
/** \brief Test whether bitmaps \p bitmap1 and \p bitmap2 intersects.
|
||||
*
|
||||
* \return 1 if bitmaps intersect, 0 otherwise.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_intersects (hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) __hwloc_attribute_pure;
|
||||
|
||||
/** \brief Test whether bitmap \p sub_bitmap is part of bitmap \p super_bitmap.
|
||||
*
|
||||
* \return 1 if \p sub_bitmap is included in \p super_bitmap, 0 otherwise.
|
||||
*
|
||||
* \note The empty bitmap is considered included in any other bitmap.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_isincluded (hwloc_const_bitmap_t sub_bitmap, hwloc_const_bitmap_t super_bitmap) __hwloc_attribute_pure;
|
||||
|
||||
/** \brief Test whether bitmap \p bitmap1 is equal to bitmap \p bitmap2.
|
||||
*
|
||||
* \return 1 if bitmaps are equal, 0 otherwise.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_isequal (hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) __hwloc_attribute_pure;
|
||||
|
||||
/** \brief Compare bitmaps \p bitmap1 and \p bitmap2 using their lowest index.
|
||||
*
|
||||
* A bitmap is considered smaller if its least significant bit is smaller.
|
||||
* The empty bitmap is considered higher than anything (because its least significant bit does not exist).
|
||||
*
|
||||
* \return -1 if \p bitmap1 is considered smaller than \p bitmap2.
|
||||
* \return 1 if \p bitmap1 is considered larger than \p bitmap2.
|
||||
*
|
||||
* For instance comparing binary bitmaps 0011 and 0110 returns -1
|
||||
* (hence 0011 is considered smaller than 0110)
|
||||
* because least significant bit of 0011 (0001) is smaller than least significant bit of 0110 (0010).
|
||||
* Comparing 01001 and 00110 would also return -1 for the same reason.
|
||||
*
|
||||
* \return 0 if bitmaps are considered equal, even if they are not strictly equal.
|
||||
* They just need to have the same least significant bit.
|
||||
* For instance, comparing binary bitmaps 0010 and 0110 returns 0 because they have the same least significant bit.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_compare_first(hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) __hwloc_attribute_pure;
|
||||
|
||||
/** \brief Compare bitmaps \p bitmap1 and \p bitmap2 in lexicographic order.
|
||||
*
|
||||
* Lexicographic comparison of bitmaps, starting for their highest indexes.
|
||||
* Compare last indexes first, then second, etc.
|
||||
* The empty bitmap is considered lower than anything.
|
||||
*
|
||||
* \return -1 if \p bitmap1 is considered smaller than \p bitmap2.
|
||||
* \return 1 if \p bitmap1 is considered larger than \p bitmap2.
|
||||
* \return 0 if bitmaps are equal (contrary to hwloc_bitmap_compare_first()).
|
||||
*
|
||||
* For instance comparing binary bitmaps 0011 and 0110 returns -1
|
||||
* (hence 0011 is considered smaller than 0110).
|
||||
* Comparing 00101 and 01010 returns -1 too.
|
||||
*
|
||||
* \note This is different from the non-existing hwloc_bitmap_compare_last()
|
||||
* which would only compare the highest index of each bitmap.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_compare(hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) __hwloc_attribute_pure;
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* HWLOC_BITMAP_H */
|
||||
220
src/3rdparty/hwloc/include/hwloc/cuda.h
vendored
220
src/3rdparty/hwloc/include/hwloc/cuda.h
vendored
@@ -1,220 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2010-2017 Inria. All rights reserved.
|
||||
* Copyright © 2010-2011 Université Bordeaux
|
||||
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Macros to help interaction between hwloc and the CUDA Driver API.
|
||||
*
|
||||
* Applications that use both hwloc and the CUDA Driver API may want to
|
||||
* include this file so as to get topology information for CUDA devices.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HWLOC_CUDA_H
|
||||
#define HWLOC_CUDA_H
|
||||
|
||||
#include "hwloc.h"
|
||||
#include "hwloc/autogen/config.h"
|
||||
#include "hwloc/helper.h"
|
||||
#ifdef HWLOC_LINUX_SYS
|
||||
#include "hwloc/linux.h"
|
||||
#endif
|
||||
|
||||
#include <cuda.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/** \defgroup hwlocality_cuda Interoperability with the CUDA Driver API
|
||||
*
|
||||
* This interface offers ways to retrieve topology information about
|
||||
* CUDA devices when using the CUDA Driver API.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Return the domain, bus and device IDs of the CUDA device \p cudevice.
|
||||
*
|
||||
* Device \p cudevice must match the local machine.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_cuda_get_device_pci_ids(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||
CUdevice cudevice, int *domain, int *bus, int *dev)
|
||||
{
|
||||
CUresult cres;
|
||||
|
||||
#if CUDA_VERSION >= 4000
|
||||
cres = cuDeviceGetAttribute(domain, CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID, cudevice);
|
||||
if (cres != CUDA_SUCCESS) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
*domain = 0;
|
||||
#endif
|
||||
cres = cuDeviceGetAttribute(bus, CU_DEVICE_ATTRIBUTE_PCI_BUS_ID, cudevice);
|
||||
if (cres != CUDA_SUCCESS) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
cres = cuDeviceGetAttribute(dev, CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID, cudevice);
|
||||
if (cres != CUDA_SUCCESS) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** \brief Get the CPU set of logical processors that are physically
|
||||
* close to device \p cudevice.
|
||||
*
|
||||
* Return the CPU set describing the locality of the CUDA device \p cudevice.
|
||||
*
|
||||
* Topology \p topology and device \p cudevice must match the local machine.
|
||||
* I/O devices detection and the CUDA component are not needed in the topology.
|
||||
*
|
||||
* The function only returns the locality of the device.
|
||||
* If more information about the device is needed, OS objects should
|
||||
* be used instead, see hwloc_cuda_get_device_osdev()
|
||||
* and hwloc_cuda_get_device_osdev_by_index().
|
||||
*
|
||||
* This function is currently only implemented in a meaningful way for
|
||||
* Linux; other systems will simply get a full cpuset.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_cuda_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||
CUdevice cudevice, hwloc_cpuset_t set)
|
||||
{
|
||||
#ifdef HWLOC_LINUX_SYS
|
||||
/* If we're on Linux, use the sysfs mechanism to get the local cpus */
|
||||
#define HWLOC_CUDA_DEVICE_SYSFS_PATH_MAX 128
|
||||
char path[HWLOC_CUDA_DEVICE_SYSFS_PATH_MAX];
|
||||
int domainid, busid, deviceid;
|
||||
|
||||
if (hwloc_cuda_get_device_pci_ids(topology, cudevice, &domainid, &busid, &deviceid))
|
||||
return -1;
|
||||
|
||||
if (!hwloc_topology_is_thissystem(topology)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
sprintf(path, "/sys/bus/pci/devices/%04x:%02x:%02x.0/local_cpus", domainid, busid, deviceid);
|
||||
if (hwloc_linux_read_path_as_cpumask(path, set) < 0
|
||||
|| hwloc_bitmap_iszero(set))
|
||||
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||
#else
|
||||
/* Non-Linux systems simply get a full cpuset */
|
||||
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** \brief Get the hwloc PCI device object corresponding to the
|
||||
* CUDA device \p cudevice.
|
||||
*
|
||||
* Return the PCI device object describing the CUDA device \p cudevice.
|
||||
* Return NULL if there is none.
|
||||
*
|
||||
* Topology \p topology and device \p cudevice must match the local machine.
|
||||
* I/O devices detection must be enabled in topology \p topology.
|
||||
* The CUDA component is not needed in the topology.
|
||||
*/
|
||||
static __hwloc_inline hwloc_obj_t
|
||||
hwloc_cuda_get_device_pcidev(hwloc_topology_t topology, CUdevice cudevice)
|
||||
{
|
||||
int domain, bus, dev;
|
||||
|
||||
if (hwloc_cuda_get_device_pci_ids(topology, cudevice, &domain, &bus, &dev))
|
||||
return NULL;
|
||||
|
||||
return hwloc_get_pcidev_by_busid(topology, domain, bus, dev, 0);
|
||||
}
|
||||
|
||||
/** \brief Get the hwloc OS device object corresponding to CUDA device \p cudevice.
|
||||
*
|
||||
* Return the hwloc OS device object that describes the given
|
||||
* CUDA device \p cudevice. Return NULL if there is none.
|
||||
*
|
||||
* Topology \p topology and device \p cudevice must match the local machine.
|
||||
* I/O devices detection and the CUDA component must be enabled in the topology.
|
||||
* If not, the locality of the object may still be found using
|
||||
* hwloc_cuda_get_device_cpuset().
|
||||
*
|
||||
* \note This function cannot work if PCI devices are filtered out.
|
||||
*
|
||||
* \note The corresponding hwloc PCI device may be found by looking
|
||||
* at the result parent pointer (unless PCI devices are filtered out).
|
||||
*/
|
||||
static __hwloc_inline hwloc_obj_t
|
||||
hwloc_cuda_get_device_osdev(hwloc_topology_t topology, CUdevice cudevice)
|
||||
{
|
||||
hwloc_obj_t osdev = NULL;
|
||||
int domain, bus, dev;
|
||||
|
||||
if (hwloc_cuda_get_device_pci_ids(topology, cudevice, &domain, &bus, &dev))
|
||||
return NULL;
|
||||
|
||||
osdev = NULL;
|
||||
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
|
||||
hwloc_obj_t pcidev = osdev->parent;
|
||||
if (strncmp(osdev->name, "cuda", 4))
|
||||
continue;
|
||||
if (pcidev
|
||||
&& pcidev->type == HWLOC_OBJ_PCI_DEVICE
|
||||
&& (int) pcidev->attr->pcidev.domain == domain
|
||||
&& (int) pcidev->attr->pcidev.bus == bus
|
||||
&& (int) pcidev->attr->pcidev.dev == dev
|
||||
&& pcidev->attr->pcidev.func == 0)
|
||||
return osdev;
|
||||
/* if PCI are filtered out, we need a info attr to match on */
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** \brief Get the hwloc OS device object corresponding to the
|
||||
* CUDA device whose index is \p idx.
|
||||
*
|
||||
* Return the OS device object describing the CUDA device whose
|
||||
* index is \p idx. Return NULL if there is none.
|
||||
*
|
||||
* The topology \p topology does not necessarily have to match the current
|
||||
* machine. For instance the topology may be an XML import of a remote host.
|
||||
* I/O devices detection and the CUDA component must be enabled in the topology.
|
||||
*
|
||||
* \note The corresponding PCI device object can be obtained by looking
|
||||
* at the OS device parent object (unless PCI devices are filtered out).
|
||||
*
|
||||
* \note This function is identical to hwloc_cudart_get_device_osdev_by_index().
|
||||
*/
|
||||
static __hwloc_inline hwloc_obj_t
|
||||
hwloc_cuda_get_device_osdev_by_index(hwloc_topology_t topology, unsigned idx)
|
||||
{
|
||||
hwloc_obj_t osdev = NULL;
|
||||
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
|
||||
if (HWLOC_OBJ_OSDEV_COPROC == osdev->attr->osdev.type
|
||||
&& osdev->name
|
||||
&& !strncmp("cuda", osdev->name, 4)
|
||||
&& atoi(osdev->name + 4) == (int) idx)
|
||||
return osdev;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* HWLOC_CUDA_H */
|
||||
177
src/3rdparty/hwloc/include/hwloc/cudart.h
vendored
177
src/3rdparty/hwloc/include/hwloc/cudart.h
vendored
@@ -1,177 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2010-2017 Inria. All rights reserved.
|
||||
* Copyright © 2010-2011 Université Bordeaux
|
||||
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Macros to help interaction between hwloc and the CUDA Runtime API.
|
||||
*
|
||||
* Applications that use both hwloc and the CUDA Runtime API may want to
|
||||
* include this file so as to get topology information for CUDA devices.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HWLOC_CUDART_H
|
||||
#define HWLOC_CUDART_H
|
||||
|
||||
#include "hwloc.h"
|
||||
#include "hwloc/autogen/config.h"
|
||||
#include "hwloc/helper.h"
|
||||
#ifdef HWLOC_LINUX_SYS
|
||||
#include "hwloc/linux.h"
|
||||
#endif
|
||||
|
||||
#include <cuda.h> /* for CUDA_VERSION */
|
||||
#include <cuda_runtime_api.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/** \defgroup hwlocality_cudart Interoperability with the CUDA Runtime API
|
||||
*
|
||||
* This interface offers ways to retrieve topology information about
|
||||
* CUDA devices when using the CUDA Runtime API.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Return the domain, bus and device IDs of the CUDA device whose index is \p idx.
|
||||
*
|
||||
* Device index \p idx must match the local machine.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_cudart_get_device_pci_ids(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||
int idx, int *domain, int *bus, int *dev)
|
||||
{
|
||||
cudaError_t cerr;
|
||||
struct cudaDeviceProp prop;
|
||||
|
||||
cerr = cudaGetDeviceProperties(&prop, idx);
|
||||
if (cerr) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if CUDA_VERSION >= 4000
|
||||
*domain = prop.pciDomainID;
|
||||
#else
|
||||
*domain = 0;
|
||||
#endif
|
||||
|
||||
*bus = prop.pciBusID;
|
||||
*dev = prop.pciDeviceID;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** \brief Get the CPU set of logical processors that are physically
|
||||
* close to device \p idx.
|
||||
*
|
||||
* Return the CPU set describing the locality of the CUDA device
|
||||
* whose index is \p idx.
|
||||
*
|
||||
* Topology \p topology and device \p idx must match the local machine.
|
||||
* I/O devices detection and the CUDA component are not needed in the topology.
|
||||
*
|
||||
* The function only returns the locality of the device.
|
||||
* If more information about the device is needed, OS objects should
|
||||
* be used instead, see hwloc_cudart_get_device_osdev_by_index().
|
||||
*
|
||||
* This function is currently only implemented in a meaningful way for
|
||||
* Linux; other systems will simply get a full cpuset.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_cudart_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||
int idx, hwloc_cpuset_t set)
|
||||
{
|
||||
#ifdef HWLOC_LINUX_SYS
|
||||
/* If we're on Linux, use the sysfs mechanism to get the local cpus */
|
||||
#define HWLOC_CUDART_DEVICE_SYSFS_PATH_MAX 128
|
||||
char path[HWLOC_CUDART_DEVICE_SYSFS_PATH_MAX];
|
||||
int domain, bus, dev;
|
||||
|
||||
if (hwloc_cudart_get_device_pci_ids(topology, idx, &domain, &bus, &dev))
|
||||
return -1;
|
||||
|
||||
if (!hwloc_topology_is_thissystem(topology)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
sprintf(path, "/sys/bus/pci/devices/%04x:%02x:%02x.0/local_cpus", (unsigned) domain, (unsigned) bus, (unsigned) dev);
|
||||
if (hwloc_linux_read_path_as_cpumask(path, set) < 0
|
||||
|| hwloc_bitmap_iszero(set))
|
||||
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||
#else
|
||||
/* Non-Linux systems simply get a full cpuset */
|
||||
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** \brief Get the hwloc PCI device object corresponding to the
|
||||
* CUDA device whose index is \p idx.
|
||||
*
|
||||
* Return the PCI device object describing the CUDA device whose
|
||||
* index is \p idx. Return NULL if there is none.
|
||||
*
|
||||
* Topology \p topology and device \p idx must match the local machine.
|
||||
* I/O devices detection must be enabled in topology \p topology.
|
||||
* The CUDA component is not needed in the topology.
|
||||
*/
|
||||
static __hwloc_inline hwloc_obj_t
|
||||
hwloc_cudart_get_device_pcidev(hwloc_topology_t topology, int idx)
|
||||
{
|
||||
int domain, bus, dev;
|
||||
|
||||
if (hwloc_cudart_get_device_pci_ids(topology, idx, &domain, &bus, &dev))
|
||||
return NULL;
|
||||
|
||||
return hwloc_get_pcidev_by_busid(topology, domain, bus, dev, 0);
|
||||
}
|
||||
|
||||
/** \brief Get the hwloc OS device object corresponding to the
|
||||
* CUDA device whose index is \p idx.
|
||||
*
|
||||
* Return the OS device object describing the CUDA device whose
|
||||
* index is \p idx. Return NULL if there is none.
|
||||
*
|
||||
* The topology \p topology does not necessarily have to match the current
|
||||
* machine. For instance the topology may be an XML import of a remote host.
|
||||
* I/O devices detection and the CUDA component must be enabled in the topology.
|
||||
* If not, the locality of the object may still be found using
|
||||
* hwloc_cudart_get_device_cpuset().
|
||||
*
|
||||
* \note The corresponding PCI device object can be obtained by looking
|
||||
* at the OS device parent object (unless PCI devices are filtered out).
|
||||
*
|
||||
* \note This function is identical to hwloc_cuda_get_device_osdev_by_index().
|
||||
*/
|
||||
static __hwloc_inline hwloc_obj_t
|
||||
hwloc_cudart_get_device_osdev_by_index(hwloc_topology_t topology, unsigned idx)
|
||||
{
|
||||
hwloc_obj_t osdev = NULL;
|
||||
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
|
||||
if (HWLOC_OBJ_OSDEV_COPROC == osdev->attr->osdev.type
|
||||
&& osdev->name
|
||||
&& !strncmp("cuda", osdev->name, 4)
|
||||
&& atoi(osdev->name + 4) == (int) idx)
|
||||
return osdev;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* HWLOC_CUDART_H */
|
||||
208
src/3rdparty/hwloc/include/hwloc/deprecated.h
vendored
208
src/3rdparty/hwloc/include/hwloc/deprecated.h
vendored
@@ -1,208 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2018 Inria. All rights reserved.
|
||||
* Copyright © 2009-2012 Université Bordeaux
|
||||
* Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This file contains the inline code of functions declared in hwloc.h
|
||||
*/
|
||||
|
||||
#ifndef HWLOC_DEPRECATED_H
|
||||
#define HWLOC_DEPRECATED_H
|
||||
|
||||
#ifndef HWLOC_H
|
||||
#error Please include the main hwloc.h instead
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* backward compat with v2.0 before WHOLE_SYSTEM renaming */
|
||||
#define HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM HWLOC_TOPOLOGY_FLAG_INCLUDE_DISALLOWED
|
||||
/* backward compat with v1.11 before System removal */
|
||||
#define HWLOC_OBJ_SYSTEM HWLOC_OBJ_MACHINE
|
||||
/* backward compat with v1.10 before Socket->Package renaming */
|
||||
#define HWLOC_OBJ_SOCKET HWLOC_OBJ_PACKAGE
|
||||
/* backward compat with v1.10 before Node->NUMANode clarification */
|
||||
#define HWLOC_OBJ_NODE HWLOC_OBJ_NUMANODE
|
||||
|
||||
/** \brief Insert a misc object by parent.
|
||||
*
|
||||
* Identical to hwloc_topology_insert_misc_object().
|
||||
*/
|
||||
static __hwloc_inline hwloc_obj_t
|
||||
hwloc_topology_insert_misc_object_by_parent(hwloc_topology_t topology, hwloc_obj_t parent, const char *name) __hwloc_attribute_deprecated;
|
||||
static __hwloc_inline hwloc_obj_t
|
||||
hwloc_topology_insert_misc_object_by_parent(hwloc_topology_t topology, hwloc_obj_t parent, const char *name)
|
||||
{
|
||||
return hwloc_topology_insert_misc_object(topology, parent, name);
|
||||
}
|
||||
|
||||
/** \brief Stringify the cpuset containing a set of objects.
|
||||
*
|
||||
* If \p size is 0, \p string may safely be \c NULL.
|
||||
*
|
||||
* \return the number of character that were actually written if not truncating,
|
||||
* or that would have been written (not including the ending \\0).
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_obj_cpuset_snprintf(char *str, size_t size, size_t nobj, struct hwloc_obj * const *objs) __hwloc_attribute_deprecated;
|
||||
static __hwloc_inline int
|
||||
hwloc_obj_cpuset_snprintf(char *str, size_t size, size_t nobj, struct hwloc_obj * const *objs)
|
||||
{
|
||||
hwloc_bitmap_t set = hwloc_bitmap_alloc();
|
||||
int res;
|
||||
unsigned i;
|
||||
|
||||
hwloc_bitmap_zero(set);
|
||||
for(i=0; i<nobj; i++)
|
||||
if (objs[i]->cpuset)
|
||||
hwloc_bitmap_or(set, set, objs[i]->cpuset);
|
||||
|
||||
res = hwloc_bitmap_snprintf(str, size, set);
|
||||
hwloc_bitmap_free(set);
|
||||
return res;
|
||||
}
|
||||
|
||||
/** \brief Convert a type string into a type and some attributes.
|
||||
*
|
||||
* Deprecated by hwloc_type_sscanf()
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_obj_type_sscanf(const char *string, hwloc_obj_type_t *typep, int *depthattrp, void *typeattrp, size_t typeattrsize) __hwloc_attribute_deprecated;
|
||||
static __hwloc_inline int
|
||||
hwloc_obj_type_sscanf(const char *string, hwloc_obj_type_t *typep, int *depthattrp, void *typeattrp, size_t typeattrsize)
|
||||
{
|
||||
union hwloc_obj_attr_u attr;
|
||||
int err = hwloc_type_sscanf(string, typep, &attr, sizeof(attr));
|
||||
if (err < 0)
|
||||
return err;
|
||||
if (hwloc_obj_type_is_cache(*typep)) {
|
||||
if (depthattrp)
|
||||
*depthattrp = (int) attr.cache.depth;
|
||||
if (typeattrp && typeattrsize >= sizeof(hwloc_obj_cache_type_t))
|
||||
memcpy(typeattrp, &attr.cache.type, sizeof(hwloc_obj_cache_type_t));
|
||||
} else if (*typep == HWLOC_OBJ_GROUP) {
|
||||
if (depthattrp)
|
||||
*depthattrp = (int) attr.group.depth;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** \brief Set the default memory binding policy of the current
|
||||
* process or thread to prefer the NUMA node(s) specified by physical \p nodeset
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_set_membind_nodeset(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags) __hwloc_attribute_deprecated;
|
||||
static __hwloc_inline int
|
||||
hwloc_set_membind_nodeset(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
|
||||
{
|
||||
return hwloc_set_membind(topology, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
|
||||
}
|
||||
|
||||
/** \brief Query the default memory binding policy and physical locality of the
|
||||
* current process or thread.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_get_membind_nodeset(hwloc_topology_t topology, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags) __hwloc_attribute_deprecated;
|
||||
static __hwloc_inline int
|
||||
hwloc_get_membind_nodeset(hwloc_topology_t topology, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags)
|
||||
{
|
||||
return hwloc_get_membind(topology, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
|
||||
}
|
||||
|
||||
/** \brief Set the default memory binding policy of the specified
|
||||
* process to prefer the NUMA node(s) specified by physical \p nodeset
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_set_proc_membind_nodeset(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags) __hwloc_attribute_deprecated;
|
||||
static __hwloc_inline int
|
||||
hwloc_set_proc_membind_nodeset(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
|
||||
{
|
||||
return hwloc_set_proc_membind(topology, pid, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
|
||||
}
|
||||
|
||||
/** \brief Query the default memory binding policy and physical locality of the
|
||||
* specified process.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_get_proc_membind_nodeset(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags) __hwloc_attribute_deprecated;
|
||||
static __hwloc_inline int
|
||||
hwloc_get_proc_membind_nodeset(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags)
|
||||
{
|
||||
return hwloc_get_proc_membind(topology, pid, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
|
||||
}
|
||||
|
||||
/** \brief Bind the already-allocated memory identified by (addr, len)
|
||||
* to the NUMA node(s) in physical \p nodeset.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_set_area_membind_nodeset(hwloc_topology_t topology, const void *addr, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags) __hwloc_attribute_deprecated;
|
||||
static __hwloc_inline int
|
||||
hwloc_set_area_membind_nodeset(hwloc_topology_t topology, const void *addr, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
|
||||
{
|
||||
return hwloc_set_area_membind(topology, addr, len, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
|
||||
}
|
||||
|
||||
/** \brief Query the physical NUMA node(s) and binding policy of the memory
|
||||
* identified by (\p addr, \p len ).
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_get_area_membind_nodeset(hwloc_topology_t topology, const void *addr, size_t len, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags) __hwloc_attribute_deprecated;
|
||||
static __hwloc_inline int
|
||||
hwloc_get_area_membind_nodeset(hwloc_topology_t topology, const void *addr, size_t len, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags)
|
||||
{
|
||||
return hwloc_get_area_membind(topology, addr, len, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
|
||||
}
|
||||
|
||||
/** \brief Allocate some memory on the given physical nodeset \p nodeset
|
||||
*/
|
||||
static __hwloc_inline void *
|
||||
hwloc_alloc_membind_nodeset(hwloc_topology_t topology, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags) __hwloc_attribute_malloc __hwloc_attribute_deprecated;
|
||||
static __hwloc_inline void *
|
||||
hwloc_alloc_membind_nodeset(hwloc_topology_t topology, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
|
||||
{
|
||||
return hwloc_alloc_membind(topology, len, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
|
||||
}
|
||||
|
||||
/** \brief Allocate some memory on the given nodeset \p nodeset.
|
||||
*/
|
||||
static __hwloc_inline void *
|
||||
hwloc_alloc_membind_policy_nodeset(hwloc_topology_t topology, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags) __hwloc_attribute_malloc __hwloc_attribute_deprecated;
|
||||
static __hwloc_inline void *
|
||||
hwloc_alloc_membind_policy_nodeset(hwloc_topology_t topology, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
|
||||
{
|
||||
return hwloc_alloc_membind_policy(topology, len, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
|
||||
}
|
||||
|
||||
/** \brief Convert a CPU set into a NUMA node set and handle non-NUMA cases
|
||||
*/
|
||||
static __hwloc_inline void
|
||||
hwloc_cpuset_to_nodeset_strict(hwloc_topology_t topology, hwloc_const_cpuset_t _cpuset, hwloc_nodeset_t nodeset) __hwloc_attribute_deprecated;
|
||||
static __hwloc_inline void
|
||||
hwloc_cpuset_to_nodeset_strict(hwloc_topology_t topology, hwloc_const_cpuset_t _cpuset, hwloc_nodeset_t nodeset)
|
||||
{
|
||||
hwloc_cpuset_to_nodeset(topology, _cpuset, nodeset);
|
||||
}
|
||||
|
||||
/** \brief Convert a NUMA node set into a CPU set and handle non-NUMA cases
|
||||
*/
|
||||
static __hwloc_inline void
|
||||
hwloc_cpuset_from_nodeset_strict(hwloc_topology_t topology, hwloc_cpuset_t _cpuset, hwloc_const_nodeset_t nodeset) __hwloc_attribute_deprecated;
|
||||
static __hwloc_inline void
|
||||
hwloc_cpuset_from_nodeset_strict(hwloc_topology_t topology, hwloc_cpuset_t _cpuset, hwloc_const_nodeset_t nodeset)
|
||||
{
|
||||
hwloc_cpuset_from_nodeset(topology, _cpuset, nodeset);
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* HWLOC_DEPRECATED_H */
|
||||
289
src/3rdparty/hwloc/include/hwloc/diff.h
vendored
289
src/3rdparty/hwloc/include/hwloc/diff.h
vendored
@@ -1,289 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013-2018 Inria. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Topology differences.
|
||||
*/
|
||||
|
||||
#ifndef HWLOC_DIFF_H
|
||||
#define HWLOC_DIFF_H
|
||||
|
||||
#ifndef HWLOC_H
|
||||
#error Please include the main hwloc.h instead
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#elif 0
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/** \defgroup hwlocality_diff Topology differences
|
||||
*
|
||||
* Applications that manipulate many similar topologies, for instance
|
||||
* one for each node of a homogeneous cluster, may want to compress
|
||||
* topologies to reduce the memory footprint.
|
||||
*
|
||||
* This file offers a way to manipulate the difference between topologies
|
||||
* and export/import it to/from XML.
|
||||
* Compression may therefore be achieved by storing one topology
|
||||
* entirely while the others are only described by their differences
|
||||
* with the former.
|
||||
* The actual topology can be reconstructed when actually needed by
|
||||
* applying the precomputed difference to the reference topology.
|
||||
*
|
||||
* This interface targets very similar nodes.
|
||||
* Only very simple differences between topologies are actually
|
||||
* supported, for instance a change in the memory size, the name
|
||||
* of the object, or some info attribute.
|
||||
* More complex differences such as adding or removing objects cannot
|
||||
* be represented in the difference structures and therefore return
|
||||
* errors.
|
||||
* Differences between object sets or topology-wide allowed sets,
|
||||
* cannot be represented either.
|
||||
*
|
||||
* It means that there is no need to apply the difference when
|
||||
* looking at the tree organization (how many levels, how many
|
||||
* objects per level, what kind of objects, CPU and node sets, etc)
|
||||
* and when binding to objects.
|
||||
* However the difference must be applied when looking at object
|
||||
* attributes such as the name, the memory size or info attributes.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** \brief Type of one object attribute difference.
|
||||
*/
|
||||
typedef enum hwloc_topology_diff_obj_attr_type_e {
|
||||
/** \brief The object local memory is modified.
|
||||
* The union is a hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_uint64_s
|
||||
* (and the index field is ignored).
|
||||
*/
|
||||
HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_SIZE,
|
||||
|
||||
/** \brief The object name is modified.
|
||||
* The union is a hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_string_s
|
||||
* (and the name field is ignored).
|
||||
*/
|
||||
|
||||
HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_NAME,
|
||||
/** \brief the value of an info attribute is modified.
|
||||
* The union is a hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_string_s.
|
||||
*/
|
||||
HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_INFO
|
||||
} hwloc_topology_diff_obj_attr_type_t;
|
||||
|
||||
/** \brief One object attribute difference.
|
||||
*/
|
||||
union hwloc_topology_diff_obj_attr_u {
|
||||
struct hwloc_topology_diff_obj_attr_generic_s {
|
||||
/* each part of the union must start with these */
|
||||
hwloc_topology_diff_obj_attr_type_t type;
|
||||
} generic;
|
||||
|
||||
/** \brief Integer attribute modification with an optional index. */
|
||||
struct hwloc_topology_diff_obj_attr_uint64_s {
|
||||
/* used for storing integer attributes */
|
||||
hwloc_topology_diff_obj_attr_type_t type;
|
||||
hwloc_uint64_t index; /* not used for SIZE */
|
||||
hwloc_uint64_t oldvalue;
|
||||
hwloc_uint64_t newvalue;
|
||||
} uint64;
|
||||
|
||||
/** \brief String attribute modification with an optional name */
|
||||
struct hwloc_topology_diff_obj_attr_string_s {
|
||||
/* used for storing name and info pairs */
|
||||
hwloc_topology_diff_obj_attr_type_t type;
|
||||
char *name; /* not used for NAME */
|
||||
char *oldvalue;
|
||||
char *newvalue;
|
||||
} string;
|
||||
};
|
||||
|
||||
|
||||
/** \brief Type of one element of a difference list.
|
||||
*/
|
||||
typedef enum hwloc_topology_diff_type_e {
|
||||
/** \brief An object attribute was changed.
|
||||
* The union is a hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_obj_attr_s.
|
||||
*/
|
||||
HWLOC_TOPOLOGY_DIFF_OBJ_ATTR,
|
||||
|
||||
/** \brief The difference is too complex,
|
||||
* it cannot be represented. The difference below
|
||||
* this object has not been checked.
|
||||
* hwloc_topology_diff_build() will return 1.
|
||||
*
|
||||
* The union is a hwloc_topology_diff_obj_attr_u::hwloc_topology_diff_too_complex_s.
|
||||
*/
|
||||
HWLOC_TOPOLOGY_DIFF_TOO_COMPLEX
|
||||
} hwloc_topology_diff_type_t;
|
||||
|
||||
/** \brief One element of a difference list between two topologies.
|
||||
*/
|
||||
typedef union hwloc_topology_diff_u {
|
||||
struct hwloc_topology_diff_generic_s {
|
||||
/* each part of the union must start with these */
|
||||
hwloc_topology_diff_type_t type;
|
||||
union hwloc_topology_diff_u * next; /* pointer to the next element of the list, or NULL */
|
||||
} generic;
|
||||
|
||||
/* A difference in an object attribute. */
|
||||
struct hwloc_topology_diff_obj_attr_s {
|
||||
hwloc_topology_diff_type_t type; /* must be ::HWLOC_TOPOLOGY_DIFF_OBJ_ATTR */
|
||||
union hwloc_topology_diff_u * next;
|
||||
/* List of attribute differences for a single object */
|
||||
int obj_depth;
|
||||
unsigned obj_index;
|
||||
union hwloc_topology_diff_obj_attr_u diff;
|
||||
} obj_attr;
|
||||
|
||||
/* A difference that is too complex. */
|
||||
struct hwloc_topology_diff_too_complex_s {
|
||||
hwloc_topology_diff_type_t type; /* must be ::HWLOC_TOPOLOGY_DIFF_TOO_COMPLEX */
|
||||
union hwloc_topology_diff_u * next;
|
||||
/* Where we had to stop computing the diff in the first topology */
|
||||
int obj_depth;
|
||||
unsigned obj_index;
|
||||
} too_complex;
|
||||
} * hwloc_topology_diff_t;
|
||||
|
||||
|
||||
/** \brief Compute the difference between 2 topologies.
|
||||
*
|
||||
* The difference is stored as a list of ::hwloc_topology_diff_t entries
|
||||
* starting at \p diff.
|
||||
* It is computed by doing a depth-first traversal of both topology trees
|
||||
* simultaneously.
|
||||
*
|
||||
* If the difference between 2 objects is too complex to be represented
|
||||
* (for instance if some objects have different types, or different numbers
|
||||
* of children), a special diff entry of type ::HWLOC_TOPOLOGY_DIFF_TOO_COMPLEX
|
||||
* is queued.
|
||||
* The computation of the diff does not continue below these objects.
|
||||
* So each such diff entry means that the difference between two subtrees
|
||||
* could not be computed.
|
||||
*
|
||||
* \return 0 if the difference can be represented properly.
|
||||
*
|
||||
* \return 0 with \p diff pointing to NULL if there is no difference
|
||||
* between the topologies.
|
||||
*
|
||||
* \return 1 if the difference is too complex (see above). Some entries in
|
||||
* the list will be of type ::HWLOC_TOPOLOGY_DIFF_TOO_COMPLEX.
|
||||
*
|
||||
* \return -1 on any other error.
|
||||
*
|
||||
* \note \p flags is currently not used. It should be 0.
|
||||
*
|
||||
* \note The output diff has to be freed with hwloc_topology_diff_destroy().
|
||||
*
|
||||
* \note The output diff can only be exported to XML or passed to
|
||||
* hwloc_topology_diff_apply() if 0 was returned, i.e. if no entry of type
|
||||
* ::HWLOC_TOPOLOGY_DIFF_TOO_COMPLEX is listed.
|
||||
*
|
||||
* \note The output diff may be modified by removing some entries from
|
||||
* the list. The removed entries should be freed by passing them to
|
||||
* to hwloc_topology_diff_destroy() (possible as another list).
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_topology_diff_build(hwloc_topology_t topology, hwloc_topology_t newtopology, unsigned long flags, hwloc_topology_diff_t *diff);
|
||||
|
||||
/** \brief Flags to be given to hwloc_topology_diff_apply().
|
||||
*/
|
||||
enum hwloc_topology_diff_apply_flags_e {
|
||||
/** \brief Apply topology diff in reverse direction.
|
||||
* \hideinitializer
|
||||
*/
|
||||
HWLOC_TOPOLOGY_DIFF_APPLY_REVERSE = (1UL<<0)
|
||||
};
|
||||
|
||||
/** \brief Apply a topology diff to an existing topology.
|
||||
*
|
||||
* \p flags is an OR'ed set of ::hwloc_topology_diff_apply_flags_e.
|
||||
*
|
||||
* The new topology is modified in place. hwloc_topology_dup()
|
||||
* may be used to duplicate it before patching.
|
||||
*
|
||||
* If the difference cannot be applied entirely, all previous applied
|
||||
* elements are unapplied before returning.
|
||||
*
|
||||
* \return 0 on success.
|
||||
*
|
||||
* \return -N if applying the difference failed while trying
|
||||
* to apply the N-th part of the difference. For instance -1
|
||||
* is returned if the very first difference element could not
|
||||
* be applied.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_topology_diff_apply(hwloc_topology_t topology, hwloc_topology_diff_t diff, unsigned long flags);
|
||||
|
||||
/** \brief Destroy a list of topology differences.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_topology_diff_destroy(hwloc_topology_diff_t diff);
|
||||
|
||||
/** \brief Load a list of topology differences from a XML file.
|
||||
*
|
||||
* If not \c NULL, \p refname will be filled with the identifier
|
||||
* string of the reference topology for the difference file,
|
||||
* if any was specified in the XML file.
|
||||
* This identifier is usually the name of the other XML file
|
||||
* that contains the reference topology.
|
||||
*
|
||||
* \note the pointer returned in refname should later be freed
|
||||
* by the caller.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_topology_diff_load_xml(const char *xmlpath, hwloc_topology_diff_t *diff, char **refname);
|
||||
|
||||
/** \brief Export a list of topology differences to a XML file.
|
||||
*
|
||||
* If not \c NULL, \p refname defines an identifier string
|
||||
* for the reference topology which was used as a base when
|
||||
* computing this difference.
|
||||
* This identifier is usually the name of the other XML file
|
||||
* that contains the reference topology.
|
||||
* This attribute is given back when reading the diff from XML.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_topology_diff_export_xml(hwloc_topology_diff_t diff, const char *refname, const char *xmlpath);
|
||||
|
||||
/** \brief Load a list of topology differences from a XML buffer.
|
||||
*
|
||||
* If not \c NULL, \p refname will be filled with the identifier
|
||||
* string of the reference topology for the difference file,
|
||||
* if any was specified in the XML file.
|
||||
* This identifier is usually the name of the other XML file
|
||||
* that contains the reference topology.
|
||||
*
|
||||
* \note the pointer returned in refname should later be freed
|
||||
* by the caller.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_topology_diff_load_xmlbuffer(const char *xmlbuffer, int buflen, hwloc_topology_diff_t *diff, char **refname);
|
||||
|
||||
/** \brief Export a list of topology differences to a XML buffer.
|
||||
*
|
||||
* If not \c NULL, \p refname defines an identifier string
|
||||
* for the reference topology which was used as a base when
|
||||
* computing this difference.
|
||||
* This identifier is usually the name of the other XML file
|
||||
* that contains the reference topology.
|
||||
* This attribute is given back when reading the diff from XML.
|
||||
*
|
||||
* The returned buffer ends with a \0 that is included in the returned
|
||||
* length.
|
||||
*
|
||||
* \note The XML buffer should later be freed with hwloc_free_xmlbuffer().
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_topology_diff_export_xmlbuffer(hwloc_topology_diff_t diff, const char *refname, char **xmlbuffer, int *buflen);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* HWLOC_DIFF_H */
|
||||
294
src/3rdparty/hwloc/include/hwloc/distances.h
vendored
294
src/3rdparty/hwloc/include/hwloc/distances.h
vendored
@@ -1,294 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2010-2019 Inria. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Object distances.
|
||||
*/
|
||||
|
||||
#ifndef HWLOC_DISTANCES_H
|
||||
#define HWLOC_DISTANCES_H
|
||||
|
||||
#ifndef HWLOC_H
|
||||
#error Please include the main hwloc.h instead
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#elif 0
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/** \defgroup hwlocality_distances_get Retrieve distances between objects
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Matrix of distances between a set of objects.
|
||||
*
|
||||
* This matrix often contains latencies between NUMA nodes
|
||||
* (as reported in the System Locality Distance Information Table (SLIT)
|
||||
* in the ACPI specification), which may or may not be physically accurate.
|
||||
* It corresponds to the latency for accessing the memory of one node
|
||||
* from a core in another node.
|
||||
* The corresponding kind is ::HWLOC_DISTANCES_KIND_FROM_OS | ::HWLOC_DISTANCES_KIND_FROM_USER.
|
||||
*
|
||||
* The matrix may also contain bandwidths between random sets of objects,
|
||||
* possibly provided by the user, as specified in the \p kind attribute.
|
||||
*/
|
||||
struct hwloc_distances_s {
|
||||
unsigned nbobjs; /**< \brief Number of objects described by the distance matrix. */
|
||||
hwloc_obj_t *objs; /**< \brief Array of objects described by the distance matrix.
|
||||
* These objects are not in any particular order,
|
||||
* see hwloc_distances_obj_index() and hwloc_distances_obj_pair_values()
|
||||
* for easy ways to find objects in this array and their corresponding values.
|
||||
*/
|
||||
unsigned long kind; /**< \brief OR'ed set of ::hwloc_distances_kind_e. */
|
||||
hwloc_uint64_t *values; /**< \brief Matrix of distances between objects, stored as a one-dimension array.
|
||||
*
|
||||
* Distance from i-th to j-th object is stored in slot i*nbobjs+j.
|
||||
* The meaning of the value depends on the \p kind attribute.
|
||||
*/
|
||||
};
|
||||
|
||||
/** \brief Kinds of distance matrices.
|
||||
*
|
||||
* The \p kind attribute of struct hwloc_distances_s is a OR'ed set
|
||||
* of kinds.
|
||||
*
|
||||
* A kind of format HWLOC_DISTANCES_KIND_FROM_* specifies where the
|
||||
* distance information comes from, if known.
|
||||
*
|
||||
* A kind of format HWLOC_DISTANCES_KIND_MEANS_* specifies whether
|
||||
* values are latencies or bandwidths, if applicable.
|
||||
*/
|
||||
enum hwloc_distances_kind_e {
|
||||
/** \brief These distances were obtained from the operating system or hardware.
|
||||
* \hideinitializer
|
||||
*/
|
||||
HWLOC_DISTANCES_KIND_FROM_OS = (1UL<<0),
|
||||
/** \brief These distances were provided by the user.
|
||||
* \hideinitializer
|
||||
*/
|
||||
HWLOC_DISTANCES_KIND_FROM_USER = (1UL<<1),
|
||||
|
||||
/** \brief Distance values are similar to latencies between objects.
|
||||
* Values are smaller for closer objects, hence minimal on the diagonal
|
||||
* of the matrix (distance between an object and itself).
|
||||
* It could also be the number of network hops between objects, etc.
|
||||
* \hideinitializer
|
||||
*/
|
||||
HWLOC_DISTANCES_KIND_MEANS_LATENCY = (1UL<<2),
|
||||
/** \brief Distance values are similar to bandwidths between objects.
|
||||
* Values are higher for closer objects, hence maximal on the diagonal
|
||||
* of the matrix (distance between an object and itself).
|
||||
* Such values are currently ignored for distance-based grouping.
|
||||
* \hideinitializer
|
||||
*/
|
||||
HWLOC_DISTANCES_KIND_MEANS_BANDWIDTH = (1UL<<3),
|
||||
|
||||
/** \brief This distances structure covers objects of different types.
|
||||
* \hideinitializer
|
||||
*/
|
||||
HWLOC_DISTANCES_KIND_HETEROGENEOUS_TYPES = (1UL<<4)
|
||||
};
|
||||
|
||||
/** \brief Retrieve distance matrices.
|
||||
*
|
||||
* Retrieve distance matrices from the topology into the \p distances array.
|
||||
*
|
||||
* \p flags is currently unused, should be \c 0.
|
||||
*
|
||||
* \p kind serves as a filter. If \c 0, all distance matrices are returned.
|
||||
* If it contains some HWLOC_DISTANCES_KIND_FROM_*, only distance matrices
|
||||
* whose kind matches one of these are returned.
|
||||
* If it contains some HWLOC_DISTANCES_KIND_MEANS_*, only distance matrices
|
||||
* whose kind matches one of these are returned.
|
||||
*
|
||||
* On input, \p nr points to the number of distance matrices that may be stored
|
||||
* in \p distances.
|
||||
* On output, \p nr points to the number of distance matrices that were actually
|
||||
* found, even if some of them couldn't be stored in \p distances.
|
||||
* Distance matrices that couldn't be stored are ignored, but the function still
|
||||
* returns success (\c 0). The caller may find out by comparing the value pointed
|
||||
* by \p nr before and after the function call.
|
||||
*
|
||||
* Each distance matrix returned in the \p distances array should be released
|
||||
* by the caller using hwloc_distances_release().
|
||||
*/
|
||||
HWLOC_DECLSPEC int
|
||||
hwloc_distances_get(hwloc_topology_t topology,
|
||||
unsigned *nr, struct hwloc_distances_s **distances,
|
||||
unsigned long kind, unsigned long flags);
|
||||
|
||||
/** \brief Retrieve distance matrices for object at a specific depth in the topology.
|
||||
*
|
||||
* Identical to hwloc_distances_get() with the additional \p depth filter.
|
||||
*/
|
||||
HWLOC_DECLSPEC int
|
||||
hwloc_distances_get_by_depth(hwloc_topology_t topology, int depth,
|
||||
unsigned *nr, struct hwloc_distances_s **distances,
|
||||
unsigned long kind, unsigned long flags);
|
||||
|
||||
/** \brief Retrieve distance matrices for object of a specific type.
|
||||
*
|
||||
* Identical to hwloc_distances_get() with the additional \p type filter.
|
||||
*/
|
||||
HWLOC_DECLSPEC int
|
||||
hwloc_distances_get_by_type(hwloc_topology_t topology, hwloc_obj_type_t type,
|
||||
unsigned *nr, struct hwloc_distances_s **distances,
|
||||
unsigned long kind, unsigned long flags);
|
||||
|
||||
/** \brief Retrieve a distance matrix with the given name.
|
||||
*
|
||||
* Usually only one distances structure may match a given name.
|
||||
*/
|
||||
HWLOC_DECLSPEC int
|
||||
hwloc_distances_get_by_name(hwloc_topology_t topology, const char *name,
|
||||
unsigned *nr, struct hwloc_distances_s **distances,
|
||||
unsigned long flags);
|
||||
|
||||
/** \brief Get a description of what a distances structure contains.
|
||||
*
|
||||
* For instance "NUMALatency" for hardware-provided NUMA distances (ACPI SLIT),
|
||||
* or NULL if unknown.
|
||||
*/
|
||||
HWLOC_DECLSPEC const char *
|
||||
hwloc_distances_get_name(hwloc_topology_t topology, struct hwloc_distances_s *distances);
|
||||
|
||||
/** \brief Release a distance matrix structure previously returned by hwloc_distances_get().
|
||||
*
|
||||
* \note This function is not required if the structure is removed with hwloc_distances_release_remove().
|
||||
*/
|
||||
HWLOC_DECLSPEC void
|
||||
hwloc_distances_release(hwloc_topology_t topology, struct hwloc_distances_s *distances);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
|
||||
/** \defgroup hwlocality_distances_consult Helpers for consulting distance matrices
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Find the index of an object in a distances structure.
|
||||
*
|
||||
* \return -1 if object \p obj is not involved in structure \p distances.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_distances_obj_index(struct hwloc_distances_s *distances, hwloc_obj_t obj)
|
||||
{
|
||||
unsigned i;
|
||||
for(i=0; i<distances->nbobjs; i++)
|
||||
if (distances->objs[i] == obj)
|
||||
return (int)i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** \brief Find the values between two objects in a distance matrices.
|
||||
*
|
||||
* The distance from \p obj1 to \p obj2 is stored in the value pointed by
|
||||
* \p value1to2 and reciprocally.
|
||||
*
|
||||
* \return -1 if object \p obj1 or \p obj2 is not involved in structure \p distances.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_distances_obj_pair_values(struct hwloc_distances_s *distances,
|
||||
hwloc_obj_t obj1, hwloc_obj_t obj2,
|
||||
hwloc_uint64_t *value1to2, hwloc_uint64_t *value2to1)
|
||||
{
|
||||
int i1 = hwloc_distances_obj_index(distances, obj1);
|
||||
int i2 = hwloc_distances_obj_index(distances, obj2);
|
||||
if (i1 < 0 || i2 < 0)
|
||||
return -1;
|
||||
*value1to2 = distances->values[i1 * distances->nbobjs + i2];
|
||||
*value2to1 = distances->values[i2 * distances->nbobjs + i1];
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
|
||||
/** \defgroup hwlocality_distances_add Add or remove distances between objects
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Flags for adding a new distances to a topology. */
|
||||
enum hwloc_distances_add_flag_e {
|
||||
/** \brief Try to group objects based on the newly provided distance information.
|
||||
* \hideinitializer
|
||||
*/
|
||||
HWLOC_DISTANCES_ADD_FLAG_GROUP = (1UL<<0),
|
||||
/** \brief If grouping, consider the distance values as inaccurate and relax the
|
||||
* comparisons during the grouping algorithms. The actual accuracy may be modified
|
||||
* through the HWLOC_GROUPING_ACCURACY environment variable (see \ref envvar).
|
||||
* \hideinitializer
|
||||
*/
|
||||
HWLOC_DISTANCES_ADD_FLAG_GROUP_INACCURATE = (1UL<<1)
|
||||
};
|
||||
|
||||
/** \brief Provide a new distance matrix.
|
||||
*
|
||||
* Provide the matrix of distances between a set of objects given by \p nbobjs
|
||||
* and the \p objs array. \p nbobjs must be at least 2.
|
||||
* The distances are stored as a one-dimension array in \p values.
|
||||
* The distance from object i to object j is in slot i*nbobjs+j.
|
||||
*
|
||||
* \p kind specifies the kind of distance as a OR'ed set of ::hwloc_distances_kind_e.
|
||||
* Kind ::HWLOC_DISTANCES_KIND_HETEROGENEOUS_TYPES will be automatically added
|
||||
* if objects of different types are given.
|
||||
*
|
||||
* \p flags configures the behavior of the function using an optional OR'ed set of
|
||||
* ::hwloc_distances_add_flag_e.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_distances_add(hwloc_topology_t topology,
|
||||
unsigned nbobjs, hwloc_obj_t *objs, hwloc_uint64_t *values,
|
||||
unsigned long kind, unsigned long flags);
|
||||
|
||||
/** \brief Remove all distance matrices from a topology.
|
||||
*
|
||||
* Remove all distance matrices, either provided by the user or
|
||||
* gathered through the OS.
|
||||
*
|
||||
* If these distances were used to group objects, these additional
|
||||
* Group objects are not removed from the topology.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_distances_remove(hwloc_topology_t topology);
|
||||
|
||||
/** \brief Remove distance matrices for objects at a specific depth in the topology.
|
||||
*
|
||||
* Identical to hwloc_distances_remove() but only applies to one level of the topology.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_distances_remove_by_depth(hwloc_topology_t topology, int depth);
|
||||
|
||||
/** \brief Remove distance matrices for objects of a specific type in the topology.
|
||||
*
|
||||
* Identical to hwloc_distances_remove() but only applies to one level of the topology.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_distances_remove_by_type(hwloc_topology_t topology, hwloc_obj_type_t type)
|
||||
{
|
||||
int depth = hwloc_get_type_depth(topology, type);
|
||||
if (depth == HWLOC_TYPE_DEPTH_UNKNOWN || depth == HWLOC_TYPE_DEPTH_MULTIPLE)
|
||||
return 0;
|
||||
return hwloc_distances_remove_by_depth(topology, depth);
|
||||
}
|
||||
|
||||
/** \brief Release and remove the given distance matrice from the topology.
|
||||
*
|
||||
* This function includes a call to hwloc_distances_release().
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_distances_release_remove(hwloc_topology_t topology, struct hwloc_distances_s *distances);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* HWLOC_DISTANCES_H */
|
||||
278
src/3rdparty/hwloc/include/hwloc/export.h
vendored
278
src/3rdparty/hwloc/include/hwloc/export.h
vendored
@@ -1,278 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2009-2018 Inria. All rights reserved.
|
||||
* Copyright © 2009-2012 Université Bordeaux
|
||||
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Exporting Topologies to XML or to Synthetic strings.
|
||||
*/
|
||||
|
||||
#ifndef HWLOC_EXPORT_H
|
||||
#define HWLOC_EXPORT_H
|
||||
|
||||
#ifndef HWLOC_H
|
||||
#error Please include the main hwloc.h instead
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#elif 0
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/** \defgroup hwlocality_xmlexport Exporting Topologies to XML
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Flags for exporting XML topologies.
|
||||
*
|
||||
* Flags to be given as a OR'ed set to hwloc_topology_export_xml().
|
||||
*/
|
||||
enum hwloc_topology_export_xml_flags_e {
|
||||
/** \brief Export XML that is loadable by hwloc v1.x.
|
||||
* However, the export may miss some details about the topology.
|
||||
* \hideinitializer
|
||||
*/
|
||||
HWLOC_TOPOLOGY_EXPORT_XML_FLAG_V1 = (1UL<<0)
|
||||
};
|
||||
|
||||
/** \brief Export the topology into an XML file.
|
||||
*
|
||||
* This file may be loaded later through hwloc_topology_set_xml().
|
||||
*
|
||||
* By default, the latest export format is used, which means older hwloc
|
||||
* releases (e.g. v1.x) will not be able to import it.
|
||||
* Exporting to v1.x specific XML format is possible using flag
|
||||
* ::HWLOC_TOPOLOGY_EXPORT_XML_FLAG_V1 but it may miss some details
|
||||
* about the topology.
|
||||
* If there is any chance that the exported file may ever be imported
|
||||
* back by a process using hwloc 1.x, one should consider detecting
|
||||
* it at runtime and using the corresponding export format.
|
||||
*
|
||||
* \p flags is a OR'ed set of ::hwloc_topology_export_xml_flags_e.
|
||||
*
|
||||
* \return -1 if a failure occured.
|
||||
*
|
||||
* \note See also hwloc_topology_set_userdata_export_callback()
|
||||
* for exporting application-specific object userdata.
|
||||
*
|
||||
* \note The topology-specific userdata pointer is ignored when exporting to XML.
|
||||
*
|
||||
* \note Only printable characters may be exported to XML string attributes.
|
||||
* Any other character, especially any non-ASCII character, will be silently
|
||||
* dropped.
|
||||
*
|
||||
* \note If \p name is "-", the XML output is sent to the standard output.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_topology_export_xml(hwloc_topology_t topology, const char *xmlpath, unsigned long flags);
|
||||
|
||||
/** \brief Export the topology into a newly-allocated XML memory buffer.
|
||||
*
|
||||
* \p xmlbuffer is allocated by the callee and should be freed with
|
||||
* hwloc_free_xmlbuffer() later in the caller.
|
||||
*
|
||||
* This memory buffer may be loaded later through hwloc_topology_set_xmlbuffer().
|
||||
*
|
||||
* By default, the latest export format is used, which means older hwloc
|
||||
* releases (e.g. v1.x) will not be able to import it.
|
||||
* Exporting to v1.x specific XML format is possible using flag
|
||||
* ::HWLOC_TOPOLOGY_EXPORT_XML_FLAG_V1 but it may miss some details
|
||||
* about the topology.
|
||||
* If there is any chance that the exported buffer may ever be imported
|
||||
* back by a process using hwloc 1.x, one should consider detecting
|
||||
* it at runtime and using the corresponding export format.
|
||||
*
|
||||
* The returned buffer ends with a \0 that is included in the returned
|
||||
* length.
|
||||
*
|
||||
* \p flags is a OR'ed set of ::hwloc_topology_export_xml_flags_e.
|
||||
*
|
||||
* \return -1 if a failure occured.
|
||||
*
|
||||
* \note See also hwloc_topology_set_userdata_export_callback()
|
||||
* for exporting application-specific object userdata.
|
||||
*
|
||||
* \note The topology-specific userdata pointer is ignored when exporting to XML.
|
||||
*
|
||||
* \note Only printable characters may be exported to XML string attributes.
|
||||
* Any other character, especially any non-ASCII character, will be silently
|
||||
* dropped.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_topology_export_xmlbuffer(hwloc_topology_t topology, char **xmlbuffer, int *buflen, unsigned long flags);
|
||||
|
||||
/** \brief Free a buffer allocated by hwloc_topology_export_xmlbuffer() */
|
||||
HWLOC_DECLSPEC void hwloc_free_xmlbuffer(hwloc_topology_t topology, char *xmlbuffer);
|
||||
|
||||
/** \brief Set the application-specific callback for exporting object userdata
|
||||
*
|
||||
* The object userdata pointer is not exported to XML by default because hwloc
|
||||
* does not know what it contains.
|
||||
*
|
||||
* This function lets applications set \p export_cb to a callback function
|
||||
* that converts this opaque userdata into an exportable string.
|
||||
*
|
||||
* \p export_cb is invoked during XML export for each object whose
|
||||
* \p userdata pointer is not \c NULL.
|
||||
* The callback should use hwloc_export_obj_userdata() or
|
||||
* hwloc_export_obj_userdata_base64() to actually export
|
||||
* something to XML (possibly multiple times per object).
|
||||
*
|
||||
* \p export_cb may be set to \c NULL if userdata should not be exported to XML.
|
||||
*
|
||||
* \note The topology-specific userdata pointer is ignored when exporting to XML.
|
||||
*/
|
||||
HWLOC_DECLSPEC void hwloc_topology_set_userdata_export_callback(hwloc_topology_t topology,
|
||||
void (*export_cb)(void *reserved, hwloc_topology_t topology, hwloc_obj_t obj));
|
||||
|
||||
/** \brief Export some object userdata to XML
|
||||
*
|
||||
* This function may only be called from within the export() callback passed
|
||||
* to hwloc_topology_set_userdata_export_callback().
|
||||
* It may be invoked one of multiple times to export some userdata to XML.
|
||||
* The \p buffer content of length \p length is stored with optional name
|
||||
* \p name.
|
||||
*
|
||||
* When importing this XML file, the import() callback (if set) will be
|
||||
* called exactly as many times as hwloc_export_obj_userdata() was called
|
||||
* during export(). It will receive the corresponding \p name, \p buffer
|
||||
* and \p length arguments.
|
||||
*
|
||||
* \p reserved, \p topology and \p obj must be the first three parameters
|
||||
* that were given to the export callback.
|
||||
*
|
||||
* Only printable characters may be exported to XML string attributes.
|
||||
* If a non-printable character is passed in \p name or \p buffer,
|
||||
* the function returns -1 with errno set to EINVAL.
|
||||
*
|
||||
* If exporting binary data, the application should first encode into
|
||||
* printable characters only (or use hwloc_export_obj_userdata_base64()).
|
||||
* It should also take care of portability issues if the export may
|
||||
* be reimported on a different architecture.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_export_obj_userdata(void *reserved, hwloc_topology_t topology, hwloc_obj_t obj, const char *name, const void *buffer, size_t length);
|
||||
|
||||
/** \brief Encode and export some object userdata to XML
|
||||
*
|
||||
* This function is similar to hwloc_export_obj_userdata() but it encodes
|
||||
* the input buffer into printable characters before exporting.
|
||||
* On import, decoding is automatically performed before the data is given
|
||||
* to the import() callback if any.
|
||||
*
|
||||
* This function may only be called from within the export() callback passed
|
||||
* to hwloc_topology_set_userdata_export_callback().
|
||||
*
|
||||
* The function does not take care of portability issues if the export
|
||||
* may be reimported on a different architecture.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_export_obj_userdata_base64(void *reserved, hwloc_topology_t topology, hwloc_obj_t obj, const char *name, const void *buffer, size_t length);
|
||||
|
||||
/** \brief Set the application-specific callback for importing userdata
|
||||
*
|
||||
* On XML import, userdata is ignored by default because hwloc does not know
|
||||
* how to store it in memory.
|
||||
*
|
||||
* This function lets applications set \p import_cb to a callback function
|
||||
* that will get the XML-stored userdata and store it in the object as expected
|
||||
* by the application.
|
||||
*
|
||||
* \p import_cb is called during hwloc_topology_load() as many times as
|
||||
* hwloc_export_obj_userdata() was called during export. The topology
|
||||
* is not entirely setup yet. Object attributes are ready to consult,
|
||||
* but links between objects are not.
|
||||
*
|
||||
* \p import_cb may be \c NULL if userdata should be ignored during import.
|
||||
*
|
||||
* \note \p buffer contains \p length characters followed by a null byte ('\0').
|
||||
*
|
||||
* \note This function should be called before hwloc_topology_load().
|
||||
*
|
||||
* \note The topology-specific userdata pointer is ignored when importing from XML.
|
||||
*/
|
||||
HWLOC_DECLSPEC void hwloc_topology_set_userdata_import_callback(hwloc_topology_t topology,
|
||||
void (*import_cb)(hwloc_topology_t topology, hwloc_obj_t obj, const char *name, const void *buffer, size_t length));
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
/** \defgroup hwlocality_syntheticexport Exporting Topologies to Synthetic
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Flags for exporting synthetic topologies.
|
||||
*
|
||||
* Flags to be given as a OR'ed set to hwloc_topology_export_synthetic().
|
||||
*/
|
||||
enum hwloc_topology_export_synthetic_flags_e {
|
||||
/** \brief Export extended types such as L2dcache as basic types such as Cache.
|
||||
*
|
||||
* This is required if loading the synthetic description with hwloc < 1.9.
|
||||
* \hideinitializer
|
||||
*/
|
||||
HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_EXTENDED_TYPES = (1UL<<0),
|
||||
|
||||
/** \brief Do not export level attributes.
|
||||
*
|
||||
* Ignore level attributes such as memory/cache sizes or PU indexes.
|
||||
* This is required if loading the synthetic description with hwloc < 1.10.
|
||||
* \hideinitializer
|
||||
*/
|
||||
HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_ATTRS = (1UL<<1),
|
||||
|
||||
/** \brief Export the memory hierarchy as expected in hwloc 1.x.
|
||||
*
|
||||
* Instead of attaching memory children to levels, export single NUMA node child
|
||||
* as normal intermediate levels, when possible.
|
||||
* This is required if loading the synthetic description with hwloc 1.x.
|
||||
* However this may fail if some objects have multiple local NUMA nodes.
|
||||
* \hideinitializer
|
||||
*/
|
||||
HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_V1 = (1UL<<2),
|
||||
|
||||
/** \brief Do not export memory information.
|
||||
*
|
||||
* Only export the actual hierarchy of normal CPU-side objects and ignore
|
||||
* where memory is attached.
|
||||
* This is useful for when the hierarchy of CPUs is what really matters,
|
||||
* but it behaves as if there was a single machine-wide NUMA node.
|
||||
* \hideinitializer
|
||||
*/
|
||||
HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_IGNORE_MEMORY = (1UL<<3)
|
||||
};
|
||||
|
||||
/** \brief Export the topology as a synthetic string.
|
||||
*
|
||||
* At most \p buflen characters will be written in \p buffer,
|
||||
* including the terminating \0.
|
||||
*
|
||||
* This exported string may be given back to hwloc_topology_set_synthetic().
|
||||
*
|
||||
* \p flags is a OR'ed set of ::hwloc_topology_export_synthetic_flags_e.
|
||||
*
|
||||
* \return The number of characters that were written,
|
||||
* not including the terminating \0.
|
||||
*
|
||||
* \return -1 if the topology could not be exported,
|
||||
* for instance if it is not symmetric.
|
||||
*
|
||||
* \note I/O and Misc children are ignored, the synthetic string only
|
||||
* describes normal children.
|
||||
*
|
||||
* \note A 1024-byte buffer should be large enough for exporting
|
||||
* topologies in the vast majority of cases.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_topology_export_synthetic(hwloc_topology_t topology, char *buffer, size_t buflen, unsigned long flags);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* HWLOC_EXPORT_H */
|
||||
135
src/3rdparty/hwloc/include/hwloc/gl.h
vendored
135
src/3rdparty/hwloc/include/hwloc/gl.h
vendored
@@ -1,135 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2012 Blue Brain Project, EPFL. All rights reserved.
|
||||
* Copyright © 2012-2013 Inria. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Macros to help interaction between hwloc and OpenGL displays.
|
||||
*
|
||||
* Applications that use both hwloc and OpenGL may want to include
|
||||
* this file so as to get topology information for OpenGL displays.
|
||||
*/
|
||||
|
||||
#ifndef HWLOC_GL_H
|
||||
#define HWLOC_GL_H
|
||||
|
||||
#include "hwloc.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/** \defgroup hwlocality_gl Interoperability with OpenGL displays
|
||||
*
|
||||
* This interface offers ways to retrieve topology information about
|
||||
* OpenGL displays.
|
||||
*
|
||||
* Only the NVIDIA display locality information is currently available,
|
||||
* using the NV-CONTROL X11 extension and the NVCtrl library.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Get the hwloc OS device object corresponding to the
|
||||
* OpenGL display given by port and device index.
|
||||
*
|
||||
* Return the OS device object describing the OpenGL display
|
||||
* whose port (server) is \p port and device (screen) is \p device.
|
||||
* Return NULL if there is none.
|
||||
*
|
||||
* The topology \p topology does not necessarily have to match the current
|
||||
* machine. For instance the topology may be an XML import of a remote host.
|
||||
* I/O devices detection and the GL component must be enabled in the topology.
|
||||
*
|
||||
* \note The corresponding PCI device object can be obtained by looking
|
||||
* at the OS device parent object (unless PCI devices are filtered out).
|
||||
*/
|
||||
static __hwloc_inline hwloc_obj_t
|
||||
hwloc_gl_get_display_osdev_by_port_device(hwloc_topology_t topology,
|
||||
unsigned port, unsigned device)
|
||||
{
|
||||
unsigned x = (unsigned) -1, y = (unsigned) -1;
|
||||
hwloc_obj_t osdev = NULL;
|
||||
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
|
||||
if (HWLOC_OBJ_OSDEV_GPU == osdev->attr->osdev.type
|
||||
&& osdev->name
|
||||
&& sscanf(osdev->name, ":%u.%u", &x, &y) == 2
|
||||
&& port == x && device == y)
|
||||
return osdev;
|
||||
}
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** \brief Get the hwloc OS device object corresponding to the
|
||||
* OpenGL display given by name.
|
||||
*
|
||||
* Return the OS device object describing the OpenGL display
|
||||
* whose name is \p name, built as ":port.device" such as ":0.0" .
|
||||
* Return NULL if there is none.
|
||||
*
|
||||
* The topology \p topology does not necessarily have to match the current
|
||||
* machine. For instance the topology may be an XML import of a remote host.
|
||||
* I/O devices detection and the GL component must be enabled in the topology.
|
||||
*
|
||||
* \note The corresponding PCI device object can be obtained by looking
|
||||
* at the OS device parent object (unless PCI devices are filtered out).
|
||||
*/
|
||||
static __hwloc_inline hwloc_obj_t
|
||||
hwloc_gl_get_display_osdev_by_name(hwloc_topology_t topology,
|
||||
const char *name)
|
||||
{
|
||||
hwloc_obj_t osdev = NULL;
|
||||
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
|
||||
if (HWLOC_OBJ_OSDEV_GPU == osdev->attr->osdev.type
|
||||
&& osdev->name
|
||||
&& !strcmp(name, osdev->name))
|
||||
return osdev;
|
||||
}
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** \brief Get the OpenGL display port and device corresponding
|
||||
* to the given hwloc OS object.
|
||||
*
|
||||
* Return the OpenGL display port (server) in \p port and device (screen)
|
||||
* in \p screen that correspond to the given hwloc OS device object.
|
||||
* Return \c -1 if there is none.
|
||||
*
|
||||
* The topology \p topology does not necessarily have to match the current
|
||||
* machine. For instance the topology may be an XML import of a remote host.
|
||||
* I/O devices detection and the GL component must be enabled in the topology.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_gl_get_display_by_osdev(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||
hwloc_obj_t osdev,
|
||||
unsigned *port, unsigned *device)
|
||||
{
|
||||
unsigned x = -1, y = -1;
|
||||
if (HWLOC_OBJ_OSDEV_GPU == osdev->attr->osdev.type
|
||||
&& sscanf(osdev->name, ":%u.%u", &x, &y) == 2) {
|
||||
*port = x;
|
||||
*device = y;
|
||||
return 0;
|
||||
}
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* HWLOC_GL_H */
|
||||
|
||||
126
src/3rdparty/hwloc/include/hwloc/glibc-sched.h
vendored
126
src/3rdparty/hwloc/include/hwloc/glibc-sched.h
vendored
@@ -1,126 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2013 inria. All rights reserved.
|
||||
* Copyright © 2009-2011 Université Bordeaux
|
||||
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Macros to help interaction between hwloc and glibc scheduling routines.
|
||||
*
|
||||
* Applications that use both hwloc and glibc scheduling routines such as
|
||||
* sched_getaffinity() or pthread_attr_setaffinity_np() may want to include
|
||||
* this file so as to ease conversion between their respective types.
|
||||
*/
|
||||
|
||||
#ifndef HWLOC_GLIBC_SCHED_H
|
||||
#define HWLOC_GLIBC_SCHED_H
|
||||
|
||||
#include "hwloc.h"
|
||||
#include "hwloc/helper.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#if !defined _GNU_SOURCE || !defined _SCHED_H || (!defined CPU_SETSIZE && !defined sched_priority)
|
||||
#error Please make sure to include sched.h before including glibc-sched.h, and define _GNU_SOURCE before any inclusion of sched.h
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HWLOC_HAVE_CPU_SET
|
||||
|
||||
|
||||
/** \defgroup hwlocality_glibc_sched Interoperability with glibc sched affinity
|
||||
*
|
||||
* This interface offers ways to convert between hwloc cpusets and glibc cpusets
|
||||
* such as those manipulated by sched_getaffinity() or pthread_attr_setaffinity_np().
|
||||
*
|
||||
* \note Topology \p topology must match the current machine.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** \brief Convert hwloc CPU set \p toposet into glibc sched affinity CPU set \p schedset
|
||||
*
|
||||
* This function may be used before calling sched_setaffinity or any other function
|
||||
* that takes a cpu_set_t as input parameter.
|
||||
*
|
||||
* \p schedsetsize should be sizeof(cpu_set_t) unless \p schedset was dynamically allocated with CPU_ALLOC
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_cpuset_to_glibc_sched_affinity(hwloc_topology_t topology __hwloc_attribute_unused, hwloc_const_cpuset_t hwlocset,
|
||||
cpu_set_t *schedset, size_t schedsetsize)
|
||||
{
|
||||
#ifdef CPU_ZERO_S
|
||||
unsigned cpu;
|
||||
CPU_ZERO_S(schedsetsize, schedset);
|
||||
hwloc_bitmap_foreach_begin(cpu, hwlocset)
|
||||
CPU_SET_S(cpu, schedsetsize, schedset);
|
||||
hwloc_bitmap_foreach_end();
|
||||
#else /* !CPU_ZERO_S */
|
||||
unsigned cpu;
|
||||
CPU_ZERO(schedset);
|
||||
assert(schedsetsize == sizeof(cpu_set_t));
|
||||
hwloc_bitmap_foreach_begin(cpu, hwlocset)
|
||||
CPU_SET(cpu, schedset);
|
||||
hwloc_bitmap_foreach_end();
|
||||
#endif /* !CPU_ZERO_S */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** \brief Convert glibc sched affinity CPU set \p schedset into hwloc CPU set
|
||||
*
|
||||
* This function may be used before calling sched_setaffinity or any other function
|
||||
* that takes a cpu_set_t as input parameter.
|
||||
*
|
||||
* \p schedsetsize should be sizeof(cpu_set_t) unless \p schedset was dynamically allocated with CPU_ALLOC
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_cpuset_from_glibc_sched_affinity(hwloc_topology_t topology __hwloc_attribute_unused, hwloc_cpuset_t hwlocset,
|
||||
const cpu_set_t *schedset, size_t schedsetsize)
|
||||
{
|
||||
int cpu;
|
||||
#ifdef CPU_ZERO_S
|
||||
int count;
|
||||
#endif
|
||||
hwloc_bitmap_zero(hwlocset);
|
||||
#ifdef CPU_ZERO_S
|
||||
count = CPU_COUNT_S(schedsetsize, schedset);
|
||||
cpu = 0;
|
||||
while (count) {
|
||||
if (CPU_ISSET_S(cpu, schedsetsize, schedset)) {
|
||||
hwloc_bitmap_set(hwlocset, cpu);
|
||||
count--;
|
||||
}
|
||||
cpu++;
|
||||
}
|
||||
#else /* !CPU_ZERO_S */
|
||||
/* sched.h does not support dynamic cpu_set_t (introduced in glibc 2.7),
|
||||
* assume we have a very old interface without CPU_COUNT (added in 2.6)
|
||||
*/
|
||||
assert(schedsetsize == sizeof(cpu_set_t));
|
||||
for(cpu=0; cpu<CPU_SETSIZE; cpu++)
|
||||
if (CPU_ISSET(cpu, schedset))
|
||||
hwloc_bitmap_set(hwlocset, cpu);
|
||||
#endif /* !CPU_ZERO_S */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
#endif /* CPU_SET */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* HWLOC_GLIBC_SCHED_H */
|
||||
1188
src/3rdparty/hwloc/include/hwloc/helper.h
vendored
1188
src/3rdparty/hwloc/include/hwloc/helper.h
vendored
File diff suppressed because it is too large
Load Diff
146
src/3rdparty/hwloc/include/hwloc/inlines.h
vendored
146
src/3rdparty/hwloc/include/hwloc/inlines.h
vendored
@@ -1,146 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2018 Inria. All rights reserved.
|
||||
* Copyright © 2009-2012 Université Bordeaux
|
||||
* Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This file contains the inline code of functions declared in hwloc.h
|
||||
*/
|
||||
|
||||
#ifndef HWLOC_INLINES_H
|
||||
#define HWLOC_INLINES_H
|
||||
|
||||
#ifndef HWLOC_H
|
||||
#error Please include the main hwloc.h instead
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static __hwloc_inline int
|
||||
hwloc_get_type_or_below_depth (hwloc_topology_t topology, hwloc_obj_type_t type)
|
||||
{
|
||||
int depth = hwloc_get_type_depth(topology, type);
|
||||
|
||||
if (depth != HWLOC_TYPE_DEPTH_UNKNOWN)
|
||||
return depth;
|
||||
|
||||
/* find the highest existing level with type order >= */
|
||||
for(depth = hwloc_get_type_depth(topology, HWLOC_OBJ_PU); ; depth--)
|
||||
if (hwloc_compare_types(hwloc_get_depth_type(topology, depth), type) < 0)
|
||||
return depth+1;
|
||||
|
||||
/* Shouldn't ever happen, as there is always a Machine level with lower order and known depth. */
|
||||
/* abort(); */
|
||||
}
|
||||
|
||||
static __hwloc_inline int
|
||||
hwloc_get_type_or_above_depth (hwloc_topology_t topology, hwloc_obj_type_t type)
|
||||
{
|
||||
int depth = hwloc_get_type_depth(topology, type);
|
||||
|
||||
if (depth != HWLOC_TYPE_DEPTH_UNKNOWN)
|
||||
return depth;
|
||||
|
||||
/* find the lowest existing level with type order <= */
|
||||
for(depth = 0; ; depth++)
|
||||
if (hwloc_compare_types(hwloc_get_depth_type(topology, depth), type) > 0)
|
||||
return depth-1;
|
||||
|
||||
/* Shouldn't ever happen, as there is always a PU level with higher order and known depth. */
|
||||
/* abort(); */
|
||||
}
|
||||
|
||||
static __hwloc_inline int
|
||||
hwloc_get_nbobjs_by_type (hwloc_topology_t topology, hwloc_obj_type_t type)
|
||||
{
|
||||
int depth = hwloc_get_type_depth(topology, type);
|
||||
if (depth == HWLOC_TYPE_DEPTH_UNKNOWN)
|
||||
return 0;
|
||||
if (depth == HWLOC_TYPE_DEPTH_MULTIPLE)
|
||||
return -1; /* FIXME: agregate nbobjs from different levels? */
|
||||
return (int) hwloc_get_nbobjs_by_depth(topology, depth);
|
||||
}
|
||||
|
||||
static __hwloc_inline hwloc_obj_t
|
||||
hwloc_get_obj_by_type (hwloc_topology_t topology, hwloc_obj_type_t type, unsigned idx)
|
||||
{
|
||||
int depth = hwloc_get_type_depth(topology, type);
|
||||
if (depth == HWLOC_TYPE_DEPTH_UNKNOWN)
|
||||
return NULL;
|
||||
if (depth == HWLOC_TYPE_DEPTH_MULTIPLE)
|
||||
return NULL;
|
||||
return hwloc_get_obj_by_depth(topology, depth, idx);
|
||||
}
|
||||
|
||||
static __hwloc_inline hwloc_obj_t
|
||||
hwloc_get_next_obj_by_depth (hwloc_topology_t topology, int depth, hwloc_obj_t prev)
|
||||
{
|
||||
if (!prev)
|
||||
return hwloc_get_obj_by_depth (topology, depth, 0);
|
||||
if (prev->depth != depth)
|
||||
return NULL;
|
||||
return prev->next_cousin;
|
||||
}
|
||||
|
||||
static __hwloc_inline hwloc_obj_t
|
||||
hwloc_get_next_obj_by_type (hwloc_topology_t topology, hwloc_obj_type_t type,
|
||||
hwloc_obj_t prev)
|
||||
{
|
||||
int depth = hwloc_get_type_depth(topology, type);
|
||||
if (depth == HWLOC_TYPE_DEPTH_UNKNOWN || depth == HWLOC_TYPE_DEPTH_MULTIPLE)
|
||||
return NULL;
|
||||
return hwloc_get_next_obj_by_depth (topology, depth, prev);
|
||||
}
|
||||
|
||||
static __hwloc_inline hwloc_obj_t
|
||||
hwloc_get_root_obj (hwloc_topology_t topology)
|
||||
{
|
||||
return hwloc_get_obj_by_depth (topology, 0, 0);
|
||||
}
|
||||
|
||||
static __hwloc_inline const char *
|
||||
hwloc_obj_get_info_by_name(hwloc_obj_t obj, const char *name)
|
||||
{
|
||||
unsigned i;
|
||||
for(i=0; i<obj->infos_count; i++) {
|
||||
struct hwloc_info_s *info = &obj->infos[i];
|
||||
if (!strcmp(info->name, name))
|
||||
return info->value;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static __hwloc_inline void *
|
||||
hwloc_alloc_membind_policy(hwloc_topology_t topology, size_t len, hwloc_const_cpuset_t set, hwloc_membind_policy_t policy, int flags)
|
||||
{
|
||||
void *p = hwloc_alloc_membind(topology, len, set, policy, flags);
|
||||
if (p)
|
||||
return p;
|
||||
|
||||
if (hwloc_set_membind(topology, set, policy, flags) < 0)
|
||||
/* hwloc_set_membind() takes care of ignoring errors if non-STRICT */
|
||||
return NULL;
|
||||
|
||||
p = hwloc_alloc(topology, len);
|
||||
if (p && policy != HWLOC_MEMBIND_FIRSTTOUCH)
|
||||
/* Enforce the binding by touching the data */
|
||||
memset(p, 0, len);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* HWLOC_INLINES_H */
|
||||
136
src/3rdparty/hwloc/include/hwloc/intel-mic.h
vendored
136
src/3rdparty/hwloc/include/hwloc/intel-mic.h
vendored
@@ -1,136 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013-2016 Inria. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Macros to help interaction between hwloc and Intel Xeon Phi (MIC).
|
||||
*
|
||||
* Applications that use both hwloc and Intel Xeon Phi (MIC) may want to
|
||||
* include this file so as to get topology information for MIC devices.
|
||||
*/
|
||||
|
||||
#ifndef HWLOC_INTEL_MIC_H
|
||||
#define HWLOC_INTEL_MIC_H
|
||||
|
||||
#include "hwloc.h"
|
||||
#include "hwloc/autogen/config.h"
|
||||
#include "hwloc/helper.h"
|
||||
|
||||
#ifdef HWLOC_LINUX_SYS
|
||||
#include "hwloc/linux.h"
|
||||
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/** \defgroup hwlocality_intel_mic Interoperability with Intel Xeon Phi (MIC)
|
||||
*
|
||||
* This interface offers ways to retrieve topology information about
|
||||
* Intel Xeon Phi (MIC) devices.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Get the CPU set of logical processors that are physically
|
||||
* close to MIC device whose index is \p idx.
|
||||
*
|
||||
* Return the CPU set describing the locality of the MIC device whose index is \p idx.
|
||||
*
|
||||
* Topology \p topology and device index \p idx must match the local machine.
|
||||
* I/O devices detection is not needed in the topology.
|
||||
*
|
||||
* The function only returns the locality of the device.
|
||||
* If more information about the device is needed, OS objects should
|
||||
* be used instead, see hwloc_intel_mic_get_device_osdev_by_index().
|
||||
*
|
||||
* This function is currently only implemented in a meaningful way for
|
||||
* Linux; other systems will simply get a full cpuset.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_intel_mic_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||
int idx __hwloc_attribute_unused,
|
||||
hwloc_cpuset_t set)
|
||||
{
|
||||
#ifdef HWLOC_LINUX_SYS
|
||||
/* If we're on Linux, use the sysfs mechanism to get the local cpus */
|
||||
#define HWLOC_INTEL_MIC_DEVICE_SYSFS_PATH_MAX 128
|
||||
char path[HWLOC_INTEL_MIC_DEVICE_SYSFS_PATH_MAX];
|
||||
DIR *sysdir = NULL;
|
||||
struct dirent *dirent;
|
||||
unsigned pcibus, pcidev, pcifunc;
|
||||
|
||||
if (!hwloc_topology_is_thissystem(topology)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
sprintf(path, "/sys/class/mic/mic%d", idx);
|
||||
sysdir = opendir(path);
|
||||
if (!sysdir)
|
||||
return -1;
|
||||
|
||||
while ((dirent = readdir(sysdir)) != NULL) {
|
||||
if (sscanf(dirent->d_name, "pci_%02x:%02x.%02x", &pcibus, &pcidev, &pcifunc) == 3) {
|
||||
sprintf(path, "/sys/class/mic/mic%d/pci_%02x:%02x.%02x/local_cpus", idx, pcibus, pcidev, pcifunc);
|
||||
if (hwloc_linux_read_path_as_cpumask(path, set) < 0
|
||||
|| hwloc_bitmap_iszero(set))
|
||||
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
closedir(sysdir);
|
||||
#else
|
||||
/* Non-Linux systems simply get a full cpuset */
|
||||
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** \brief Get the hwloc OS device object corresponding to the
|
||||
* MIC device for the given index.
|
||||
*
|
||||
* Return the OS device object describing the MIC device whose index is \p idx.
|
||||
* Return NULL if there is none.
|
||||
*
|
||||
* The topology \p topology does not necessarily have to match the current
|
||||
* machine. For instance the topology may be an XML import of a remote host.
|
||||
* I/O devices detection must be enabled in the topology.
|
||||
*
|
||||
* \note The corresponding PCI device object can be obtained by looking
|
||||
* at the OS device parent object.
|
||||
*/
|
||||
static __hwloc_inline hwloc_obj_t
|
||||
hwloc_intel_mic_get_device_osdev_by_index(hwloc_topology_t topology,
|
||||
unsigned idx)
|
||||
{
|
||||
hwloc_obj_t osdev = NULL;
|
||||
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
|
||||
if (HWLOC_OBJ_OSDEV_COPROC == osdev->attr->osdev.type
|
||||
&& osdev->name
|
||||
&& !strncmp("mic", osdev->name, 3)
|
||||
&& atoi(osdev->name + 3) == (int) idx)
|
||||
return osdev;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* HWLOC_INTEL_MIC_H */
|
||||
274
src/3rdparty/hwloc/include/hwloc/linux-libnuma.h
vendored
274
src/3rdparty/hwloc/include/hwloc/linux-libnuma.h
vendored
@@ -1,274 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2017 Inria. All rights reserved.
|
||||
* Copyright © 2009-2010, 2012 Université Bordeaux
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Macros to help interaction between hwloc and Linux libnuma.
|
||||
*
|
||||
* Applications that use both Linux libnuma and hwloc may want to
|
||||
* include this file so as to ease conversion between their respective types.
|
||||
*/
|
||||
|
||||
#ifndef HWLOC_LINUX_LIBNUMA_H
|
||||
#define HWLOC_LINUX_LIBNUMA_H
|
||||
|
||||
#include "hwloc.h"
|
||||
|
||||
#include <numa.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/** \defgroup hwlocality_linux_libnuma_ulongs Interoperability with Linux libnuma unsigned long masks
|
||||
*
|
||||
* This interface helps converting between Linux libnuma unsigned long masks
|
||||
* and hwloc cpusets and nodesets.
|
||||
*
|
||||
* \note Topology \p topology must match the current machine.
|
||||
*
|
||||
* \note The behavior of libnuma is undefined if the kernel is not NUMA-aware.
|
||||
* (when CONFIG_NUMA is not set in the kernel configuration).
|
||||
* This helper and libnuma may thus not be strictly compatible in this case,
|
||||
* which may be detected by checking whether numa_available() returns -1.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** \brief Convert hwloc CPU set \p cpuset into the array of unsigned long \p mask
|
||||
*
|
||||
* \p mask is the array of unsigned long that will be filled.
|
||||
* \p maxnode contains the maximal node number that may be stored in \p mask.
|
||||
* \p maxnode will be set to the maximal node number that was found, plus one.
|
||||
*
|
||||
* This function may be used before calling set_mempolicy, mbind, migrate_pages
|
||||
* or any other function that takes an array of unsigned long and a maximal
|
||||
* node number as input parameter.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_cpuset_to_linux_libnuma_ulongs(hwloc_topology_t topology, hwloc_const_cpuset_t cpuset,
|
||||
unsigned long *mask, unsigned long *maxnode)
|
||||
{
|
||||
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NUMANODE);
|
||||
unsigned long outmaxnode = -1;
|
||||
hwloc_obj_t node = NULL;
|
||||
|
||||
/* round-up to the next ulong and clear all bytes */
|
||||
*maxnode = (*maxnode + 8*sizeof(*mask) - 1) & ~(8*sizeof(*mask) - 1);
|
||||
memset(mask, 0, *maxnode/8);
|
||||
|
||||
while ((node = hwloc_get_next_obj_covering_cpuset_by_depth(topology, cpuset, depth, node)) != NULL) {
|
||||
if (node->os_index >= *maxnode)
|
||||
continue;
|
||||
mask[node->os_index/sizeof(*mask)/8] |= 1UL << (node->os_index % (sizeof(*mask)*8));
|
||||
if (outmaxnode == (unsigned long) -1 || outmaxnode < node->os_index)
|
||||
outmaxnode = node->os_index;
|
||||
}
|
||||
|
||||
*maxnode = outmaxnode+1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** \brief Convert hwloc NUMA node set \p nodeset into the array of unsigned long \p mask
|
||||
*
|
||||
* \p mask is the array of unsigned long that will be filled.
|
||||
* \p maxnode contains the maximal node number that may be stored in \p mask.
|
||||
* \p maxnode will be set to the maximal node number that was found, plus one.
|
||||
*
|
||||
* This function may be used before calling set_mempolicy, mbind, migrate_pages
|
||||
* or any other function that takes an array of unsigned long and a maximal
|
||||
* node number as input parameter.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_nodeset_to_linux_libnuma_ulongs(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset,
|
||||
unsigned long *mask, unsigned long *maxnode)
|
||||
{
|
||||
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NUMANODE);
|
||||
unsigned long outmaxnode = -1;
|
||||
hwloc_obj_t node = NULL;
|
||||
|
||||
/* round-up to the next ulong and clear all bytes */
|
||||
*maxnode = (*maxnode + 8*sizeof(*mask) - 1) & ~(8*sizeof(*mask) - 1);
|
||||
memset(mask, 0, *maxnode/8);
|
||||
|
||||
while ((node = hwloc_get_next_obj_by_depth(topology, depth, node)) != NULL) {
|
||||
if (node->os_index >= *maxnode)
|
||||
continue;
|
||||
if (!hwloc_bitmap_isset(nodeset, node->os_index))
|
||||
continue;
|
||||
mask[node->os_index/sizeof(*mask)/8] |= 1UL << (node->os_index % (sizeof(*mask)*8));
|
||||
if (outmaxnode == (unsigned long) -1 || outmaxnode < node->os_index)
|
||||
outmaxnode = node->os_index;
|
||||
}
|
||||
|
||||
*maxnode = outmaxnode+1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** \brief Convert the array of unsigned long \p mask into hwloc CPU set
|
||||
*
|
||||
* \p mask is a array of unsigned long that will be read.
|
||||
* \p maxnode contains the maximal node number that may be read in \p mask.
|
||||
*
|
||||
* This function may be used after calling get_mempolicy or any other function
|
||||
* that takes an array of unsigned long as output parameter (and possibly
|
||||
* a maximal node number as input parameter).
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_cpuset_from_linux_libnuma_ulongs(hwloc_topology_t topology, hwloc_cpuset_t cpuset,
|
||||
const unsigned long *mask, unsigned long maxnode)
|
||||
{
|
||||
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NUMANODE);
|
||||
hwloc_obj_t node = NULL;
|
||||
hwloc_bitmap_zero(cpuset);
|
||||
while ((node = hwloc_get_next_obj_by_depth(topology, depth, node)) != NULL)
|
||||
if (node->os_index < maxnode
|
||||
&& (mask[node->os_index/sizeof(*mask)/8] & (1UL << (node->os_index % (sizeof(*mask)*8)))))
|
||||
hwloc_bitmap_or(cpuset, cpuset, node->cpuset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** \brief Convert the array of unsigned long \p mask into hwloc NUMA node set
|
||||
*
|
||||
* \p mask is a array of unsigned long that will be read.
|
||||
* \p maxnode contains the maximal node number that may be read in \p mask.
|
||||
*
|
||||
* This function may be used after calling get_mempolicy or any other function
|
||||
* that takes an array of unsigned long as output parameter (and possibly
|
||||
* a maximal node number as input parameter).
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_nodeset_from_linux_libnuma_ulongs(hwloc_topology_t topology, hwloc_nodeset_t nodeset,
|
||||
const unsigned long *mask, unsigned long maxnode)
|
||||
{
|
||||
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NUMANODE);
|
||||
hwloc_obj_t node = NULL;
|
||||
hwloc_bitmap_zero(nodeset);
|
||||
while ((node = hwloc_get_next_obj_by_depth(topology, depth, node)) != NULL)
|
||||
if (node->os_index < maxnode
|
||||
&& (mask[node->os_index/sizeof(*mask)/8] & (1UL << (node->os_index % (sizeof(*mask)*8)))))
|
||||
hwloc_bitmap_set(nodeset, node->os_index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
|
||||
/** \defgroup hwlocality_linux_libnuma_bitmask Interoperability with Linux libnuma bitmask
|
||||
*
|
||||
* This interface helps converting between Linux libnuma bitmasks
|
||||
* and hwloc cpusets and nodesets.
|
||||
*
|
||||
* \note Topology \p topology must match the current machine.
|
||||
*
|
||||
* \note The behavior of libnuma is undefined if the kernel is not NUMA-aware.
|
||||
* (when CONFIG_NUMA is not set in the kernel configuration).
|
||||
* This helper and libnuma may thus not be strictly compatible in this case,
|
||||
* which may be detected by checking whether numa_available() returns -1.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** \brief Convert hwloc CPU set \p cpuset into the returned libnuma bitmask
|
||||
*
|
||||
* The returned bitmask should later be freed with numa_bitmask_free.
|
||||
*
|
||||
* This function may be used before calling many numa_ functions
|
||||
* that use a struct bitmask as an input parameter.
|
||||
*
|
||||
* \return newly allocated struct bitmask.
|
||||
*/
|
||||
static __hwloc_inline struct bitmask *
|
||||
hwloc_cpuset_to_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_const_cpuset_t cpuset) __hwloc_attribute_malloc;
|
||||
static __hwloc_inline struct bitmask *
|
||||
hwloc_cpuset_to_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_const_cpuset_t cpuset)
|
||||
{
|
||||
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NUMANODE);
|
||||
hwloc_obj_t node = NULL;
|
||||
struct bitmask *bitmask = numa_allocate_cpumask();
|
||||
if (!bitmask)
|
||||
return NULL;
|
||||
while ((node = hwloc_get_next_obj_covering_cpuset_by_depth(topology, cpuset, depth, node)) != NULL)
|
||||
if (node->attr->numanode.local_memory)
|
||||
numa_bitmask_setbit(bitmask, node->os_index);
|
||||
return bitmask;
|
||||
}
|
||||
|
||||
/** \brief Convert hwloc NUMA node set \p nodeset into the returned libnuma bitmask
|
||||
*
|
||||
* The returned bitmask should later be freed with numa_bitmask_free.
|
||||
*
|
||||
* This function may be used before calling many numa_ functions
|
||||
* that use a struct bitmask as an input parameter.
|
||||
*
|
||||
* \return newly allocated struct bitmask.
|
||||
*/
|
||||
static __hwloc_inline struct bitmask *
|
||||
hwloc_nodeset_to_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset) __hwloc_attribute_malloc;
|
||||
static __hwloc_inline struct bitmask *
|
||||
hwloc_nodeset_to_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset)
|
||||
{
|
||||
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NUMANODE);
|
||||
hwloc_obj_t node = NULL;
|
||||
struct bitmask *bitmask = numa_allocate_cpumask();
|
||||
if (!bitmask)
|
||||
return NULL;
|
||||
while ((node = hwloc_get_next_obj_by_depth(topology, depth, node)) != NULL)
|
||||
if (hwloc_bitmap_isset(nodeset, node->os_index) && node->attr->numanode.local_memory)
|
||||
numa_bitmask_setbit(bitmask, node->os_index);
|
||||
return bitmask;
|
||||
}
|
||||
|
||||
/** \brief Convert libnuma bitmask \p bitmask into hwloc CPU set \p cpuset
|
||||
*
|
||||
* This function may be used after calling many numa_ functions
|
||||
* that use a struct bitmask as an output parameter.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_cpuset_from_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_cpuset_t cpuset,
|
||||
const struct bitmask *bitmask)
|
||||
{
|
||||
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NUMANODE);
|
||||
hwloc_obj_t node = NULL;
|
||||
hwloc_bitmap_zero(cpuset);
|
||||
while ((node = hwloc_get_next_obj_by_depth(topology, depth, node)) != NULL)
|
||||
if (numa_bitmask_isbitset(bitmask, node->os_index))
|
||||
hwloc_bitmap_or(cpuset, cpuset, node->cpuset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** \brief Convert libnuma bitmask \p bitmask into hwloc NUMA node set \p nodeset
|
||||
*
|
||||
* This function may be used after calling many numa_ functions
|
||||
* that use a struct bitmask as an output parameter.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_nodeset_from_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_nodeset_t nodeset,
|
||||
const struct bitmask *bitmask)
|
||||
{
|
||||
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NUMANODE);
|
||||
hwloc_obj_t node = NULL;
|
||||
hwloc_bitmap_zero(nodeset);
|
||||
while ((node = hwloc_get_next_obj_by_depth(topology, depth, node)) != NULL)
|
||||
if (numa_bitmask_isbitset(bitmask, node->os_index))
|
||||
hwloc_bitmap_set(nodeset, node->os_index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* HWLOC_LINUX_NUMA_H */
|
||||
80
src/3rdparty/hwloc/include/hwloc/linux.h
vendored
80
src/3rdparty/hwloc/include/hwloc/linux.h
vendored
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2016 Inria. All rights reserved.
|
||||
* Copyright © 2009-2011 Université Bordeaux
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Macros to help interaction between hwloc and Linux.
|
||||
*
|
||||
* Applications that use hwloc on Linux may want to include this file
|
||||
* if using some low-level Linux features.
|
||||
*/
|
||||
|
||||
#ifndef HWLOC_LINUX_H
|
||||
#define HWLOC_LINUX_H
|
||||
|
||||
#include "hwloc.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/** \defgroup hwlocality_linux Linux-specific helpers
|
||||
*
|
||||
* This includes helpers for manipulating Linux kernel cpumap files, and hwloc
|
||||
* equivalents of the Linux sched_setaffinity and sched_getaffinity system calls.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Bind a thread \p tid on cpus given in cpuset \p set
|
||||
*
|
||||
* The behavior is exactly the same as the Linux sched_setaffinity system call,
|
||||
* but uses a hwloc cpuset.
|
||||
*
|
||||
* \note This is equivalent to calling hwloc_set_proc_cpubind() with
|
||||
* HWLOC_CPUBIND_THREAD as flags.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_linux_set_tid_cpubind(hwloc_topology_t topology, pid_t tid, hwloc_const_cpuset_t set);
|
||||
|
||||
/** \brief Get the current binding of thread \p tid
|
||||
*
|
||||
* The behavior is exactly the same as the Linux sched_getaffinity system call,
|
||||
* but uses a hwloc cpuset.
|
||||
*
|
||||
* \note This is equivalent to calling hwloc_get_proc_cpubind() with
|
||||
* ::HWLOC_CPUBIND_THREAD as flags.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_linux_get_tid_cpubind(hwloc_topology_t topology, pid_t tid, hwloc_cpuset_t set);
|
||||
|
||||
/** \brief Get the last physical CPU where thread \p tid ran.
|
||||
*
|
||||
* \note This is equivalent to calling hwloc_get_proc_last_cpu_location() with
|
||||
* ::HWLOC_CPUBIND_THREAD as flags.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_linux_get_tid_last_cpu_location(hwloc_topology_t topology, pid_t tid, hwloc_bitmap_t set);
|
||||
|
||||
/** \brief Convert a linux kernel cpumask file \p path into a hwloc bitmap \p set.
|
||||
*
|
||||
* Might be used when reading CPU set from sysfs attributes such as topology
|
||||
* and caches for processors, or local_cpus for devices.
|
||||
*
|
||||
* \note This function ignores the HWLOC_FSROOT environment variable.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_linux_read_path_as_cpumask(const char *path, hwloc_bitmap_t set);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* HWLOC_LINUX_H */
|
||||
181
src/3rdparty/hwloc/include/hwloc/nvml.h
vendored
181
src/3rdparty/hwloc/include/hwloc/nvml.h
vendored
@@ -1,181 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2012-2016 Inria. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Macros to help interaction between hwloc and the NVIDIA Management Library.
|
||||
*
|
||||
* Applications that use both hwloc and the NVIDIA Management Library may want to
|
||||
* include this file so as to get topology information for NVML devices.
|
||||
*/
|
||||
|
||||
#ifndef HWLOC_NVML_H
|
||||
#define HWLOC_NVML_H
|
||||
|
||||
#include "hwloc.h"
|
||||
#include "hwloc/autogen/config.h"
|
||||
#include "hwloc/helper.h"
|
||||
#ifdef HWLOC_LINUX_SYS
|
||||
#include "hwloc/linux.h"
|
||||
#endif
|
||||
|
||||
#include <nvml.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/** \defgroup hwlocality_nvml Interoperability with the NVIDIA Management Library
|
||||
*
|
||||
* This interface offers ways to retrieve topology information about
|
||||
* devices managed by the NVIDIA Management Library (NVML).
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Get the CPU set of logical processors that are physically
|
||||
* close to NVML device \p device.
|
||||
*
|
||||
* Return the CPU set describing the locality of the NVML device \p device.
|
||||
*
|
||||
* Topology \p topology and device \p device must match the local machine.
|
||||
* I/O devices detection and the NVML component are not needed in the topology.
|
||||
*
|
||||
* The function only returns the locality of the device.
|
||||
* If more information about the device is needed, OS objects should
|
||||
* be used instead, see hwloc_nvml_get_device_osdev()
|
||||
* and hwloc_nvml_get_device_osdev_by_index().
|
||||
*
|
||||
* This function is currently only implemented in a meaningful way for
|
||||
* Linux; other systems will simply get a full cpuset.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_nvml_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||
nvmlDevice_t device, hwloc_cpuset_t set)
|
||||
{
|
||||
#ifdef HWLOC_LINUX_SYS
|
||||
/* If we're on Linux, use the sysfs mechanism to get the local cpus */
|
||||
#define HWLOC_NVML_DEVICE_SYSFS_PATH_MAX 128
|
||||
char path[HWLOC_NVML_DEVICE_SYSFS_PATH_MAX];
|
||||
nvmlReturn_t nvres;
|
||||
nvmlPciInfo_t pci;
|
||||
|
||||
if (!hwloc_topology_is_thissystem(topology)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
nvres = nvmlDeviceGetPciInfo(device, &pci);
|
||||
if (NVML_SUCCESS != nvres) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
sprintf(path, "/sys/bus/pci/devices/%04x:%02x:%02x.0/local_cpus", pci.domain, pci.bus, pci.device);
|
||||
if (hwloc_linux_read_path_as_cpumask(path, set) < 0
|
||||
|| hwloc_bitmap_iszero(set))
|
||||
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||
#else
|
||||
/* Non-Linux systems simply get a full cpuset */
|
||||
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** \brief Get the hwloc OS device object corresponding to the
|
||||
* NVML device whose index is \p idx.
|
||||
*
|
||||
* Return the OS device object describing the NVML device whose
|
||||
* index is \p idx. Returns NULL if there is none.
|
||||
*
|
||||
* The topology \p topology does not necessarily have to match the current
|
||||
* machine. For instance the topology may be an XML import of a remote host.
|
||||
* I/O devices detection and the NVML component must be enabled in the topology.
|
||||
*
|
||||
* \note The corresponding PCI device object can be obtained by looking
|
||||
* at the OS device parent object (unless PCI devices are filtered out).
|
||||
*/
|
||||
static __hwloc_inline hwloc_obj_t
|
||||
hwloc_nvml_get_device_osdev_by_index(hwloc_topology_t topology, unsigned idx)
|
||||
{
|
||||
hwloc_obj_t osdev = NULL;
|
||||
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
|
||||
if (HWLOC_OBJ_OSDEV_GPU == osdev->attr->osdev.type
|
||||
&& osdev->name
|
||||
&& !strncmp("nvml", osdev->name, 4)
|
||||
&& atoi(osdev->name + 4) == (int) idx)
|
||||
return osdev;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** \brief Get the hwloc OS device object corresponding to NVML device \p device.
|
||||
*
|
||||
* Return the hwloc OS device object that describes the given
|
||||
* NVML device \p device. Return NULL if there is none.
|
||||
*
|
||||
* Topology \p topology and device \p device must match the local machine.
|
||||
* I/O devices detection and the NVML component must be enabled in the topology.
|
||||
* If not, the locality of the object may still be found using
|
||||
* hwloc_nvml_get_device_cpuset().
|
||||
*
|
||||
* \note The corresponding hwloc PCI device may be found by looking
|
||||
* at the result parent pointer (unless PCI devices are filtered out).
|
||||
*/
|
||||
static __hwloc_inline hwloc_obj_t
|
||||
hwloc_nvml_get_device_osdev(hwloc_topology_t topology, nvmlDevice_t device)
|
||||
{
|
||||
hwloc_obj_t osdev;
|
||||
nvmlReturn_t nvres;
|
||||
nvmlPciInfo_t pci;
|
||||
char uuid[64];
|
||||
|
||||
if (!hwloc_topology_is_thissystem(topology)) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
nvres = nvmlDeviceGetPciInfo(device, &pci);
|
||||
if (NVML_SUCCESS != nvres)
|
||||
return NULL;
|
||||
|
||||
nvres = nvmlDeviceGetUUID(device, uuid, sizeof(uuid));
|
||||
if (NVML_SUCCESS != nvres)
|
||||
uuid[0] = '\0';
|
||||
|
||||
osdev = NULL;
|
||||
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
|
||||
hwloc_obj_t pcidev = osdev->parent;
|
||||
const char *info;
|
||||
|
||||
if (strncmp(osdev->name, "nvml", 4))
|
||||
continue;
|
||||
|
||||
if (pcidev
|
||||
&& pcidev->type == HWLOC_OBJ_PCI_DEVICE
|
||||
&& pcidev->attr->pcidev.domain == pci.domain
|
||||
&& pcidev->attr->pcidev.bus == pci.bus
|
||||
&& pcidev->attr->pcidev.dev == pci.device
|
||||
&& pcidev->attr->pcidev.func == 0)
|
||||
return osdev;
|
||||
|
||||
info = hwloc_obj_get_info_by_name(osdev, "NVIDIAUUID");
|
||||
if (info && !strcmp(info, uuid))
|
||||
return osdev;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* HWLOC_NVML_H */
|
||||
250
src/3rdparty/hwloc/include/hwloc/opencl.h
vendored
250
src/3rdparty/hwloc/include/hwloc/opencl.h
vendored
@@ -1,250 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2012-2019 Inria. All rights reserved.
|
||||
* Copyright © 2013, 2018 Université Bordeaux. All right reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Macros to help interaction between hwloc and the OpenCL interface.
|
||||
*
|
||||
* Applications that use both hwloc and OpenCL may want to
|
||||
* include this file so as to get topology information for OpenCL devices.
|
||||
*/
|
||||
|
||||
#ifndef HWLOC_OPENCL_H
|
||||
#define HWLOC_OPENCL_H
|
||||
|
||||
#include "hwloc.h"
|
||||
#include "hwloc/autogen/config.h"
|
||||
#include "hwloc/helper.h"
|
||||
#ifdef HWLOC_LINUX_SYS
|
||||
#include "hwloc/linux.h"
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl.h>
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* OpenCL extensions aren't always shipped with default headers, and
|
||||
* they don't always reflect what the installed implementations support.
|
||||
* Try everything and let the implementation return errors when non supported.
|
||||
*/
|
||||
/* Copyright (c) 2008-2018 The Khronos Group Inc. */
|
||||
|
||||
/* needs "cl_amd_device_attribute_query" device extension, but not strictly required for clGetDeviceInfo() */
|
||||
#define HWLOC_CL_DEVICE_TOPOLOGY_AMD 0x4037
|
||||
typedef union {
|
||||
struct { cl_uint type; cl_uint data[5]; } raw;
|
||||
struct { cl_uint type; cl_char unused[17]; cl_char bus; cl_char device; cl_char function; } pcie;
|
||||
} hwloc_cl_device_topology_amd;
|
||||
#define HWLOC_CL_DEVICE_TOPOLOGY_TYPE_PCIE_AMD 1
|
||||
|
||||
/* needs "cl_nv_device_attribute_query" device extension, but not strictly required for clGetDeviceInfo() */
|
||||
#define HWLOC_CL_DEVICE_PCI_BUS_ID_NV 0x4008
|
||||
#define HWLOC_CL_DEVICE_PCI_SLOT_ID_NV 0x4009
|
||||
#define HWLOC_CL_DEVICE_PCI_DOMAIN_ID_NV 0x400A
|
||||
|
||||
|
||||
/** \defgroup hwlocality_opencl Interoperability with OpenCL
|
||||
*
|
||||
* This interface offers ways to retrieve topology information about
|
||||
* OpenCL devices.
|
||||
*
|
||||
* Only AMD and NVIDIA OpenCL implementations currently offer useful locality
|
||||
* information about their devices.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Return the domain, bus and device IDs of the OpenCL device \p device.
|
||||
*
|
||||
* Device \p device must match the local machine.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_opencl_get_device_pci_busid(cl_device_id device,
|
||||
unsigned *domain, unsigned *bus, unsigned *dev, unsigned *func)
|
||||
{
|
||||
hwloc_cl_device_topology_amd amdtopo;
|
||||
cl_uint nvbus, nvslot, nvdomain;
|
||||
cl_int clret;
|
||||
|
||||
clret = clGetDeviceInfo(device, HWLOC_CL_DEVICE_TOPOLOGY_AMD, sizeof(amdtopo), &amdtopo, NULL);
|
||||
if (CL_SUCCESS == clret
|
||||
&& HWLOC_CL_DEVICE_TOPOLOGY_TYPE_PCIE_AMD == amdtopo.raw.type) {
|
||||
*domain = 0; /* can't do anything better */
|
||||
*bus = (unsigned) amdtopo.pcie.bus;
|
||||
*dev = (unsigned) amdtopo.pcie.device;
|
||||
*func = (unsigned) amdtopo.pcie.function;
|
||||
return 0;
|
||||
}
|
||||
|
||||
clret = clGetDeviceInfo(device, HWLOC_CL_DEVICE_PCI_BUS_ID_NV, sizeof(nvbus), &nvbus, NULL);
|
||||
if (CL_SUCCESS == clret) {
|
||||
clret = clGetDeviceInfo(device, HWLOC_CL_DEVICE_PCI_SLOT_ID_NV, sizeof(nvslot), &nvslot, NULL);
|
||||
if (CL_SUCCESS == clret) {
|
||||
clret = clGetDeviceInfo(device, HWLOC_CL_DEVICE_PCI_DOMAIN_ID_NV, sizeof(nvdomain), &nvdomain, NULL);
|
||||
if (CL_SUCCESS == clret) { /* available since CUDA 10.2 */
|
||||
*domain = nvdomain;
|
||||
} else {
|
||||
*domain = 0;
|
||||
}
|
||||
*bus = nvbus & 0xff;
|
||||
/* non-documented but used in many other projects */
|
||||
*dev = nvslot >> 3;
|
||||
*func = nvslot & 0x7;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** \brief Get the CPU set of logical processors that are physically
|
||||
* close to OpenCL device \p device.
|
||||
*
|
||||
* Return the CPU set describing the locality of the OpenCL device \p device.
|
||||
*
|
||||
* Topology \p topology and device \p device must match the local machine.
|
||||
* I/O devices detection and the OpenCL component are not needed in the topology.
|
||||
*
|
||||
* The function only returns the locality of the device.
|
||||
* If more information about the device is needed, OS objects should
|
||||
* be used instead, see hwloc_opencl_get_device_osdev()
|
||||
* and hwloc_opencl_get_device_osdev_by_index().
|
||||
*
|
||||
* This function is currently only implemented in a meaningful way for
|
||||
* Linux with the AMD or NVIDIA OpenCL implementation; other systems will simply
|
||||
* get a full cpuset.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_opencl_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||
cl_device_id device __hwloc_attribute_unused,
|
||||
hwloc_cpuset_t set)
|
||||
{
|
||||
#if (defined HWLOC_LINUX_SYS)
|
||||
/* If we're on Linux, try AMD/NVIDIA extensions + the sysfs mechanism to get the local cpus */
|
||||
#define HWLOC_OPENCL_DEVICE_SYSFS_PATH_MAX 128
|
||||
char path[HWLOC_OPENCL_DEVICE_SYSFS_PATH_MAX];
|
||||
unsigned pcidomain, pcibus, pcidev, pcifunc;
|
||||
|
||||
if (!hwloc_topology_is_thissystem(topology)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (hwloc_opencl_get_device_pci_busid(device, &pcidomain, &pcibus, &pcidev, &pcifunc) < 0) {
|
||||
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||
return 0;
|
||||
}
|
||||
|
||||
sprintf(path, "/sys/bus/pci/devices/%04x:%02x:%02x.%01x/local_cpus", pcidomain, pcibus, pcidev, pcifunc);
|
||||
if (hwloc_linux_read_path_as_cpumask(path, set) < 0
|
||||
|| hwloc_bitmap_iszero(set))
|
||||
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||
#else
|
||||
/* Non-Linux systems simply get a full cpuset */
|
||||
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** \brief Get the hwloc OS device object corresponding to the
|
||||
* OpenCL device for the given indexes.
|
||||
*
|
||||
* Return the OS device object describing the OpenCL device
|
||||
* whose platform index is \p platform_index,
|
||||
* and whose device index within this platform if \p device_index.
|
||||
* Return NULL if there is none.
|
||||
*
|
||||
* The topology \p topology does not necessarily have to match the current
|
||||
* machine. For instance the topology may be an XML import of a remote host.
|
||||
* I/O devices detection and the OpenCL component must be enabled in the topology.
|
||||
*
|
||||
* \note The corresponding PCI device object can be obtained by looking
|
||||
* at the OS device parent object (unless PCI devices are filtered out).
|
||||
*/
|
||||
static __hwloc_inline hwloc_obj_t
|
||||
hwloc_opencl_get_device_osdev_by_index(hwloc_topology_t topology,
|
||||
unsigned platform_index, unsigned device_index)
|
||||
{
|
||||
unsigned x = (unsigned) -1, y = (unsigned) -1;
|
||||
hwloc_obj_t osdev = NULL;
|
||||
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
|
||||
if (HWLOC_OBJ_OSDEV_COPROC == osdev->attr->osdev.type
|
||||
&& osdev->name
|
||||
&& sscanf(osdev->name, "opencl%ud%u", &x, &y) == 2
|
||||
&& platform_index == x && device_index == y)
|
||||
return osdev;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** \brief Get the hwloc OS device object corresponding to OpenCL device \p deviceX.
|
||||
*
|
||||
* Use OpenCL device attributes to find the corresponding hwloc OS device object.
|
||||
* Return NULL if there is none or if useful attributes are not available.
|
||||
*
|
||||
* This function currently only works on AMD and NVIDIA OpenCL devices that support
|
||||
* relevant OpenCL extensions. hwloc_opencl_get_device_osdev_by_index()
|
||||
* should be preferred whenever possible, i.e. when platform and device index
|
||||
* are known.
|
||||
*
|
||||
* Topology \p topology and device \p device must match the local machine.
|
||||
* I/O devices detection and the OpenCL component must be enabled in the topology.
|
||||
* If not, the locality of the object may still be found using
|
||||
* hwloc_opencl_get_device_cpuset().
|
||||
*
|
||||
* \note This function cannot work if PCI devices are filtered out.
|
||||
*
|
||||
* \note The corresponding hwloc PCI device may be found by looking
|
||||
* at the result parent pointer (unless PCI devices are filtered out).
|
||||
*/
|
||||
static __hwloc_inline hwloc_obj_t
|
||||
hwloc_opencl_get_device_osdev(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||
cl_device_id device __hwloc_attribute_unused)
|
||||
{
|
||||
hwloc_obj_t osdev;
|
||||
unsigned pcidomain, pcibus, pcidevice, pcifunc;
|
||||
|
||||
if (hwloc_opencl_get_device_pci_busid(device, &pcidomain, &pcibus, &pcidevice, &pcifunc) < 0) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
osdev = NULL;
|
||||
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
|
||||
hwloc_obj_t pcidev = osdev->parent;
|
||||
if (strncmp(osdev->name, "opencl", 6))
|
||||
continue;
|
||||
if (pcidev
|
||||
&& pcidev->type == HWLOC_OBJ_PCI_DEVICE
|
||||
&& pcidev->attr->pcidev.domain == pcidomain
|
||||
&& pcidev->attr->pcidev.bus == pcibus
|
||||
&& pcidev->attr->pcidev.dev == pcidevice
|
||||
&& pcidev->attr->pcidev.func == pcifunc)
|
||||
return osdev;
|
||||
/* if PCI are filtered out, we need a info attr to match on */
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* HWLOC_OPENCL_H */
|
||||
150
src/3rdparty/hwloc/include/hwloc/openfabrics-verbs.h
vendored
150
src/3rdparty/hwloc/include/hwloc/openfabrics-verbs.h
vendored
@@ -1,150 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2016 Inria. All rights reserved.
|
||||
* Copyright © 2009-2010 Université Bordeaux
|
||||
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Macros to help interaction between hwloc and OpenFabrics
|
||||
* verbs.
|
||||
*
|
||||
* Applications that use both hwloc and OpenFabrics verbs may want to
|
||||
* include this file so as to get topology information for OpenFabrics
|
||||
* hardware (InfiniBand, etc).
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HWLOC_OPENFABRICS_VERBS_H
|
||||
#define HWLOC_OPENFABRICS_VERBS_H
|
||||
|
||||
#include "hwloc.h"
|
||||
#include "hwloc/autogen/config.h"
|
||||
#ifdef HWLOC_LINUX_SYS
|
||||
#include "hwloc/linux.h"
|
||||
#endif
|
||||
|
||||
#include <infiniband/verbs.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/** \defgroup hwlocality_openfabrics Interoperability with OpenFabrics
|
||||
*
|
||||
* This interface offers ways to retrieve topology information about
|
||||
* OpenFabrics devices (InfiniBand, Omni-Path, usNIC, etc).
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Get the CPU set of logical processors that are physically
|
||||
* close to device \p ibdev.
|
||||
*
|
||||
* Return the CPU set describing the locality of the OpenFabrics
|
||||
* device \p ibdev (InfiniBand, etc).
|
||||
*
|
||||
* Topology \p topology and device \p ibdev must match the local machine.
|
||||
* I/O devices detection is not needed in the topology.
|
||||
*
|
||||
* The function only returns the locality of the device.
|
||||
* If more information about the device is needed, OS objects should
|
||||
* be used instead, see hwloc_ibv_get_device_osdev()
|
||||
* and hwloc_ibv_get_device_osdev_by_name().
|
||||
*
|
||||
* This function is currently only implemented in a meaningful way for
|
||||
* Linux; other systems will simply get a full cpuset.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_ibv_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||
struct ibv_device *ibdev, hwloc_cpuset_t set)
|
||||
{
|
||||
#ifdef HWLOC_LINUX_SYS
|
||||
/* If we're on Linux, use the verbs-provided sysfs mechanism to
|
||||
get the local cpus */
|
||||
#define HWLOC_OPENFABRICS_VERBS_SYSFS_PATH_MAX 128
|
||||
char path[HWLOC_OPENFABRICS_VERBS_SYSFS_PATH_MAX];
|
||||
|
||||
if (!hwloc_topology_is_thissystem(topology)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
sprintf(path, "/sys/class/infiniband/%s/device/local_cpus",
|
||||
ibv_get_device_name(ibdev));
|
||||
if (hwloc_linux_read_path_as_cpumask(path, set) < 0
|
||||
|| hwloc_bitmap_iszero(set))
|
||||
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||
#else
|
||||
/* Non-Linux systems simply get a full cpuset */
|
||||
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** \brief Get the hwloc OS device object corresponding to the OpenFabrics
|
||||
* device named \p ibname.
|
||||
*
|
||||
* Return the OS device object describing the OpenFabrics device
|
||||
* (InfiniBand, Omni-Path, usNIC, etc) whose name is \p ibname
|
||||
* (mlx5_0, hfi1_0, usnic_0, qib0, etc).
|
||||
* Returns NULL if there is none.
|
||||
* The name \p ibname is usually obtained from ibv_get_device_name().
|
||||
*
|
||||
* The topology \p topology does not necessarily have to match the current
|
||||
* machine. For instance the topology may be an XML import of a remote host.
|
||||
* I/O devices detection must be enabled in the topology.
|
||||
*
|
||||
* \note The corresponding PCI device object can be obtained by looking
|
||||
* at the OS device parent object.
|
||||
*/
|
||||
static __hwloc_inline hwloc_obj_t
|
||||
hwloc_ibv_get_device_osdev_by_name(hwloc_topology_t topology,
|
||||
const char *ibname)
|
||||
{
|
||||
hwloc_obj_t osdev = NULL;
|
||||
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
|
||||
if (HWLOC_OBJ_OSDEV_OPENFABRICS == osdev->attr->osdev.type
|
||||
&& osdev->name && !strcmp(ibname, osdev->name))
|
||||
return osdev;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** \brief Get the hwloc OS device object corresponding to the OpenFabrics
|
||||
* device \p ibdev.
|
||||
*
|
||||
* Return the OS device object describing the OpenFabrics device \p ibdev
|
||||
* (InfiniBand, etc). Returns NULL if there is none.
|
||||
*
|
||||
* Topology \p topology and device \p ibdev must match the local machine.
|
||||
* I/O devices detection must be enabled in the topology.
|
||||
* If not, the locality of the object may still be found using
|
||||
* hwloc_ibv_get_device_cpuset().
|
||||
*
|
||||
* \note The corresponding PCI device object can be obtained by looking
|
||||
* at the OS device parent object.
|
||||
*/
|
||||
static __hwloc_inline hwloc_obj_t
|
||||
hwloc_ibv_get_device_osdev(hwloc_topology_t topology,
|
||||
struct ibv_device *ibdev)
|
||||
{
|
||||
if (!hwloc_topology_is_thissystem(topology)) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
return hwloc_ibv_get_device_osdev_by_name(topology, ibv_get_device_name(ibdev));
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* HWLOC_OPENFABRICS_VERBS_H */
|
||||
604
src/3rdparty/hwloc/include/hwloc/plugins.h
vendored
604
src/3rdparty/hwloc/include/hwloc/plugins.h
vendored
@@ -1,604 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013-2020 Inria. All rights reserved.
|
||||
* Copyright © 2016 Cisco Systems, Inc. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef HWLOC_PLUGINS_H
|
||||
#define HWLOC_PLUGINS_H
|
||||
|
||||
/** \file
|
||||
* \brief Public interface for building hwloc plugins.
|
||||
*/
|
||||
|
||||
struct hwloc_backend;
|
||||
|
||||
#include "hwloc.h"
|
||||
|
||||
#ifdef HWLOC_INSIDE_PLUGIN
|
||||
/* needed for hwloc_plugin_check_namespace() */
|
||||
#ifdef HWLOC_HAVE_LTDL
|
||||
#include <ltdl.h>
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/** \defgroup hwlocality_disc_components Components and Plugins: Discovery components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Discovery component structure
|
||||
*
|
||||
* This is the major kind of components, taking care of the discovery.
|
||||
* They are registered by generic components, either statically-built or as plugins.
|
||||
*/
|
||||
struct hwloc_disc_component {
|
||||
/** \brief Name.
|
||||
* If this component is built as a plugin, this name does not have to match the plugin filename.
|
||||
*/
|
||||
const char *name;
|
||||
|
||||
/** \brief Discovery phases performed by this component.
|
||||
* OR'ed set of ::hwloc_disc_phase_t
|
||||
*/
|
||||
unsigned phases;
|
||||
|
||||
/** \brief Component phases to exclude, as an OR'ed set of ::hwloc_disc_phase_t.
|
||||
*
|
||||
* For a GLOBAL component, this usually includes all other phases (\c ~UL).
|
||||
*
|
||||
* Other components only exclude types that may bring conflicting
|
||||
* topology information. MISC components should likely not be excluded
|
||||
* since they usually bring non-primary additional information.
|
||||
*/
|
||||
unsigned excluded_phases;
|
||||
|
||||
/** \brief Instantiate callback to create a backend from the component.
|
||||
* Parameters data1, data2, data3 are NULL except for components
|
||||
* that have special enabling routines such as hwloc_topology_set_xml(). */
|
||||
struct hwloc_backend * (*instantiate)(struct hwloc_topology *topology, struct hwloc_disc_component *component, unsigned excluded_phases, const void *data1, const void *data2, const void *data3);
|
||||
|
||||
/** \brief Component priority.
|
||||
* Used to sort topology->components, higher priority first.
|
||||
* Also used to decide between two components with the same name.
|
||||
*
|
||||
* Usual values are
|
||||
* 50 for native OS (or platform) components,
|
||||
* 45 for x86,
|
||||
* 40 for no-OS fallback,
|
||||
* 30 for global components (xml, synthetic),
|
||||
* 20 for pci,
|
||||
* 10 for other misc components (opencl etc.).
|
||||
*/
|
||||
unsigned priority;
|
||||
|
||||
/** \brief Enabled by default.
|
||||
* If unset, if will be disabled unless explicitly requested.
|
||||
*/
|
||||
unsigned enabled_by_default;
|
||||
|
||||
/** \private Used internally to list components by priority on topology->components
|
||||
* (the component structure is usually read-only,
|
||||
* the core copies it before using this field for queueing)
|
||||
*/
|
||||
struct hwloc_disc_component * next;
|
||||
};
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
|
||||
|
||||
/** \defgroup hwlocality_disc_backends Components and Plugins: Discovery backends
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Discovery phase */
|
||||
typedef enum hwloc_disc_phase_e {
|
||||
/** \brief xml or synthetic, platform-specific components such as bgq.
|
||||
* Discovers everything including CPU, memory, I/O and everything else.
|
||||
* A component with a Global phase usually excludes all other phases.
|
||||
* \hideinitializer */
|
||||
HWLOC_DISC_PHASE_GLOBAL = (1U<<0),
|
||||
|
||||
/** \brief CPU discovery.
|
||||
* \hideinitializer */
|
||||
HWLOC_DISC_PHASE_CPU = (1U<<1),
|
||||
|
||||
/** \brief Attach memory to existing CPU objects.
|
||||
* \hideinitializer */
|
||||
HWLOC_DISC_PHASE_MEMORY = (1U<<2),
|
||||
|
||||
/** \brief Attach PCI devices and bridges to existing CPU objects.
|
||||
* \hideinitializer */
|
||||
HWLOC_DISC_PHASE_PCI = (1U<<3),
|
||||
|
||||
/** \brief I/O discovery that requires PCI devices (OS devices such as OpenCL, CUDA, etc.).
|
||||
* \hideinitializer */
|
||||
HWLOC_DISC_PHASE_IO = (1U<<4),
|
||||
|
||||
/** \brief Misc objects that gets added below anything else.
|
||||
* \hideinitializer */
|
||||
HWLOC_DISC_PHASE_MISC = (1U<<5),
|
||||
|
||||
/** \brief Annotating existing objects, adding distances, etc.
|
||||
* \hideinitializer */
|
||||
HWLOC_DISC_PHASE_ANNOTATE = (1U<<6),
|
||||
|
||||
/** \brief Final tweaks to a ready-to-use topology.
|
||||
* This phase runs once the topology is loaded, before it is returned to the topology.
|
||||
* Hence it may only use the main hwloc API for modifying the topology,
|
||||
* for instance by restricting it, adding info attributes, etc.
|
||||
* \hideinitializer */
|
||||
HWLOC_DISC_PHASE_TWEAK = (1U<<7)
|
||||
} hwloc_disc_phase_t;
|
||||
|
||||
/** \brief Discovery status flags */
|
||||
enum hwloc_disc_status_flag_e {
|
||||
/** \brief The sets of allowed resources were already retrieved \hideinitializer */
|
||||
HWLOC_DISC_STATUS_FLAG_GOT_ALLOWED_RESOURCES = (1UL<<1)
|
||||
};
|
||||
|
||||
/** \brief Discovery status structure
|
||||
*
|
||||
* Used by the core and backends to inform about what has been/is being done
|
||||
* during the discovery process.
|
||||
*/
|
||||
struct hwloc_disc_status {
|
||||
/** \brief The current discovery phase that is performed.
|
||||
* Must match one of the phases in the component phases field.
|
||||
*/
|
||||
hwloc_disc_phase_t phase;
|
||||
|
||||
/** \brief Dynamically excluded phases.
|
||||
* If a component decides during discovery that some phases are no longer needed.
|
||||
*/
|
||||
unsigned excluded_phases;
|
||||
|
||||
/** \brief OR'ed set of hwloc_disc_status_flag_e */
|
||||
unsigned long flags;
|
||||
};
|
||||
|
||||
/** \brief Discovery backend structure
|
||||
*
|
||||
* A backend is the instantiation of a discovery component.
|
||||
* When a component gets enabled for a topology,
|
||||
* its instantiate() callback creates a backend.
|
||||
*
|
||||
* hwloc_backend_alloc() initializes all fields to default values
|
||||
* that the component may change (except "component" and "next")
|
||||
* before enabling the backend with hwloc_backend_enable().
|
||||
*
|
||||
* Most backends assume that the topology is_thissystem flag is
|
||||
* set because they talk to the underlying operating system.
|
||||
* However they may still be used in topologies without the
|
||||
* is_thissystem flag for debugging reasons.
|
||||
* In practice, they are usually auto-disabled in such cases
|
||||
* (excluded by xml or synthetic backends, or by environment
|
||||
* variables when changing the Linux fsroot or the x86 cpuid path).
|
||||
*/
|
||||
struct hwloc_backend {
|
||||
/** \private Reserved for the core, set by hwloc_backend_alloc() */
|
||||
struct hwloc_disc_component * component;
|
||||
/** \private Reserved for the core, set by hwloc_backend_enable() */
|
||||
struct hwloc_topology * topology;
|
||||
/** \private Reserved for the core. Set to 1 if forced through envvar, 0 otherwise. */
|
||||
int envvar_forced;
|
||||
/** \private Reserved for the core. Used internally to list backends topology->backends. */
|
||||
struct hwloc_backend * next;
|
||||
|
||||
/** \brief Discovery phases performed by this component, possibly without some of them if excluded by other components.
|
||||
* OR'ed set of ::hwloc_disc_phase_t
|
||||
*/
|
||||
unsigned phases;
|
||||
|
||||
/** \brief Backend flags, currently always 0. */
|
||||
unsigned long flags;
|
||||
|
||||
/** \brief Backend-specific 'is_thissystem' property.
|
||||
* Set to 0 if the backend disables the thissystem flag for this topology
|
||||
* (e.g. loading from xml or synthetic string,
|
||||
* or using a different fsroot on Linux, or a x86 CPUID dump).
|
||||
* Set to -1 if the backend doesn't care (default).
|
||||
*/
|
||||
int is_thissystem;
|
||||
|
||||
/** \brief Backend private data, or NULL if none. */
|
||||
void * private_data;
|
||||
/** \brief Callback for freeing the private_data.
|
||||
* May be NULL.
|
||||
*/
|
||||
void (*disable)(struct hwloc_backend *backend);
|
||||
|
||||
/** \brief Main discovery callback.
|
||||
* returns -1 on error, either because it couldn't add its objects ot the existing topology,
|
||||
* or because of an actual discovery/gathering failure.
|
||||
* May be NULL.
|
||||
*/
|
||||
int (*discover)(struct hwloc_backend *backend, struct hwloc_disc_status *status);
|
||||
|
||||
/** \brief Callback to retrieve the locality of a PCI object.
|
||||
* Called by the PCI core when attaching PCI hierarchy to CPU objects.
|
||||
* May be NULL.
|
||||
*/
|
||||
int (*get_pci_busid_cpuset)(struct hwloc_backend *backend, struct hwloc_pcidev_attr_s *busid, hwloc_bitmap_t cpuset);
|
||||
};
|
||||
|
||||
/** \brief Allocate a backend structure, set good default values, initialize backend->component and topology, etc.
|
||||
* The caller will then modify whatever needed, and call hwloc_backend_enable().
|
||||
*/
|
||||
HWLOC_DECLSPEC struct hwloc_backend * hwloc_backend_alloc(struct hwloc_topology *topology, struct hwloc_disc_component *component);
|
||||
|
||||
/** \brief Enable a previously allocated and setup backend. */
|
||||
HWLOC_DECLSPEC int hwloc_backend_enable(struct hwloc_backend *backend);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
|
||||
|
||||
/** \defgroup hwlocality_generic_components Components and Plugins: Generic components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Generic component type */
|
||||
typedef enum hwloc_component_type_e {
|
||||
/** \brief The data field must point to a struct hwloc_disc_component. */
|
||||
HWLOC_COMPONENT_TYPE_DISC,
|
||||
|
||||
/** \brief The data field must point to a struct hwloc_xml_component. */
|
||||
HWLOC_COMPONENT_TYPE_XML
|
||||
} hwloc_component_type_t;
|
||||
|
||||
/** \brief Generic component structure
|
||||
*
|
||||
* Generic components structure, either statically listed by configure in static-components.h
|
||||
* or dynamically loaded as a plugin.
|
||||
*/
|
||||
struct hwloc_component {
|
||||
/** \brief Component ABI version, set to ::HWLOC_COMPONENT_ABI */
|
||||
unsigned abi;
|
||||
|
||||
/** \brief Process-wide component initialization callback.
|
||||
*
|
||||
* This optional callback is called when the component is registered
|
||||
* to the hwloc core (after loading the plugin).
|
||||
*
|
||||
* When the component is built as a plugin, this callback
|
||||
* should call hwloc_check_plugin_namespace()
|
||||
* and return an negative error code on error.
|
||||
*
|
||||
* \p flags is always 0 for now.
|
||||
*
|
||||
* \return 0 on success, or a negative code on error.
|
||||
*
|
||||
* \note If the component uses ltdl for loading its own plugins,
|
||||
* it should load/unload them only in init() and finalize(),
|
||||
* to avoid race conditions with hwloc's use of ltdl.
|
||||
*/
|
||||
int (*init)(unsigned long flags);
|
||||
|
||||
/** \brief Process-wide component termination callback.
|
||||
*
|
||||
* This optional callback is called after unregistering the component
|
||||
* from the hwloc core (before unloading the plugin).
|
||||
*
|
||||
* \p flags is always 0 for now.
|
||||
*
|
||||
* \note If the component uses ltdl for loading its own plugins,
|
||||
* it should load/unload them only in init() and finalize(),
|
||||
* to avoid race conditions with hwloc's use of ltdl.
|
||||
*/
|
||||
void (*finalize)(unsigned long flags);
|
||||
|
||||
/** \brief Component type */
|
||||
hwloc_component_type_t type;
|
||||
|
||||
/** \brief Component flags, unused for now */
|
||||
unsigned long flags;
|
||||
|
||||
/** \brief Component data, pointing to a struct hwloc_disc_component or struct hwloc_xml_component. */
|
||||
void * data;
|
||||
};
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
|
||||
|
||||
/** \defgroup hwlocality_components_core_funcs Components and Plugins: Core functions to be used by components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Add an object to the topology.
|
||||
*
|
||||
* It is sorted along the tree of other objects according to the inclusion of
|
||||
* cpusets, to eventually be added as a child of the smallest object including
|
||||
* this object.
|
||||
*
|
||||
* If the cpuset is empty, the type of the object (and maybe some attributes)
|
||||
* must be enough to find where to insert the object. This is especially true
|
||||
* for NUMA nodes with memory and no CPUs.
|
||||
*
|
||||
* The given object should not have children.
|
||||
*
|
||||
* This shall only be called before levels are built.
|
||||
*
|
||||
* In case of error, hwloc_report_os_error() is called.
|
||||
*
|
||||
* The caller should check whether the object type is filtered-out before calling this function.
|
||||
*
|
||||
* The topology cpuset/nodesets will be enlarged to include the object sets.
|
||||
*
|
||||
* Returns the object on success.
|
||||
* Returns NULL and frees obj on error.
|
||||
* Returns another object and frees obj if it was merged with an identical pre-existing object.
|
||||
*/
|
||||
HWLOC_DECLSPEC struct hwloc_obj *hwloc_insert_object_by_cpuset(struct hwloc_topology *topology, hwloc_obj_t obj);
|
||||
|
||||
/** \brief Type of error callbacks during object insertion */
|
||||
typedef void (*hwloc_report_error_t)(const char * msg, int line);
|
||||
/** \brief Report an insertion error from a backend */
|
||||
HWLOC_DECLSPEC void hwloc_report_os_error(const char * msg, int line);
|
||||
/** \brief Check whether insertion errors are hidden */
|
||||
HWLOC_DECLSPEC int hwloc_hide_errors(void);
|
||||
|
||||
/** \brief Add an object to the topology and specify which error callback to use.
|
||||
*
|
||||
* This function is similar to hwloc_insert_object_by_cpuset() but it allows specifying
|
||||
* where to start insertion from (if \p root is NULL, the topology root object is used),
|
||||
* and specifying the error callback.
|
||||
*/
|
||||
HWLOC_DECLSPEC struct hwloc_obj *hwloc__insert_object_by_cpuset(struct hwloc_topology *topology, hwloc_obj_t root, hwloc_obj_t obj, hwloc_report_error_t report_error);
|
||||
|
||||
/** \brief Insert an object somewhere in the topology.
|
||||
*
|
||||
* It is added as the last child of the given parent.
|
||||
* The cpuset is completely ignored, so strange objects such as I/O devices should
|
||||
* preferably be inserted with this.
|
||||
*
|
||||
* When used for "normal" children with cpusets (when importing from XML
|
||||
* when duplicating a topology), the caller should make sure that:
|
||||
* - children are inserted in order,
|
||||
* - children cpusets do not intersect.
|
||||
*
|
||||
* The given object may have normal, I/O or Misc children, as long as they are in order as well.
|
||||
* These children must have valid parent and next_sibling pointers.
|
||||
*
|
||||
* The caller should check whether the object type is filtered-out before calling this function.
|
||||
*/
|
||||
HWLOC_DECLSPEC void hwloc_insert_object_by_parent(struct hwloc_topology *topology, hwloc_obj_t parent, hwloc_obj_t obj);
|
||||
|
||||
/** \brief Allocate and initialize an object of the given type and physical index.
|
||||
*
|
||||
* If \p os_index is unknown or irrelevant, use \c HWLOC_UNKNOWN_INDEX.
|
||||
*/
|
||||
HWLOC_DECLSPEC hwloc_obj_t hwloc_alloc_setup_object(hwloc_topology_t topology, hwloc_obj_type_t type, unsigned os_index);
|
||||
|
||||
/** \brief Setup object cpusets/nodesets by OR'ing its children.
|
||||
*
|
||||
* Used when adding an object late in the topology.
|
||||
* Will update the new object by OR'ing all its new children sets.
|
||||
*
|
||||
* Used when PCI backend adds a hostbridge parent, when distances
|
||||
* add a new Group, etc.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_obj_add_children_sets(hwloc_obj_t obj);
|
||||
|
||||
/** \brief Request a reconnection of children and levels in the topology.
|
||||
*
|
||||
* May be used by backends during discovery if they need arrays or lists
|
||||
* of object within levels or children to be fully connected.
|
||||
*
|
||||
* \p flags is currently unused, must 0.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_topology_reconnect(hwloc_topology_t topology, unsigned long flags __hwloc_attribute_unused);
|
||||
|
||||
/** \brief Make sure that plugins can lookup core symbols.
|
||||
*
|
||||
* This is a sanity check to avoid lazy-lookup failures when libhwloc
|
||||
* is loaded within a plugin, and later tries to load its own plugins.
|
||||
* This may fail (and abort the program) if libhwloc symbols are in a
|
||||
* private namespace.
|
||||
*
|
||||
* \return 0 on success.
|
||||
* \return -1 if the plugin cannot be successfully loaded. The caller
|
||||
* plugin init() callback should return a negative error code as well.
|
||||
*
|
||||
* Plugins should call this function in their init() callback to avoid
|
||||
* later crashes if lazy symbol resolution is used by the upper layer that
|
||||
* loaded hwloc (e.g. OpenCL implementations using dlopen with RTLD_LAZY).
|
||||
*
|
||||
* \note The build system must define HWLOC_INSIDE_PLUGIN if and only if
|
||||
* building the caller as a plugin.
|
||||
*
|
||||
* \note This function should remain inline so plugins can call it even
|
||||
* when they cannot find libhwloc symbols.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_plugin_check_namespace(const char *pluginname __hwloc_attribute_unused, const char *symbol __hwloc_attribute_unused)
|
||||
{
|
||||
#ifdef HWLOC_INSIDE_PLUGIN
|
||||
void *sym;
|
||||
#ifdef HWLOC_HAVE_LTDL
|
||||
lt_dlhandle handle = lt_dlopen(NULL);
|
||||
#else
|
||||
void *handle = dlopen(NULL, RTLD_NOW|RTLD_LOCAL);
|
||||
#endif
|
||||
if (!handle)
|
||||
/* cannot check, assume things will work */
|
||||
return 0;
|
||||
#ifdef HWLOC_HAVE_LTDL
|
||||
sym = lt_dlsym(handle, symbol);
|
||||
lt_dlclose(handle);
|
||||
#else
|
||||
sym = dlsym(handle, symbol);
|
||||
dlclose(handle);
|
||||
#endif
|
||||
if (!sym) {
|
||||
static int verboseenv_checked = 0;
|
||||
static int verboseenv_value = 0;
|
||||
if (!verboseenv_checked) {
|
||||
const char *verboseenv = getenv("HWLOC_PLUGINS_VERBOSE");
|
||||
verboseenv_value = verboseenv ? atoi(verboseenv) : 0;
|
||||
verboseenv_checked = 1;
|
||||
}
|
||||
if (verboseenv_value)
|
||||
fprintf(stderr, "Plugin `%s' disabling itself because it cannot find the `%s' core symbol.\n",
|
||||
pluginname, symbol);
|
||||
return -1;
|
||||
}
|
||||
#endif /* HWLOC_INSIDE_PLUGIN */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
|
||||
|
||||
/** \defgroup hwlocality_components_filtering Components and Plugins: Filtering objects
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Check whether the given PCI device classid is important.
|
||||
*
|
||||
* \return 1 if important, 0 otherwise.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_filter_check_pcidev_subtype_important(unsigned classid)
|
||||
{
|
||||
unsigned baseclass = classid >> 8;
|
||||
return (baseclass == 0x03 /* PCI_BASE_CLASS_DISPLAY */
|
||||
|| baseclass == 0x02 /* PCI_BASE_CLASS_NETWORK */
|
||||
|| baseclass == 0x01 /* PCI_BASE_CLASS_STORAGE */
|
||||
|| baseclass == 0x0b /* PCI_BASE_CLASS_PROCESSOR */
|
||||
|| classid == 0x0c04 /* PCI_CLASS_SERIAL_FIBER */
|
||||
|| classid == 0x0c06 /* PCI_CLASS_SERIAL_INFINIBAND */
|
||||
|| baseclass == 0x12 /* Processing Accelerators */);
|
||||
}
|
||||
|
||||
/** \brief Check whether the given OS device subtype is important.
|
||||
*
|
||||
* \return 1 if important, 0 otherwise.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_filter_check_osdev_subtype_important(hwloc_obj_osdev_type_t subtype)
|
||||
{
|
||||
return (subtype != HWLOC_OBJ_OSDEV_DMA);
|
||||
}
|
||||
|
||||
/** \brief Check whether a non-I/O object type should be filtered-out.
|
||||
*
|
||||
* Cannot be used for I/O objects.
|
||||
*
|
||||
* \return 1 if the object type should be kept, 0 otherwise.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_filter_check_keep_object_type(hwloc_topology_t topology, hwloc_obj_type_t type)
|
||||
{
|
||||
enum hwloc_type_filter_e filter = HWLOC_TYPE_FILTER_KEEP_NONE;
|
||||
hwloc_topology_get_type_filter(topology, type, &filter);
|
||||
assert(filter != HWLOC_TYPE_FILTER_KEEP_IMPORTANT); /* IMPORTANT only used for I/O */
|
||||
return filter == HWLOC_TYPE_FILTER_KEEP_NONE ? 0 : 1;
|
||||
}
|
||||
|
||||
/** \brief Check whether the given object should be filtered-out.
|
||||
*
|
||||
* \return 1 if the object type should be kept, 0 otherwise.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_filter_check_keep_object(hwloc_topology_t topology, hwloc_obj_t obj)
|
||||
{
|
||||
hwloc_obj_type_t type = obj->type;
|
||||
enum hwloc_type_filter_e filter = HWLOC_TYPE_FILTER_KEEP_NONE;
|
||||
hwloc_topology_get_type_filter(topology, type, &filter);
|
||||
if (filter == HWLOC_TYPE_FILTER_KEEP_NONE)
|
||||
return 0;
|
||||
if (filter == HWLOC_TYPE_FILTER_KEEP_IMPORTANT) {
|
||||
if (type == HWLOC_OBJ_PCI_DEVICE)
|
||||
return hwloc_filter_check_pcidev_subtype_important(obj->attr->pcidev.class_id);
|
||||
if (type == HWLOC_OBJ_OS_DEVICE)
|
||||
return hwloc_filter_check_osdev_subtype_important(obj->attr->osdev.type);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
|
||||
|
||||
/** \defgroup hwlocality_components_pcidisc Components and Plugins: helpers for PCI discovery
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Return the offset of the given capability in the PCI config space buffer
|
||||
*
|
||||
* This function requires a 256-bytes config space. Unknown/unavailable bytes should be set to 0xff.
|
||||
*/
|
||||
HWLOC_DECLSPEC unsigned hwloc_pcidisc_find_cap(const unsigned char *config, unsigned cap);
|
||||
|
||||
/** \brief Fill linkspeed by reading the PCI config space where PCI_CAP_ID_EXP is at position offset.
|
||||
*
|
||||
* Needs 20 bytes of EXP capability block starting at offset in the config space
|
||||
* for registers up to link status.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_pcidisc_find_linkspeed(const unsigned char *config, unsigned offset, float *linkspeed);
|
||||
|
||||
/** \brief Return the hwloc object type (PCI device or Bridge) for the given class and configuration space.
|
||||
*
|
||||
* This function requires 16 bytes of common configuration header at the beginning of config.
|
||||
*/
|
||||
HWLOC_DECLSPEC hwloc_obj_type_t hwloc_pcidisc_check_bridge_type(unsigned device_class, const unsigned char *config);
|
||||
|
||||
/** \brief Fills the attributes of the given PCI bridge using the given PCI config space.
|
||||
*
|
||||
* This function requires 32 bytes of common configuration header at the beginning of config.
|
||||
*
|
||||
* Returns -1 and destroys /p obj if bridge fields are invalid.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_pcidisc_find_bridge_buses(unsigned domain, unsigned bus, unsigned dev, unsigned func,
|
||||
unsigned *secondary_busp, unsigned *subordinate_busp,
|
||||
const unsigned char *config);
|
||||
|
||||
/** \brief Insert a PCI object in the given PCI tree by looking at PCI bus IDs.
|
||||
*
|
||||
* If \p treep points to \c NULL, the new object is inserted there.
|
||||
*/
|
||||
HWLOC_DECLSPEC void hwloc_pcidisc_tree_insert_by_busid(struct hwloc_obj **treep, struct hwloc_obj *obj);
|
||||
|
||||
/** \brief Add some hostbridges on top of the given tree of PCI objects and attach them to the topology.
|
||||
*
|
||||
* Other backends may lookup PCI objects or localities (for instance to attach OS devices)
|
||||
* by using hwloc_pcidisc_find_by_busid() or hwloc_pcidisc_find_busid_parent().
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_pcidisc_tree_attach(struct hwloc_topology *topology, struct hwloc_obj *tree);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
|
||||
|
||||
/** \defgroup hwlocality_components_pcifind Components and Plugins: finding PCI objects during other discoveries
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Find the normal parent of a PCI bus ID.
|
||||
*
|
||||
* Look at PCI affinity to find out where the given PCI bus ID should be attached.
|
||||
*
|
||||
* This function should be used to attach an I/O device under the corresponding
|
||||
* PCI object (if any), or under a normal (non-I/O) object with same locality.
|
||||
*/
|
||||
HWLOC_DECLSPEC struct hwloc_obj * hwloc_pci_find_parent_by_busid(struct hwloc_topology *topology, unsigned domain, unsigned bus, unsigned dev, unsigned func);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* HWLOC_PLUGINS_H */
|
||||
794
src/3rdparty/hwloc/include/hwloc/rename.h
vendored
794
src/3rdparty/hwloc/include/hwloc/rename.h
vendored
@@ -1,794 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright © 2010-2019 Inria. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef HWLOC_RENAME_H
|
||||
#define HWLOC_RENAME_H
|
||||
|
||||
#include "hwloc/autogen/config.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Only enact these defines if we're actually renaming the symbols
|
||||
(i.e., avoid trying to have no-op defines if we're *not*
|
||||
renaming). */
|
||||
|
||||
#if HWLOC_SYM_TRANSFORM
|
||||
|
||||
/* Use a preprocessor two-step in order to get the prefixing right.
|
||||
Make 2 macros: HWLOC_NAME and HWLOC_NAME_CAPS for renaming
|
||||
things. */
|
||||
|
||||
#define HWLOC_MUNGE_NAME(a, b) HWLOC_MUNGE_NAME2(a, b)
|
||||
#define HWLOC_MUNGE_NAME2(a, b) a ## b
|
||||
#define HWLOC_NAME(name) HWLOC_MUNGE_NAME(HWLOC_SYM_PREFIX, hwloc_ ## name)
|
||||
/* FIXME: should be "HWLOC_ ## name" below, unchanged because it doesn't matter much and could break some embedders hacks */
|
||||
#define HWLOC_NAME_CAPS(name) HWLOC_MUNGE_NAME(HWLOC_SYM_PREFIX_CAPS, hwloc_ ## name)
|
||||
|
||||
/* Now define all the "real" names to be the prefixed names. This
|
||||
allows us to use the real names throughout the code base (i.e.,
|
||||
"hwloc_<foo>"); the preprocessor will adjust to have the prefixed
|
||||
name under the covers. */
|
||||
|
||||
/* Names from hwloc.h */
|
||||
|
||||
#define hwloc_get_api_version HWLOC_NAME(get_api_version)
|
||||
|
||||
#define hwloc_topology HWLOC_NAME(topology)
|
||||
#define hwloc_topology_t HWLOC_NAME(topology_t)
|
||||
|
||||
#define hwloc_cpuset_t HWLOC_NAME(cpuset_t)
|
||||
#define hwloc_const_cpuset_t HWLOC_NAME(const_cpuset_t)
|
||||
#define hwloc_nodeset_t HWLOC_NAME(nodeset_t)
|
||||
#define hwloc_const_nodeset_t HWLOC_NAME(const_nodeset_t)
|
||||
|
||||
#define HWLOC_OBJ_MACHINE HWLOC_NAME_CAPS(OBJ_MACHINE)
|
||||
#define HWLOC_OBJ_NUMANODE HWLOC_NAME_CAPS(OBJ_NUMANODE)
|
||||
#define HWLOC_OBJ_MEMCACHE HWLOC_NAME_CAPS(OBJ_MEMCACHE)
|
||||
#define HWLOC_OBJ_PACKAGE HWLOC_NAME_CAPS(OBJ_PACKAGE)
|
||||
#define HWLOC_OBJ_DIE HWLOC_NAME_CAPS(OBJ_DIE)
|
||||
#define HWLOC_OBJ_CORE HWLOC_NAME_CAPS(OBJ_CORE)
|
||||
#define HWLOC_OBJ_PU HWLOC_NAME_CAPS(OBJ_PU)
|
||||
#define HWLOC_OBJ_L1CACHE HWLOC_NAME_CAPS(OBJ_L1CACHE)
|
||||
#define HWLOC_OBJ_L2CACHE HWLOC_NAME_CAPS(OBJ_L2CACHE)
|
||||
#define HWLOC_OBJ_L3CACHE HWLOC_NAME_CAPS(OBJ_L3CACHE)
|
||||
#define HWLOC_OBJ_L4CACHE HWLOC_NAME_CAPS(OBJ_L4CACHE)
|
||||
#define HWLOC_OBJ_L5CACHE HWLOC_NAME_CAPS(OBJ_L5CACHE)
|
||||
#define HWLOC_OBJ_L1ICACHE HWLOC_NAME_CAPS(OBJ_L1ICACHE)
|
||||
#define HWLOC_OBJ_L2ICACHE HWLOC_NAME_CAPS(OBJ_L2ICACHE)
|
||||
#define HWLOC_OBJ_L3ICACHE HWLOC_NAME_CAPS(OBJ_L3ICACHE)
|
||||
#define HWLOC_OBJ_MISC HWLOC_NAME_CAPS(OBJ_MISC)
|
||||
#define HWLOC_OBJ_GROUP HWLOC_NAME_CAPS(OBJ_GROUP)
|
||||
#define HWLOC_OBJ_BRIDGE HWLOC_NAME_CAPS(OBJ_BRIDGE)
|
||||
#define HWLOC_OBJ_PCI_DEVICE HWLOC_NAME_CAPS(OBJ_PCI_DEVICE)
|
||||
#define HWLOC_OBJ_OS_DEVICE HWLOC_NAME_CAPS(OBJ_OS_DEVICE)
|
||||
#define HWLOC_OBJ_TYPE_MAX HWLOC_NAME_CAPS(OBJ_TYPE_MAX)
|
||||
#define hwloc_obj_type_t HWLOC_NAME(obj_type_t)
|
||||
|
||||
#define hwloc_obj_cache_type_e HWLOC_NAME(obj_cache_type_e)
|
||||
#define hwloc_obj_cache_type_t HWLOC_NAME(obj_cache_type_t)
|
||||
#define HWLOC_OBJ_CACHE_UNIFIED HWLOC_NAME_CAPS(OBJ_CACHE_UNIFIED)
|
||||
#define HWLOC_OBJ_CACHE_DATA HWLOC_NAME_CAPS(OBJ_CACHE_DATA)
|
||||
#define HWLOC_OBJ_CACHE_INSTRUCTION HWLOC_NAME_CAPS(OBJ_CACHE_INSTRUCTION)
|
||||
|
||||
#define hwloc_obj_bridge_type_e HWLOC_NAME(obj_bridge_type_e)
|
||||
#define hwloc_obj_bridge_type_t HWLOC_NAME(obj_bridge_type_t)
|
||||
#define HWLOC_OBJ_BRIDGE_HOST HWLOC_NAME_CAPS(OBJ_BRIDGE_HOST)
|
||||
#define HWLOC_OBJ_BRIDGE_PCI HWLOC_NAME_CAPS(OBJ_BRIDGE_PCI)
|
||||
|
||||
#define hwloc_obj_osdev_type_e HWLOC_NAME(obj_osdev_type_e)
|
||||
#define hwloc_obj_osdev_type_t HWLOC_NAME(obj_osdev_type_t)
|
||||
#define HWLOC_OBJ_OSDEV_BLOCK HWLOC_NAME_CAPS(OBJ_OSDEV_BLOCK)
|
||||
#define HWLOC_OBJ_OSDEV_GPU HWLOC_NAME_CAPS(OBJ_OSDEV_GPU)
|
||||
#define HWLOC_OBJ_OSDEV_NETWORK HWLOC_NAME_CAPS(OBJ_OSDEV_NETWORK)
|
||||
#define HWLOC_OBJ_OSDEV_OPENFABRICS HWLOC_NAME_CAPS(OBJ_OSDEV_OPENFABRICS)
|
||||
#define HWLOC_OBJ_OSDEV_DMA HWLOC_NAME_CAPS(OBJ_OSDEV_DMA)
|
||||
#define HWLOC_OBJ_OSDEV_COPROC HWLOC_NAME_CAPS(OBJ_OSDEV_COPROC)
|
||||
|
||||
#define hwloc_compare_types HWLOC_NAME(compare_types)
|
||||
|
||||
#define hwloc_obj HWLOC_NAME(obj)
|
||||
#define hwloc_obj_t HWLOC_NAME(obj_t)
|
||||
|
||||
#define hwloc_info_s HWLOC_NAME(info_s)
|
||||
|
||||
#define hwloc_obj_attr_u HWLOC_NAME(obj_attr_u)
|
||||
#define hwloc_numanode_attr_s HWLOC_NAME(numanode_attr_s)
|
||||
#define hwloc_memory_page_type_s HWLOC_NAME(memory_page_type_s)
|
||||
#define hwloc_cache_attr_s HWLOC_NAME(cache_attr_s)
|
||||
#define hwloc_group_attr_s HWLOC_NAME(group_attr_s)
|
||||
#define hwloc_pcidev_attr_s HWLOC_NAME(pcidev_attr_s)
|
||||
#define hwloc_bridge_attr_s HWLOC_NAME(bridge_attr_s)
|
||||
#define hwloc_osdev_attr_s HWLOC_NAME(osdev_attr_s)
|
||||
|
||||
#define hwloc_topology_init HWLOC_NAME(topology_init)
|
||||
#define hwloc_topology_load HWLOC_NAME(topology_load)
|
||||
#define hwloc_topology_destroy HWLOC_NAME(topology_destroy)
|
||||
#define hwloc_topology_dup HWLOC_NAME(topology_dup)
|
||||
#define hwloc_topology_abi_check HWLOC_NAME(topology_abi_check)
|
||||
#define hwloc_topology_check HWLOC_NAME(topology_check)
|
||||
|
||||
#define hwloc_topology_flags_e HWLOC_NAME(topology_flags_e)
|
||||
|
||||
#define HWLOC_TOPOLOGY_FLAG_INCLUDE_DISALLOWED HWLOC_NAME_CAPS(TOPOLOGY_FLAG_WITH_DISALLOWED)
|
||||
#define HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM HWLOC_NAME_CAPS(TOPOLOGY_FLAG_IS_THISSYSTEM)
|
||||
#define HWLOC_TOPOLOGY_FLAG_THISSYSTEM_ALLOWED_RESOURCES HWLOC_NAME_CAPS(TOPOLOGY_FLAG_THISSYSTEM_ALLOWED_RESOURCES)
|
||||
|
||||
#define hwloc_topology_set_pid HWLOC_NAME(topology_set_pid)
|
||||
#define hwloc_topology_set_synthetic HWLOC_NAME(topology_set_synthetic)
|
||||
#define hwloc_topology_set_xml HWLOC_NAME(topology_set_xml)
|
||||
#define hwloc_topology_set_xmlbuffer HWLOC_NAME(topology_set_xmlbuffer)
|
||||
#define hwloc_topology_components_flag_e HWLOC_NAME(hwloc_topology_components_flag_e)
|
||||
#define HWLOC_TOPOLOGY_COMPONENTS_FLAG_BLACKLIST HWLOC_NAME_CAPS(TOPOLOGY_COMPONENTS_FLAG_BLACKLIST)
|
||||
#define hwloc_topology_set_components HWLOC_NAME(topology_set_components)
|
||||
|
||||
#define hwloc_topology_set_flags HWLOC_NAME(topology_set_flags)
|
||||
#define hwloc_topology_is_thissystem HWLOC_NAME(topology_is_thissystem)
|
||||
#define hwloc_topology_get_flags HWLOC_NAME(topology_get_flags)
|
||||
#define hwloc_topology_discovery_support HWLOC_NAME(topology_discovery_support)
|
||||
#define hwloc_topology_cpubind_support HWLOC_NAME(topology_cpubind_support)
|
||||
#define hwloc_topology_membind_support HWLOC_NAME(topology_membind_support)
|
||||
#define hwloc_topology_support HWLOC_NAME(topology_support)
|
||||
#define hwloc_topology_get_support HWLOC_NAME(topology_get_support)
|
||||
|
||||
#define hwloc_type_filter_e HWLOC_NAME(type_filter_e)
|
||||
#define HWLOC_TYPE_FILTER_KEEP_ALL HWLOC_NAME_CAPS(TYPE_FILTER_KEEP_ALL)
|
||||
#define HWLOC_TYPE_FILTER_KEEP_NONE HWLOC_NAME_CAPS(TYPE_FILTER_KEEP_NONE)
|
||||
#define HWLOC_TYPE_FILTER_KEEP_STRUCTURE HWLOC_NAME_CAPS(TYPE_FILTER_KEEP_STRUCTURE)
|
||||
#define HWLOC_TYPE_FILTER_KEEP_IMPORTANT HWLOC_NAME_CAPS(TYPE_FILTER_KEEP_IMPORTANT)
|
||||
#define hwloc_topology_set_type_filter HWLOC_NAME(topology_set_type_filter)
|
||||
#define hwloc_topology_get_type_filter HWLOC_NAME(topology_get_type_filter)
|
||||
#define hwloc_topology_set_all_types_filter HWLOC_NAME(topology_set_all_types_filter)
|
||||
#define hwloc_topology_set_cache_types_filter HWLOC_NAME(topology_set_cache_types_filter)
|
||||
#define hwloc_topology_set_icache_types_filter HWLOC_NAME(topology_set_icache_types_filter)
|
||||
#define hwloc_topology_set_io_types_filter HWLOC_NAME(topology_set_io_types_filter)
|
||||
|
||||
#define hwloc_topology_set_userdata HWLOC_NAME(topology_set_userdata)
|
||||
#define hwloc_topology_get_userdata HWLOC_NAME(topology_get_userdata)
|
||||
|
||||
#define hwloc_restrict_flags_e HWLOC_NAME(restrict_flags_e)
|
||||
#define HWLOC_RESTRICT_FLAG_REMOVE_CPULESS HWLOC_NAME_CAPS(RESTRICT_FLAG_REMOVE_CPULESS)
|
||||
#define HWLOC_RESTRICT_FLAG_BYNODESET HWLOC_NAME_CAPS(RESTRICT_FLAG_BYNODESET)
|
||||
#define HWLOC_RESTRICT_FLAG_REMOVE_MEMLESS HWLOC_NAME_CAPS(RESTRICT_FLAG_REMOVE_MEMLESS)
|
||||
#define HWLOC_RESTRICT_FLAG_ADAPT_MISC HWLOC_NAME_CAPS(RESTRICT_FLAG_ADAPT_MISC)
|
||||
#define HWLOC_RESTRICT_FLAG_ADAPT_IO HWLOC_NAME_CAPS(RESTRICT_FLAG_ADAPT_IO)
|
||||
#define hwloc_topology_restrict HWLOC_NAME(topology_restrict)
|
||||
|
||||
#define hwloc_allow_flags_e HWLOC_NAME(allow_flags_e)
|
||||
#define HWLOC_ALLOW_FLAG_ALL HWLOC_NAME_CAPS(ALLOW_FLAG_ALL)
|
||||
#define HWLOC_ALLOW_FLAG_LOCAL_RESTRICTIONS HWLOC_NAME_CAPS(ALLOW_FLAG_LOCAL_RESTRICTIONS)
|
||||
#define HWLOC_ALLOW_FLAG_CUSTOM HWLOC_NAME_CAPS(ALLOW_FLAG_CUSTOM)
|
||||
#define hwloc_topology_allow HWLOC_NAME(topology_allow)
|
||||
|
||||
#define hwloc_topology_insert_misc_object HWLOC_NAME(topology_insert_misc_object)
|
||||
#define hwloc_topology_alloc_group_object HWLOC_NAME(topology_alloc_group_object)
|
||||
#define hwloc_topology_insert_group_object HWLOC_NAME(topology_insert_group_object)
|
||||
#define hwloc_obj_add_other_obj_sets HWLOC_NAME(obj_add_other_obj_sets)
|
||||
|
||||
#define hwloc_topology_get_depth HWLOC_NAME(topology_get_depth)
|
||||
#define hwloc_get_type_depth HWLOC_NAME(get_type_depth)
|
||||
#define hwloc_get_memory_parents_depth HWLOC_NAME(get_memory_parents_depth)
|
||||
|
||||
#define hwloc_get_type_depth_e HWLOC_NAME(get_type_depth_e)
|
||||
#define HWLOC_TYPE_DEPTH_UNKNOWN HWLOC_NAME_CAPS(TYPE_DEPTH_UNKNOWN)
|
||||
#define HWLOC_TYPE_DEPTH_MULTIPLE HWLOC_NAME_CAPS(TYPE_DEPTH_MULTIPLE)
|
||||
#define HWLOC_TYPE_DEPTH_BRIDGE HWLOC_NAME_CAPS(TYPE_DEPTH_BRIDGE)
|
||||
#define HWLOC_TYPE_DEPTH_PCI_DEVICE HWLOC_NAME_CAPS(TYPE_DEPTH_PCI_DEVICE)
|
||||
#define HWLOC_TYPE_DEPTH_OS_DEVICE HWLOC_NAME_CAPS(TYPE_DEPTH_OS_DEVICE)
|
||||
#define HWLOC_TYPE_DEPTH_MISC HWLOC_NAME_CAPS(TYPE_DEPTH_MISC)
|
||||
#define HWLOC_TYPE_DEPTH_NUMANODE HWLOC_NAME_CAPS(TYPE_DEPTH_NUMANODE)
|
||||
#define HWLOC_TYPE_DEPTH_MEMCACHE HWLOC_NAME_CAPS(TYPE_DEPTH_MEMCACHE)
|
||||
|
||||
#define hwloc_get_depth_type HWLOC_NAME(get_depth_type)
|
||||
#define hwloc_get_nbobjs_by_depth HWLOC_NAME(get_nbobjs_by_depth)
|
||||
#define hwloc_get_nbobjs_by_type HWLOC_NAME(get_nbobjs_by_type)
|
||||
|
||||
#define hwloc_get_obj_by_depth HWLOC_NAME(get_obj_by_depth )
|
||||
#define hwloc_get_obj_by_type HWLOC_NAME(get_obj_by_type )
|
||||
|
||||
#define hwloc_obj_type_string HWLOC_NAME(obj_type_string )
|
||||
#define hwloc_obj_type_snprintf HWLOC_NAME(obj_type_snprintf )
|
||||
#define hwloc_obj_attr_snprintf HWLOC_NAME(obj_attr_snprintf )
|
||||
#define hwloc_type_sscanf HWLOC_NAME(type_sscanf)
|
||||
#define hwloc_type_sscanf_as_depth HWLOC_NAME(type_sscanf_as_depth)
|
||||
|
||||
#define hwloc_obj_get_info_by_name HWLOC_NAME(obj_get_info_by_name)
|
||||
#define hwloc_obj_add_info HWLOC_NAME(obj_add_info)
|
||||
|
||||
#define HWLOC_CPUBIND_PROCESS HWLOC_NAME_CAPS(CPUBIND_PROCESS)
|
||||
#define HWLOC_CPUBIND_THREAD HWLOC_NAME_CAPS(CPUBIND_THREAD)
|
||||
#define HWLOC_CPUBIND_STRICT HWLOC_NAME_CAPS(CPUBIND_STRICT)
|
||||
#define HWLOC_CPUBIND_NOMEMBIND HWLOC_NAME_CAPS(CPUBIND_NOMEMBIND)
|
||||
|
||||
#define hwloc_cpubind_flags_t HWLOC_NAME(cpubind_flags_t)
|
||||
|
||||
#define hwloc_set_cpubind HWLOC_NAME(set_cpubind)
|
||||
#define hwloc_get_cpubind HWLOC_NAME(get_cpubind)
|
||||
#define hwloc_set_proc_cpubind HWLOC_NAME(set_proc_cpubind)
|
||||
#define hwloc_get_proc_cpubind HWLOC_NAME(get_proc_cpubind)
|
||||
#define hwloc_set_thread_cpubind HWLOC_NAME(set_thread_cpubind)
|
||||
#define hwloc_get_thread_cpubind HWLOC_NAME(get_thread_cpubind)
|
||||
|
||||
#define hwloc_get_last_cpu_location HWLOC_NAME(get_last_cpu_location)
|
||||
#define hwloc_get_proc_last_cpu_location HWLOC_NAME(get_proc_last_cpu_location)
|
||||
|
||||
#define HWLOC_MEMBIND_DEFAULT HWLOC_NAME_CAPS(MEMBIND_DEFAULT)
|
||||
#define HWLOC_MEMBIND_FIRSTTOUCH HWLOC_NAME_CAPS(MEMBIND_FIRSTTOUCH)
|
||||
#define HWLOC_MEMBIND_BIND HWLOC_NAME_CAPS(MEMBIND_BIND)
|
||||
#define HWLOC_MEMBIND_INTERLEAVE HWLOC_NAME_CAPS(MEMBIND_INTERLEAVE)
|
||||
#define HWLOC_MEMBIND_NEXTTOUCH HWLOC_NAME_CAPS(MEMBIND_NEXTTOUCH)
|
||||
#define HWLOC_MEMBIND_MIXED HWLOC_NAME_CAPS(MEMBIND_MIXED)
|
||||
|
||||
#define hwloc_membind_policy_t HWLOC_NAME(membind_policy_t)
|
||||
|
||||
#define HWLOC_MEMBIND_PROCESS HWLOC_NAME_CAPS(MEMBIND_PROCESS)
|
||||
#define HWLOC_MEMBIND_THREAD HWLOC_NAME_CAPS(MEMBIND_THREAD)
|
||||
#define HWLOC_MEMBIND_STRICT HWLOC_NAME_CAPS(MEMBIND_STRICT)
|
||||
#define HWLOC_MEMBIND_MIGRATE HWLOC_NAME_CAPS(MEMBIND_MIGRATE)
|
||||
#define HWLOC_MEMBIND_NOCPUBIND HWLOC_NAME_CAPS(MEMBIND_NOCPUBIND)
|
||||
#define HWLOC_MEMBIND_BYNODESET HWLOC_NAME_CAPS(MEMBIND_BYNODESET)
|
||||
|
||||
#define hwloc_membind_flags_t HWLOC_NAME(membind_flags_t)
|
||||
|
||||
#define hwloc_set_membind HWLOC_NAME(set_membind)
|
||||
#define hwloc_get_membind HWLOC_NAME(get_membind)
|
||||
#define hwloc_set_proc_membind HWLOC_NAME(set_proc_membind)
|
||||
#define hwloc_get_proc_membind HWLOC_NAME(get_proc_membind)
|
||||
#define hwloc_set_area_membind HWLOC_NAME(set_area_membind)
|
||||
#define hwloc_get_area_membind HWLOC_NAME(get_area_membind)
|
||||
#define hwloc_get_area_memlocation HWLOC_NAME(get_area_memlocation)
|
||||
#define hwloc_alloc_membind HWLOC_NAME(alloc_membind)
|
||||
#define hwloc_alloc HWLOC_NAME(alloc)
|
||||
#define hwloc_free HWLOC_NAME(free)
|
||||
|
||||
#define hwloc_get_non_io_ancestor_obj HWLOC_NAME(get_non_io_ancestor_obj)
|
||||
#define hwloc_get_next_pcidev HWLOC_NAME(get_next_pcidev)
|
||||
#define hwloc_get_pcidev_by_busid HWLOC_NAME(get_pcidev_by_busid)
|
||||
#define hwloc_get_pcidev_by_busidstring HWLOC_NAME(get_pcidev_by_busidstring)
|
||||
#define hwloc_get_next_osdev HWLOC_NAME(get_next_osdev)
|
||||
#define hwloc_get_next_bridge HWLOC_NAME(get_next_bridge)
|
||||
#define hwloc_bridge_covers_pcibus HWLOC_NAME(bridge_covers_pcibus)
|
||||
|
||||
/* hwloc/bitmap.h */
|
||||
|
||||
#define hwloc_bitmap_s HWLOC_NAME(bitmap_s)
|
||||
#define hwloc_bitmap_t HWLOC_NAME(bitmap_t)
|
||||
#define hwloc_const_bitmap_t HWLOC_NAME(const_bitmap_t)
|
||||
|
||||
#define hwloc_bitmap_alloc HWLOC_NAME(bitmap_alloc)
|
||||
#define hwloc_bitmap_alloc_full HWLOC_NAME(bitmap_alloc_full)
|
||||
#define hwloc_bitmap_free HWLOC_NAME(bitmap_free)
|
||||
#define hwloc_bitmap_dup HWLOC_NAME(bitmap_dup)
|
||||
#define hwloc_bitmap_copy HWLOC_NAME(bitmap_copy)
|
||||
#define hwloc_bitmap_snprintf HWLOC_NAME(bitmap_snprintf)
|
||||
#define hwloc_bitmap_asprintf HWLOC_NAME(bitmap_asprintf)
|
||||
#define hwloc_bitmap_sscanf HWLOC_NAME(bitmap_sscanf)
|
||||
#define hwloc_bitmap_list_snprintf HWLOC_NAME(bitmap_list_snprintf)
|
||||
#define hwloc_bitmap_list_asprintf HWLOC_NAME(bitmap_list_asprintf)
|
||||
#define hwloc_bitmap_list_sscanf HWLOC_NAME(bitmap_list_sscanf)
|
||||
#define hwloc_bitmap_taskset_snprintf HWLOC_NAME(bitmap_taskset_snprintf)
|
||||
#define hwloc_bitmap_taskset_asprintf HWLOC_NAME(bitmap_taskset_asprintf)
|
||||
#define hwloc_bitmap_taskset_sscanf HWLOC_NAME(bitmap_taskset_sscanf)
|
||||
#define hwloc_bitmap_zero HWLOC_NAME(bitmap_zero)
|
||||
#define hwloc_bitmap_fill HWLOC_NAME(bitmap_fill)
|
||||
#define hwloc_bitmap_from_ulong HWLOC_NAME(bitmap_from_ulong)
|
||||
#define hwloc_bitmap_from_ulongs HWLOC_NAME(bitmap_from_ulongs)
|
||||
#define hwloc_bitmap_from_ith_ulong HWLOC_NAME(bitmap_from_ith_ulong)
|
||||
#define hwloc_bitmap_to_ulong HWLOC_NAME(bitmap_to_ulong)
|
||||
#define hwloc_bitmap_to_ith_ulong HWLOC_NAME(bitmap_to_ith_ulong)
|
||||
#define hwloc_bitmap_to_ulongs HWLOC_NAME(bitmap_to_ulongs)
|
||||
#define hwloc_bitmap_nr_ulongs HWLOC_NAME(bitmap_nr_ulongs)
|
||||
#define hwloc_bitmap_only HWLOC_NAME(bitmap_only)
|
||||
#define hwloc_bitmap_allbut HWLOC_NAME(bitmap_allbut)
|
||||
#define hwloc_bitmap_set HWLOC_NAME(bitmap_set)
|
||||
#define hwloc_bitmap_set_range HWLOC_NAME(bitmap_set_range)
|
||||
#define hwloc_bitmap_set_ith_ulong HWLOC_NAME(bitmap_set_ith_ulong)
|
||||
#define hwloc_bitmap_clr HWLOC_NAME(bitmap_clr)
|
||||
#define hwloc_bitmap_clr_range HWLOC_NAME(bitmap_clr_range)
|
||||
#define hwloc_bitmap_isset HWLOC_NAME(bitmap_isset)
|
||||
#define hwloc_bitmap_iszero HWLOC_NAME(bitmap_iszero)
|
||||
#define hwloc_bitmap_isfull HWLOC_NAME(bitmap_isfull)
|
||||
#define hwloc_bitmap_isequal HWLOC_NAME(bitmap_isequal)
|
||||
#define hwloc_bitmap_intersects HWLOC_NAME(bitmap_intersects)
|
||||
#define hwloc_bitmap_isincluded HWLOC_NAME(bitmap_isincluded)
|
||||
#define hwloc_bitmap_or HWLOC_NAME(bitmap_or)
|
||||
#define hwloc_bitmap_and HWLOC_NAME(bitmap_and)
|
||||
#define hwloc_bitmap_andnot HWLOC_NAME(bitmap_andnot)
|
||||
#define hwloc_bitmap_xor HWLOC_NAME(bitmap_xor)
|
||||
#define hwloc_bitmap_not HWLOC_NAME(bitmap_not)
|
||||
#define hwloc_bitmap_first HWLOC_NAME(bitmap_first)
|
||||
#define hwloc_bitmap_last HWLOC_NAME(bitmap_last)
|
||||
#define hwloc_bitmap_next HWLOC_NAME(bitmap_next)
|
||||
#define hwloc_bitmap_first_unset HWLOC_NAME(bitmap_first_unset)
|
||||
#define hwloc_bitmap_last_unset HWLOC_NAME(bitmap_last_unset)
|
||||
#define hwloc_bitmap_next_unset HWLOC_NAME(bitmap_next_unset)
|
||||
#define hwloc_bitmap_singlify HWLOC_NAME(bitmap_singlify)
|
||||
#define hwloc_bitmap_compare_first HWLOC_NAME(bitmap_compare_first)
|
||||
#define hwloc_bitmap_compare HWLOC_NAME(bitmap_compare)
|
||||
#define hwloc_bitmap_weight HWLOC_NAME(bitmap_weight)
|
||||
|
||||
/* hwloc/helper.h */
|
||||
|
||||
#define hwloc_get_type_or_below_depth HWLOC_NAME(get_type_or_below_depth)
|
||||
#define hwloc_get_type_or_above_depth HWLOC_NAME(get_type_or_above_depth)
|
||||
#define hwloc_get_root_obj HWLOC_NAME(get_root_obj)
|
||||
#define hwloc_get_ancestor_obj_by_depth HWLOC_NAME(get_ancestor_obj_by_depth)
|
||||
#define hwloc_get_ancestor_obj_by_type HWLOC_NAME(get_ancestor_obj_by_type)
|
||||
#define hwloc_get_next_obj_by_depth HWLOC_NAME(get_next_obj_by_depth)
|
||||
#define hwloc_get_next_obj_by_type HWLOC_NAME(get_next_obj_by_type)
|
||||
#define hwloc_bitmap_singlify_per_core HWLOC_NAME(bitmap_singlify_by_core)
|
||||
#define hwloc_get_pu_obj_by_os_index HWLOC_NAME(get_pu_obj_by_os_index)
|
||||
#define hwloc_get_numanode_obj_by_os_index HWLOC_NAME(get_numanode_obj_by_os_index)
|
||||
#define hwloc_get_next_child HWLOC_NAME(get_next_child)
|
||||
#define hwloc_get_common_ancestor_obj HWLOC_NAME(get_common_ancestor_obj)
|
||||
#define hwloc_obj_is_in_subtree HWLOC_NAME(obj_is_in_subtree)
|
||||
#define hwloc_get_first_largest_obj_inside_cpuset HWLOC_NAME(get_first_largest_obj_inside_cpuset)
|
||||
#define hwloc_get_largest_objs_inside_cpuset HWLOC_NAME(get_largest_objs_inside_cpuset)
|
||||
#define hwloc_get_next_obj_inside_cpuset_by_depth HWLOC_NAME(get_next_obj_inside_cpuset_by_depth)
|
||||
#define hwloc_get_next_obj_inside_cpuset_by_type HWLOC_NAME(get_next_obj_inside_cpuset_by_type)
|
||||
#define hwloc_get_obj_inside_cpuset_by_depth HWLOC_NAME(get_obj_inside_cpuset_by_depth)
|
||||
#define hwloc_get_obj_inside_cpuset_by_type HWLOC_NAME(get_obj_inside_cpuset_by_type)
|
||||
#define hwloc_get_nbobjs_inside_cpuset_by_depth HWLOC_NAME(get_nbobjs_inside_cpuset_by_depth)
|
||||
#define hwloc_get_nbobjs_inside_cpuset_by_type HWLOC_NAME(get_nbobjs_inside_cpuset_by_type)
|
||||
#define hwloc_get_obj_index_inside_cpuset HWLOC_NAME(get_obj_index_inside_cpuset)
|
||||
#define hwloc_get_child_covering_cpuset HWLOC_NAME(get_child_covering_cpuset)
|
||||
#define hwloc_get_obj_covering_cpuset HWLOC_NAME(get_obj_covering_cpuset)
|
||||
#define hwloc_get_next_obj_covering_cpuset_by_depth HWLOC_NAME(get_next_obj_covering_cpuset_by_depth)
|
||||
#define hwloc_get_next_obj_covering_cpuset_by_type HWLOC_NAME(get_next_obj_covering_cpuset_by_type)
|
||||
#define hwloc_obj_type_is_normal HWLOC_NAME(obj_type_is_normal)
|
||||
#define hwloc_obj_type_is_memory HWLOC_NAME(obj_type_is_memory)
|
||||
#define hwloc_obj_type_is_io HWLOC_NAME(obj_type_is_io)
|
||||
#define hwloc_obj_type_is_cache HWLOC_NAME(obj_type_is_cache)
|
||||
#define hwloc_obj_type_is_dcache HWLOC_NAME(obj_type_is_dcache)
|
||||
#define hwloc_obj_type_is_icache HWLOC_NAME(obj_type_is_icache)
|
||||
#define hwloc_get_cache_type_depth HWLOC_NAME(get_cache_type_depth)
|
||||
#define hwloc_get_cache_covering_cpuset HWLOC_NAME(get_cache_covering_cpuset)
|
||||
#define hwloc_get_shared_cache_covering_obj HWLOC_NAME(get_shared_cache_covering_obj)
|
||||
#define hwloc_get_closest_objs HWLOC_NAME(get_closest_objs)
|
||||
#define hwloc_get_obj_below_by_type HWLOC_NAME(get_obj_below_by_type)
|
||||
#define hwloc_get_obj_below_array_by_type HWLOC_NAME(get_obj_below_array_by_type)
|
||||
#define hwloc_distrib_flags_e HWLOC_NAME(distrib_flags_e)
|
||||
#define HWLOC_DISTRIB_FLAG_REVERSE HWLOC_NAME_CAPS(DISTRIB_FLAG_REVERSE)
|
||||
#define hwloc_distrib HWLOC_NAME(distrib)
|
||||
#define hwloc_alloc_membind_policy HWLOC_NAME(alloc_membind_policy)
|
||||
#define hwloc_alloc_membind_policy_nodeset HWLOC_NAME(alloc_membind_policy_nodeset)
|
||||
#define hwloc_topology_get_complete_cpuset HWLOC_NAME(topology_get_complete_cpuset)
|
||||
#define hwloc_topology_get_topology_cpuset HWLOC_NAME(topology_get_topology_cpuset)
|
||||
#define hwloc_topology_get_allowed_cpuset HWLOC_NAME(topology_get_allowed_cpuset)
|
||||
#define hwloc_topology_get_complete_nodeset HWLOC_NAME(topology_get_complete_nodeset)
|
||||
#define hwloc_topology_get_topology_nodeset HWLOC_NAME(topology_get_topology_nodeset)
|
||||
#define hwloc_topology_get_allowed_nodeset HWLOC_NAME(topology_get_allowed_nodeset)
|
||||
#define hwloc_cpuset_to_nodeset HWLOC_NAME(cpuset_to_nodeset)
|
||||
#define hwloc_cpuset_from_nodeset HWLOC_NAME(cpuset_from_nodeset)
|
||||
|
||||
/* export.h */
|
||||
|
||||
#define hwloc_topology_export_xml_flags_e HWLOC_NAME(topology_export_xml_flags_e)
|
||||
#define HWLOC_TOPOLOGY_EXPORT_XML_FLAG_V1 HWLOC_NAME_CAPS(TOPOLOGY_EXPORT_XML_FLAG_V1)
|
||||
#define hwloc_topology_export_xml HWLOC_NAME(topology_export_xml)
|
||||
#define hwloc_topology_export_xmlbuffer HWLOC_NAME(topology_export_xmlbuffer)
|
||||
#define hwloc_free_xmlbuffer HWLOC_NAME(free_xmlbuffer)
|
||||
#define hwloc_topology_set_userdata_export_callback HWLOC_NAME(topology_set_userdata_export_callback)
|
||||
#define hwloc_export_obj_userdata HWLOC_NAME(export_obj_userdata)
|
||||
#define hwloc_export_obj_userdata_base64 HWLOC_NAME(export_obj_userdata_base64)
|
||||
#define hwloc_topology_set_userdata_import_callback HWLOC_NAME(topology_set_userdata_import_callback)
|
||||
|
||||
#define hwloc_topology_export_synthetic_flags_e HWLOC_NAME(topology_export_synthetic_flags_e)
|
||||
#define HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_EXTENDED_TYPES HWLOC_NAME_CAPS(TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_EXTENDED_TYPES)
|
||||
#define HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_ATTRS HWLOC_NAME_CAPS(TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_ATTRS)
|
||||
#define HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_V1 HWLOC_NAME_CAPS(TOPOLOGY_EXPORT_SYNTHETIC_FLAG_V1)
|
||||
#define HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_IGNORE_MEMORY HWLOC_NAME_CAPS(TOPOLOGY_EXPORT_SYNTHETIC_FLAG_IGNORE_MEMORY)
|
||||
#define hwloc_topology_export_synthetic HWLOC_NAME(topology_export_synthetic)
|
||||
|
||||
/* distances.h */
|
||||
|
||||
#define hwloc_distances_s HWLOC_NAME(distances_s)
|
||||
|
||||
#define hwloc_distances_kind_e HWLOC_NAME(distances_kind_e)
|
||||
#define HWLOC_DISTANCES_KIND_FROM_OS HWLOC_NAME_CAPS(DISTANCES_KIND_FROM_OS)
|
||||
#define HWLOC_DISTANCES_KIND_FROM_USER HWLOC_NAME_CAPS(DISTANCES_KIND_FROM_USER)
|
||||
#define HWLOC_DISTANCES_KIND_MEANS_LATENCY HWLOC_NAME_CAPS(DISTANCES_KIND_MEANS_LATENCY)
|
||||
#define HWLOC_DISTANCES_KIND_MEANS_BANDWIDTH HWLOC_NAME_CAPS(DISTANCES_KIND_MEANS_BANDWIDTH)
|
||||
#define HWLOC_DISTANCES_KIND_HETEROGENEOUS_TYPES HWLOC_NAME_CAPS(DISTANCES_KIND_HETEROGENEOUS_TYPES)
|
||||
|
||||
#define hwloc_distances_get HWLOC_NAME(distances_get)
|
||||
#define hwloc_distances_get_by_depth HWLOC_NAME(distances_get_by_depth)
|
||||
#define hwloc_distances_get_by_type HWLOC_NAME(distances_get_by_type)
|
||||
#define hwloc_distances_get_by_name HWLOC_NAME(distances_get_by_name)
|
||||
#define hwloc_distances_get_name HWLOC_NAME(distances_get_name)
|
||||
#define hwloc_distances_release HWLOC_NAME(distances_release)
|
||||
#define hwloc_distances_obj_index HWLOC_NAME(distances_obj_index)
|
||||
#define hwloc_distances_obj_pair_values HWLOC_NAME(distances_pair_values)
|
||||
|
||||
#define hwloc_distances_add_flag_e HWLOC_NAME(distances_add_flag_e)
|
||||
#define HWLOC_DISTANCES_ADD_FLAG_GROUP HWLOC_NAME_CAPS(DISTANCES_ADD_FLAG_GROUP)
|
||||
#define HWLOC_DISTANCES_ADD_FLAG_GROUP_INACCURATE HWLOC_NAME_CAPS(DISTANCES_ADD_FLAG_GROUP_INACCURATE)
|
||||
|
||||
#define hwloc_distances_add HWLOC_NAME(distances_add)
|
||||
#define hwloc_distances_remove HWLOC_NAME(distances_remove)
|
||||
#define hwloc_distances_remove_by_depth HWLOC_NAME(distances_remove_by_depth)
|
||||
#define hwloc_distances_remove_by_type HWLOC_NAME(distances_remove_by_type)
|
||||
#define hwloc_distances_release_remove HWLOC_NAME(distances_release_remove)
|
||||
|
||||
/* diff.h */
|
||||
|
||||
#define hwloc_topology_diff_obj_attr_type_e HWLOC_NAME(topology_diff_obj_attr_type_e)
|
||||
#define hwloc_topology_diff_obj_attr_type_t HWLOC_NAME(topology_diff_obj_attr_type_t)
|
||||
#define HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_SIZE HWLOC_NAME_CAPS(TOPOLOGY_DIFF_OBJ_ATTR_SIZE)
|
||||
#define HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_NAME HWLOC_NAME_CAPS(TOPOLOGY_DIFF_OBJ_ATTR_NAME)
|
||||
#define HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_INFO HWLOC_NAME_CAPS(TOPOLOGY_DIFF_OBJ_ATTR_INFO)
|
||||
#define hwloc_topology_diff_obj_attr_u HWLOC_NAME(topology_diff_obj_attr_u)
|
||||
#define hwloc_topology_diff_obj_attr_generic_s HWLOC_NAME(topology_diff_obj_attr_generic_s)
|
||||
#define hwloc_topology_diff_obj_attr_uint64_s HWLOC_NAME(topology_diff_obj_attr_uint64_s)
|
||||
#define hwloc_topology_diff_obj_attr_string_s HWLOC_NAME(topology_diff_obj_attr_string_s)
|
||||
#define hwloc_topology_diff_type_e HWLOC_NAME(topology_diff_type_e)
|
||||
#define hwloc_topology_diff_type_t HWLOC_NAME(topology_diff_type_t)
|
||||
#define HWLOC_TOPOLOGY_DIFF_OBJ_ATTR HWLOC_NAME_CAPS(TOPOLOGY_DIFF_OBJ_ATTR)
|
||||
#define HWLOC_TOPOLOGY_DIFF_TOO_COMPLEX HWLOC_NAME_CAPS(TOPOLOGY_DIFF_TOO_COMPLEX)
|
||||
#define hwloc_topology_diff_u HWLOC_NAME(topology_diff_u)
|
||||
#define hwloc_topology_diff_t HWLOC_NAME(topology_diff_t)
|
||||
#define hwloc_topology_diff_generic_s HWLOC_NAME(topology_diff_generic_s)
|
||||
#define hwloc_topology_diff_obj_attr_s HWLOC_NAME(topology_diff_obj_attr_s)
|
||||
#define hwloc_topology_diff_too_complex_s HWLOC_NAME(topology_diff_too_complex_s)
|
||||
#define hwloc_topology_diff_build HWLOC_NAME(topology_diff_build)
|
||||
#define hwloc_topology_diff_apply_flags_e HWLOC_NAME(topology_diff_apply_flags_e)
|
||||
#define HWLOC_TOPOLOGY_DIFF_APPLY_REVERSE HWLOC_NAME_CAPS(TOPOLOGY_DIFF_APPLY_REVERSE)
|
||||
#define hwloc_topology_diff_apply HWLOC_NAME(topology_diff_apply)
|
||||
#define hwloc_topology_diff_destroy HWLOC_NAME(topology_diff_destroy)
|
||||
#define hwloc_topology_diff_load_xml HWLOC_NAME(topology_diff_load_xml)
|
||||
#define hwloc_topology_diff_export_xml HWLOC_NAME(topology_diff_export_xml)
|
||||
#define hwloc_topology_diff_load_xmlbuffer HWLOC_NAME(topology_diff_load_xmlbuffer)
|
||||
#define hwloc_topology_diff_export_xmlbuffer HWLOC_NAME(topology_diff_export_xmlbuffer)
|
||||
|
||||
/* shmem.h */
|
||||
|
||||
#define hwloc_shmem_topology_get_length HWLOC_NAME(shmem_topology_get_length)
|
||||
#define hwloc_shmem_topology_write HWLOC_NAME(shmem_topology_write)
|
||||
#define hwloc_shmem_topology_adopt HWLOC_NAME(shmem_topology_adopt)
|
||||
|
||||
/* glibc-sched.h */
|
||||
|
||||
#define hwloc_cpuset_to_glibc_sched_affinity HWLOC_NAME(cpuset_to_glibc_sched_affinity)
|
||||
#define hwloc_cpuset_from_glibc_sched_affinity HWLOC_NAME(cpuset_from_glibc_sched_affinity)
|
||||
|
||||
/* linux-libnuma.h */
|
||||
|
||||
#define hwloc_cpuset_to_linux_libnuma_ulongs HWLOC_NAME(cpuset_to_linux_libnuma_ulongs)
|
||||
#define hwloc_nodeset_to_linux_libnuma_ulongs HWLOC_NAME(nodeset_to_linux_libnuma_ulongs)
|
||||
#define hwloc_cpuset_from_linux_libnuma_ulongs HWLOC_NAME(cpuset_from_linux_libnuma_ulongs)
|
||||
#define hwloc_nodeset_from_linux_libnuma_ulongs HWLOC_NAME(nodeset_from_linux_libnuma_ulongs)
|
||||
#define hwloc_cpuset_to_linux_libnuma_bitmask HWLOC_NAME(cpuset_to_linux_libnuma_bitmask)
|
||||
#define hwloc_nodeset_to_linux_libnuma_bitmask HWLOC_NAME(nodeset_to_linux_libnuma_bitmask)
|
||||
#define hwloc_cpuset_from_linux_libnuma_bitmask HWLOC_NAME(cpuset_from_linux_libnuma_bitmask)
|
||||
#define hwloc_nodeset_from_linux_libnuma_bitmask HWLOC_NAME(nodeset_from_linux_libnuma_bitmask)
|
||||
|
||||
/* linux.h */
|
||||
|
||||
#define hwloc_linux_set_tid_cpubind HWLOC_NAME(linux_set_tid_cpubind)
|
||||
#define hwloc_linux_get_tid_cpubind HWLOC_NAME(linux_get_tid_cpubind)
|
||||
#define hwloc_linux_get_tid_last_cpu_location HWLOC_NAME(linux_get_tid_last_cpu_location)
|
||||
#define hwloc_linux_read_path_as_cpumask HWLOC_NAME(linux_read_file_cpumask)
|
||||
|
||||
/* openfabrics-verbs.h */
|
||||
|
||||
#define hwloc_ibv_get_device_cpuset HWLOC_NAME(ibv_get_device_cpuset)
|
||||
#define hwloc_ibv_get_device_osdev HWLOC_NAME(ibv_get_device_osdev)
|
||||
#define hwloc_ibv_get_device_osdev_by_name HWLOC_NAME(ibv_get_device_osdev_by_name)
|
||||
|
||||
/* opencl.h */
|
||||
|
||||
#define hwloc_cl_device_topology_amd HWLOC_NAME(cl_device_topology_amd)
|
||||
#define hwloc_opencl_get_device_pci_busid HWLOC_NAME(opencl_get_device_pci_ids)
|
||||
#define hwloc_opencl_get_device_cpuset HWLOC_NAME(opencl_get_device_cpuset)
|
||||
#define hwloc_opencl_get_device_osdev HWLOC_NAME(opencl_get_device_osdev)
|
||||
#define hwloc_opencl_get_device_osdev_by_index HWLOC_NAME(opencl_get_device_osdev_by_index)
|
||||
|
||||
/* cuda.h */
|
||||
|
||||
#define hwloc_cuda_get_device_pci_ids HWLOC_NAME(cuda_get_device_pci_ids)
|
||||
#define hwloc_cuda_get_device_cpuset HWLOC_NAME(cuda_get_device_cpuset)
|
||||
#define hwloc_cuda_get_device_pcidev HWLOC_NAME(cuda_get_device_pcidev)
|
||||
#define hwloc_cuda_get_device_osdev HWLOC_NAME(cuda_get_device_osdev)
|
||||
#define hwloc_cuda_get_device_osdev_by_index HWLOC_NAME(cuda_get_device_osdev_by_index)
|
||||
|
||||
/* cudart.h */
|
||||
|
||||
#define hwloc_cudart_get_device_pci_ids HWLOC_NAME(cudart_get_device_pci_ids)
|
||||
#define hwloc_cudart_get_device_cpuset HWLOC_NAME(cudart_get_device_cpuset)
|
||||
#define hwloc_cudart_get_device_pcidev HWLOC_NAME(cudart_get_device_pcidev)
|
||||
#define hwloc_cudart_get_device_osdev_by_index HWLOC_NAME(cudart_get_device_osdev_by_index)
|
||||
|
||||
/* nvml.h */
|
||||
|
||||
#define hwloc_nvml_get_device_cpuset HWLOC_NAME(nvml_get_device_cpuset)
|
||||
#define hwloc_nvml_get_device_osdev HWLOC_NAME(nvml_get_device_osdev)
|
||||
#define hwloc_nvml_get_device_osdev_by_index HWLOC_NAME(nvml_get_device_osdev_by_index)
|
||||
|
||||
/* gl.h */
|
||||
|
||||
#define hwloc_gl_get_display_osdev_by_port_device HWLOC_NAME(gl_get_display_osdev_by_port_device)
|
||||
#define hwloc_gl_get_display_osdev_by_name HWLOC_NAME(gl_get_display_osdev_by_name)
|
||||
#define hwloc_gl_get_display_by_osdev HWLOC_NAME(gl_get_display_by_osdev)
|
||||
|
||||
/* hwloc/plugins.h */
|
||||
|
||||
#define hwloc_disc_phase_e HWLOC_NAME(disc_phase_e)
|
||||
#define HWLOC_DISC_PHASE_GLOBAL HWLOC_NAME_CAPS(DISC_PHASE_GLOBAL)
|
||||
#define HWLOC_DISC_PHASE_CPU HWLOC_NAME_CAPS(DISC_PHASE_CPU)
|
||||
#define HWLOC_DISC_PHASE_MEMORY HWLOC_NAME_CAPS(DISC_PHASE_MEMORY)
|
||||
#define HWLOC_DISC_PHASE_PCI HWLOC_NAME_CAPS(DISC_PHASE_PCI)
|
||||
#define HWLOC_DISC_PHASE_IO HWLOC_NAME_CAPS(DISC_PHASE_IO)
|
||||
#define HWLOC_DISC_PHASE_MISC HWLOC_NAME_CAPS(DISC_PHASE_MISC)
|
||||
#define HWLOC_DISC_PHASE_ANNOTATE HWLOC_NAME_CAPS(DISC_PHASE_ANNOTATE)
|
||||
#define HWLOC_DISC_PHASE_TWEAK HWLOC_NAME_CAPS(DISC_PHASE_TWEAK)
|
||||
#define hwloc_disc_phase_t HWLOC_NAME(disc_phase_t)
|
||||
#define hwloc_disc_component HWLOC_NAME(disc_component)
|
||||
|
||||
#define hwloc_disc_status_flag_e HWLOC_NAME(disc_status_flag_e)
|
||||
#define HWLOC_DISC_STATUS_FLAG_GOT_ALLOWED_RESOURCES HWLOC_NAME_CAPS(DISC_STATUS_FLAG_GOT_ALLOWED_RESOURCES)
|
||||
#define hwloc_disc_status HWLOC_NAME(disc_status)
|
||||
|
||||
#define hwloc_backend HWLOC_NAME(backend)
|
||||
|
||||
#define hwloc_backend_alloc HWLOC_NAME(backend_alloc)
|
||||
#define hwloc_backend_enable HWLOC_NAME(backend_enable)
|
||||
|
||||
#define hwloc_component_type_e HWLOC_NAME(component_type_e)
|
||||
#define HWLOC_COMPONENT_TYPE_DISC HWLOC_NAME_CAPS(COMPONENT_TYPE_DISC)
|
||||
#define HWLOC_COMPONENT_TYPE_XML HWLOC_NAME_CAPS(COMPONENT_TYPE_XML)
|
||||
#define hwloc_component_type_t HWLOC_NAME(component_type_t)
|
||||
#define hwloc_component HWLOC_NAME(component)
|
||||
|
||||
#define hwloc_plugin_check_namespace HWLOC_NAME(plugin_check_namespace)
|
||||
|
||||
#define hwloc_insert_object_by_cpuset HWLOC_NAME(insert_object_by_cpuset)
|
||||
#define hwloc_report_error_t HWLOC_NAME(report_error_t)
|
||||
#define hwloc_report_os_error HWLOC_NAME(report_os_error)
|
||||
#define hwloc_hide_errors HWLOC_NAME(hide_errors)
|
||||
#define hwloc__insert_object_by_cpuset HWLOC_NAME(_insert_object_by_cpuset)
|
||||
#define hwloc_insert_object_by_parent HWLOC_NAME(insert_object_by_parent)
|
||||
#define hwloc_alloc_setup_object HWLOC_NAME(alloc_setup_object)
|
||||
#define hwloc_obj_add_children_sets HWLOC_NAME(add_children_sets)
|
||||
#define hwloc_topology_reconnect HWLOC_NAME(topology_reconnect)
|
||||
|
||||
#define hwloc_filter_check_pcidev_subtype_important HWLOC_NAME(filter_check_pcidev_subtype_important)
|
||||
#define hwloc_filter_check_osdev_subtype_important HWLOC_NAME(filter_check_osdev_subtype_important)
|
||||
#define hwloc_filter_check_keep_object_type HWLOC_NAME(filter_check_keep_object_type)
|
||||
#define hwloc_filter_check_keep_object HWLOC_NAME(filter_check_keep_object)
|
||||
|
||||
#define hwloc_pcidisc_find_cap HWLOC_NAME(pcidisc_find_cap)
|
||||
#define hwloc_pcidisc_find_linkspeed HWLOC_NAME(pcidisc_find_linkspeed)
|
||||
#define hwloc_pcidisc_check_bridge_type HWLOC_NAME(pcidisc_check_bridge_type)
|
||||
#define hwloc_pcidisc_find_bridge_buses HWLOC_NAME(pcidisc_find_bridge_buses)
|
||||
#define hwloc_pcidisc_tree_insert_by_busid HWLOC_NAME(pcidisc_tree_insert_by_busid)
|
||||
#define hwloc_pcidisc_tree_attach HWLOC_NAME(pcidisc_tree_attach)
|
||||
|
||||
#define hwloc_pci_find_parent_by_busid HWLOC_NAME(pcidisc_find_busid_parent)
|
||||
|
||||
/* hwloc/deprecated.h */
|
||||
|
||||
#define hwloc_topology_insert_misc_object_by_parent HWLOC_NAME(topology_insert_misc_object_by_parent)
|
||||
#define hwloc_obj_cpuset_snprintf HWLOC_NAME(obj_cpuset_snprintf)
|
||||
#define hwloc_obj_type_sscanf HWLOC_NAME(obj_type_sscanf)
|
||||
|
||||
#define hwloc_set_membind_nodeset HWLOC_NAME(set_membind_nodeset)
|
||||
#define hwloc_get_membind_nodeset HWLOC_NAME(get_membind_nodeset)
|
||||
#define hwloc_set_proc_membind_nodeset HWLOC_NAME(set_proc_membind_nodeset)
|
||||
#define hwloc_get_proc_membind_nodeset HWLOC_NAME(get_proc_membind_nodeset)
|
||||
#define hwloc_set_area_membind_nodeset HWLOC_NAME(set_area_membind_nodeset)
|
||||
#define hwloc_get_area_membind_nodeset HWLOC_NAME(get_area_membind_nodeset)
|
||||
#define hwloc_alloc_membind_nodeset HWLOC_NAME(alloc_membind_nodeset)
|
||||
|
||||
#define hwloc_cpuset_to_nodeset_strict HWLOC_NAME(cpuset_to_nodeset_strict)
|
||||
#define hwloc_cpuset_from_nodeset_strict HWLOC_NAME(cpuset_from_nodeset_strict)
|
||||
|
||||
/* private/debug.h */
|
||||
|
||||
#define hwloc_debug_enabled HWLOC_NAME(debug_enabled)
|
||||
#define hwloc_debug HWLOC_NAME(debug)
|
||||
|
||||
/* private/misc.h */
|
||||
|
||||
#ifndef HWLOC_HAVE_CORRECT_SNPRINTF
|
||||
#define hwloc_snprintf HWLOC_NAME(snprintf)
|
||||
#endif
|
||||
#define hwloc_ffsl_manual HWLOC_NAME(ffsl_manual)
|
||||
#define hwloc_ffs32 HWLOC_NAME(ffs32)
|
||||
#define hwloc_ffsl_from_ffs32 HWLOC_NAME(ffsl_from_ffs32)
|
||||
#define hwloc_flsl_manual HWLOC_NAME(flsl_manual)
|
||||
#define hwloc_fls32 HWLOC_NAME(fls32)
|
||||
#define hwloc_flsl_from_fls32 HWLOC_NAME(flsl_from_fls32)
|
||||
#define hwloc_weight_long HWLOC_NAME(weight_long)
|
||||
#define hwloc_strncasecmp HWLOC_NAME(strncasecmp)
|
||||
|
||||
#define hwloc_bitmap_compare_inclusion HWLOC_NAME(bitmap_compare_inclusion)
|
||||
|
||||
#define hwloc_pci_class_string HWLOC_NAME(pci_class_string)
|
||||
#define hwloc_linux_pci_link_speed_from_string HWLOC_NAME(linux_pci_link_speed_from_string)
|
||||
|
||||
#define hwloc_cache_type_by_depth_type HWLOC_NAME(cache_type_by_depth_type)
|
||||
#define hwloc__obj_type_is_normal HWLOC_NAME(_obj_type_is_normal)
|
||||
#define hwloc__obj_type_is_memory HWLOC_NAME(_obj_type_is_memory)
|
||||
#define hwloc__obj_type_is_io HWLOC_NAME(_obj_type_is_io)
|
||||
#define hwloc__obj_type_is_special HWLOC_NAME(_obj_type_is_special)
|
||||
|
||||
#define hwloc__obj_type_is_cache HWLOC_NAME(_obj_type_is_cache)
|
||||
#define hwloc__obj_type_is_dcache HWLOC_NAME(_obj_type_is_dcache)
|
||||
#define hwloc__obj_type_is_icache HWLOC_NAME(_obj_type_is_icache)
|
||||
|
||||
/* private/cpuid-x86.h */
|
||||
|
||||
#define hwloc_have_x86_cpuid HWLOC_NAME(have_x86_cpuid)
|
||||
#define hwloc_x86_cpuid HWLOC_NAME(x86_cpuid)
|
||||
|
||||
/* private/xml.h */
|
||||
|
||||
#define hwloc__xml_verbose HWLOC_NAME(_xml_verbose)
|
||||
|
||||
#define hwloc__xml_import_state_s HWLOC_NAME(_xml_import_state_s)
|
||||
#define hwloc__xml_import_state_t HWLOC_NAME(_xml_import_state_t)
|
||||
#define hwloc__xml_import_diff HWLOC_NAME(_xml_import_diff)
|
||||
#define hwloc_xml_backend_data_s HWLOC_NAME(xml_backend_data_s)
|
||||
#define hwloc__xml_export_state_s HWLOC_NAME(_xml_export_state_s)
|
||||
#define hwloc__xml_export_state_t HWLOC_NAME(_xml_export_state_t)
|
||||
#define hwloc__xml_export_data_s HWLOC_NAME(_xml_export_data_s)
|
||||
#define hwloc__xml_export_topology HWLOC_NAME(_xml_export_topology)
|
||||
#define hwloc__xml_export_diff HWLOC_NAME(_xml_export_diff)
|
||||
|
||||
#define hwloc_xml_callbacks HWLOC_NAME(xml_callbacks)
|
||||
#define hwloc_xml_component HWLOC_NAME(xml_component)
|
||||
#define hwloc_xml_callbacks_register HWLOC_NAME(xml_callbacks_register)
|
||||
#define hwloc_xml_callbacks_reset HWLOC_NAME(xml_callbacks_reset)
|
||||
|
||||
#define hwloc__xml_imported_v1distances_s HWLOC_NAME(_xml_imported_v1distances_s)
|
||||
|
||||
/* private/components.h */
|
||||
|
||||
#define hwloc_disc_component_force_enable HWLOC_NAME(disc_component_force_enable)
|
||||
#define hwloc_disc_components_enable_others HWLOC_NAME(disc_components_instantiate_others)
|
||||
|
||||
#define hwloc_backends_is_thissystem HWLOC_NAME(backends_is_thissystem)
|
||||
#define hwloc_backends_find_callbacks HWLOC_NAME(backends_find_callbacks)
|
||||
|
||||
#define hwloc_topology_components_init HWLOC_NAME(topology_components_init)
|
||||
#define hwloc_backends_disable_all HWLOC_NAME(backends_disable_all)
|
||||
#define hwloc_topology_components_fini HWLOC_NAME(topology_components_fini)
|
||||
|
||||
#define hwloc_components_init HWLOC_NAME(components_init)
|
||||
#define hwloc_components_fini HWLOC_NAME(components_fini)
|
||||
|
||||
/* private/internal-private.h */
|
||||
|
||||
#define hwloc_xml_component HWLOC_NAME(xml_component)
|
||||
#define hwloc_synthetic_component HWLOC_NAME(synthetic_component)
|
||||
|
||||
#define hwloc_aix_component HWLOC_NAME(aix_component)
|
||||
#define hwloc_bgq_component HWLOC_NAME(bgq_component)
|
||||
#define hwloc_darwin_component HWLOC_NAME(darwin_component)
|
||||
#define hwloc_freebsd_component HWLOC_NAME(freebsd_component)
|
||||
#define hwloc_hpux_component HWLOC_NAME(hpux_component)
|
||||
#define hwloc_linux_component HWLOC_NAME(linux_component)
|
||||
#define hwloc_netbsd_component HWLOC_NAME(netbsd_component)
|
||||
#define hwloc_noos_component HWLOC_NAME(noos_component)
|
||||
#define hwloc_solaris_component HWLOC_NAME(solaris_component)
|
||||
#define hwloc_windows_component HWLOC_NAME(windows_component)
|
||||
#define hwloc_x86_component HWLOC_NAME(x86_component)
|
||||
|
||||
#define hwloc_cuda_component HWLOC_NAME(cuda_component)
|
||||
#define hwloc_gl_component HWLOC_NAME(gl_component)
|
||||
#define hwloc_nvml_component HWLOC_NAME(nvml_component)
|
||||
#define hwloc_opencl_component HWLOC_NAME(opencl_component)
|
||||
#define hwloc_pci_component HWLOC_NAME(pci_component)
|
||||
|
||||
#define hwloc_xml_libxml_component HWLOC_NAME(xml_libxml_component)
|
||||
#define hwloc_xml_nolibxml_component HWLOC_NAME(xml_nolibxml_component)
|
||||
|
||||
/* private/private.h */
|
||||
|
||||
#define hwloc_special_level_s HWLOC_NAME(special_level_s)
|
||||
|
||||
#define hwloc_pci_forced_locality_s HWLOC_NAME(pci_forced_locality_s)
|
||||
#define hwloc_pci_locality_s HWLOC_NAME(pci_locality_s)
|
||||
|
||||
#define hwloc_topology_forced_component_s HWLOC_NAME(topology_forced_component)
|
||||
|
||||
#define hwloc_alloc_root_sets HWLOC_NAME(alloc_root_sets)
|
||||
#define hwloc_setup_pu_level HWLOC_NAME(setup_pu_level)
|
||||
#define hwloc_get_sysctlbyname HWLOC_NAME(get_sysctlbyname)
|
||||
#define hwloc_get_sysctl HWLOC_NAME(get_sysctl)
|
||||
#define hwloc_fallback_nbprocessors HWLOC_NAME(fallback_nbprocessors)
|
||||
#define hwloc_fallback_memsize HWLOC_NAME(fallback_memsize)
|
||||
|
||||
#define hwloc__object_cpusets_compare_first HWLOC_NAME(_object_cpusets_compare_first)
|
||||
#define hwloc__reorder_children HWLOC_NAME(_reorder_children)
|
||||
|
||||
#define hwloc_topology_setup_defaults HWLOC_NAME(topology_setup_defaults)
|
||||
#define hwloc_topology_clear HWLOC_NAME(topology_clear)
|
||||
|
||||
#define hwloc__attach_memory_object HWLOC_NAME(insert_memory_object)
|
||||
|
||||
#define hwloc_pci_discovery_init HWLOC_NAME(pci_discovery_init)
|
||||
#define hwloc_pci_discovery_prepare HWLOC_NAME(pci_discovery_prepare)
|
||||
#define hwloc_pci_discovery_exit HWLOC_NAME(pci_discovery_exit)
|
||||
#define hwloc_pci_find_by_busid HWLOC_NAME(pcidisc_find_by_busid)
|
||||
#define hwloc_find_insert_io_parent_by_complete_cpuset HWLOC_NAME(hwloc_find_insert_io_parent_by_complete_cpuset)
|
||||
|
||||
#define hwloc__add_info HWLOC_NAME(_add_info)
|
||||
#define hwloc__add_info_nodup HWLOC_NAME(_add_info_nodup)
|
||||
#define hwloc__move_infos HWLOC_NAME(_move_infos)
|
||||
#define hwloc__free_infos HWLOC_NAME(_free_infos)
|
||||
|
||||
#define hwloc_binding_hooks HWLOC_NAME(binding_hooks)
|
||||
#define hwloc_set_native_binding_hooks HWLOC_NAME(set_native_binding_hooks)
|
||||
#define hwloc_set_binding_hooks HWLOC_NAME(set_binding_hooks)
|
||||
|
||||
#define hwloc_set_linuxfs_hooks HWLOC_NAME(set_linuxfs_hooks)
|
||||
#define hwloc_set_bgq_hooks HWLOC_NAME(set_bgq_hooks)
|
||||
#define hwloc_set_solaris_hooks HWLOC_NAME(set_solaris_hooks)
|
||||
#define hwloc_set_aix_hooks HWLOC_NAME(set_aix_hooks)
|
||||
#define hwloc_set_windows_hooks HWLOC_NAME(set_windows_hooks)
|
||||
#define hwloc_set_darwin_hooks HWLOC_NAME(set_darwin_hooks)
|
||||
#define hwloc_set_freebsd_hooks HWLOC_NAME(set_freebsd_hooks)
|
||||
#define hwloc_set_netbsd_hooks HWLOC_NAME(set_netbsd_hooks)
|
||||
#define hwloc_set_hpux_hooks HWLOC_NAME(set_hpux_hooks)
|
||||
|
||||
#define hwloc_look_hardwired_fujitsu_k HWLOC_NAME(look_hardwired_fujitsu_k)
|
||||
#define hwloc_look_hardwired_fujitsu_fx10 HWLOC_NAME(look_hardwired_fujitsu_fx10)
|
||||
#define hwloc_look_hardwired_fujitsu_fx100 HWLOC_NAME(look_hardwired_fujitsu_fx100)
|
||||
|
||||
#define hwloc_add_uname_info HWLOC_NAME(add_uname_info)
|
||||
#define hwloc_free_unlinked_object HWLOC_NAME(free_unlinked_object)
|
||||
#define hwloc_free_object_and_children HWLOC_NAME(free_object_and_children)
|
||||
#define hwloc_free_object_siblings_and_children HWLOC_NAME(free_object_siblings_and_children)
|
||||
|
||||
#define hwloc_alloc_heap HWLOC_NAME(alloc_heap)
|
||||
#define hwloc_alloc_mmap HWLOC_NAME(alloc_mmap)
|
||||
#define hwloc_free_heap HWLOC_NAME(free_heap)
|
||||
#define hwloc_free_mmap HWLOC_NAME(free_mmap)
|
||||
#define hwloc_alloc_or_fail HWLOC_NAME(alloc_or_fail)
|
||||
|
||||
#define hwloc_internal_distances_s HWLOC_NAME(internal_distances_s)
|
||||
#define hwloc_internal_distances_init HWLOC_NAME(internal_distances_init)
|
||||
#define hwloc_internal_distances_prepare HWLOC_NAME(internal_distances_prepare)
|
||||
#define hwloc_internal_distances_dup HWLOC_NAME(internal_distances_dup)
|
||||
#define hwloc_internal_distances_refresh HWLOC_NAME(internal_distances_refresh)
|
||||
#define hwloc_internal_distances_destroy HWLOC_NAME(internal_distances_destroy)
|
||||
|
||||
#define hwloc_internal_distances_add HWLOC_NAME(internal_distances_add)
|
||||
#define hwloc_internal_distances_add_by_index HWLOC_NAME(internal_distances_add_by_index)
|
||||
#define hwloc_internal_distances_invalidate_cached_objs HWLOC_NAME(hwloc_internal_distances_invalidate_cached_objs)
|
||||
|
||||
#define hwloc_encode_to_base64 HWLOC_NAME(encode_to_base64)
|
||||
#define hwloc_decode_from_base64 HWLOC_NAME(decode_from_base64)
|
||||
|
||||
#define hwloc_progname HWLOC_NAME(progname)
|
||||
|
||||
#define hwloc__topology_disadopt HWLOC_NAME(_topology_disadopt)
|
||||
#define hwloc__topology_dup HWLOC_NAME(_topology_dup)
|
||||
|
||||
#define hwloc_tma HWLOC_NAME(tma)
|
||||
#define hwloc_tma_malloc HWLOC_NAME(tma_malloc)
|
||||
#define hwloc_tma_calloc HWLOC_NAME(tma_calloc)
|
||||
#define hwloc_tma_strdup HWLOC_NAME(tma_strdup)
|
||||
#define hwloc_bitmap_tma_dup HWLOC_NAME(bitmap_tma_dup)
|
||||
|
||||
/* private/solaris-chiptype.h */
|
||||
|
||||
#define hwloc_solaris_chip_info_s HWLOC_NAME(solaris_chip_info_s)
|
||||
#define hwloc_solaris_get_chip_info HWLOC_NAME(solaris_get_chip_info)
|
||||
|
||||
#endif /* HWLOC_SYM_TRANSFORM */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* HWLOC_RENAME_H */
|
||||
137
src/3rdparty/hwloc/include/hwloc/shmem.h
vendored
137
src/3rdparty/hwloc/include/hwloc/shmem.h
vendored
@@ -1,137 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013-2018 Inria. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Sharing topologies between processes
|
||||
*/
|
||||
|
||||
#ifndef HWLOC_SHMEM_H
|
||||
#define HWLOC_SHMEM_H
|
||||
|
||||
#include "hwloc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#elif 0
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/** \defgroup hwlocality_shmem Sharing topologies between processes
|
||||
*
|
||||
* These functions are used to share a topology between processes by
|
||||
* duplicating it into a file-backed shared-memory buffer.
|
||||
*
|
||||
* The master process must first get the required shared-memory size
|
||||
* for storing this topology with hwloc_shmem_topology_get_length().
|
||||
*
|
||||
* Then it must find a virtual memory area of that size that is available
|
||||
* in all processes (identical virtual addresses in all processes).
|
||||
* On Linux, this can be done by comparing holes found in /proc/\<pid\>/maps
|
||||
* for each process.
|
||||
*
|
||||
* Once found, it must open a destination file for storing the buffer,
|
||||
* and pass it to hwloc_shmem_topology_write() together with
|
||||
* virtual memory address and length obtained above.
|
||||
*
|
||||
* Other processes may then adopt this shared topology by opening the
|
||||
* same file and passing it to hwloc_shmem_topology_adopt() with the
|
||||
* exact same virtual memory address and length.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Get the required shared memory length for storing a topology.
|
||||
*
|
||||
* This length (in bytes) must be used in hwloc_shmem_topology_write()
|
||||
* and hwloc_shmem_topology_adopt() later.
|
||||
*
|
||||
* \note Flags \p flags are currently unused, must be 0.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_shmem_topology_get_length(hwloc_topology_t topology,
|
||||
size_t *lengthp,
|
||||
unsigned long flags);
|
||||
|
||||
/** \brief Duplicate a topology to a shared memory file.
|
||||
*
|
||||
* Temporarily map a file in virtual memory and duplicate the
|
||||
* topology \p topology by allocating duplicates in there.
|
||||
*
|
||||
* The segment of the file pointed by descriptor \p fd,
|
||||
* starting at offset \p fileoffset, and of length \p length (in bytes),
|
||||
* will be temporarily mapped at virtual address \p mmap_address
|
||||
* during the duplication.
|
||||
*
|
||||
* The mapping length \p length must have been previously obtained with
|
||||
* hwloc_shmem_topology_get_length()
|
||||
* and the topology must not have been modified in the meantime.
|
||||
*
|
||||
* \note Flags \p flags are currently unused, must be 0.
|
||||
*
|
||||
* \note The object userdata pointer is duplicated but the pointed buffer
|
||||
* is not. However the caller may also allocate it manually in shared memory
|
||||
* to share it as well.
|
||||
*
|
||||
* \return -1 with errno set to EBUSY if the virtual memory mapping defined
|
||||
* by \p mmap_address and \p length isn't available in the process.
|
||||
* \return -1 with errno set to EINVAL if \p fileoffset, \p mmap_address
|
||||
* or \p length aren't page-aligned.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_shmem_topology_write(hwloc_topology_t topology,
|
||||
int fd, hwloc_uint64_t fileoffset,
|
||||
void *mmap_address, size_t length,
|
||||
unsigned long flags);
|
||||
|
||||
/** \brief Adopt a shared memory topology stored in a file.
|
||||
*
|
||||
* Map a file in virtual memory and adopt the topology that was previously
|
||||
* stored there with hwloc_shmem_topology_write().
|
||||
*
|
||||
* The returned adopted topology in \p topologyp can be used just like any
|
||||
* topology. And it must be destroyed with hwloc_topology_destroy() as usual.
|
||||
*
|
||||
* However the topology is read-only.
|
||||
* For instance, it cannot be modified with hwloc_topology_restrict()
|
||||
* and object userdata pointers cannot be changed.
|
||||
*
|
||||
* The segment of the file pointed by descriptor \p fd,
|
||||
* starting at offset \p fileoffset, and of length \p length (in bytes),
|
||||
* will be mapped at virtual address \p mmap_address.
|
||||
*
|
||||
* The file pointed by descriptor \p fd, the offset \p fileoffset,
|
||||
* the requested mapping virtual address \p mmap_address and the length \p length
|
||||
* must be identical to what was given to hwloc_shmem_topology_write() earlier.
|
||||
*
|
||||
* \note Flags \p flags are currently unused, must be 0.
|
||||
*
|
||||
* \note The object userdata pointer should not be used unless the process
|
||||
* that created the shared topology also placed userdata-pointed buffers
|
||||
* in shared memory.
|
||||
*
|
||||
* \note This function takes care of calling hwloc_topology_abi_check().
|
||||
*
|
||||
* \return -1 with errno set to EBUSY if the virtual memory mapping defined
|
||||
* by \p mmap_address and \p length isn't available in the process.
|
||||
*
|
||||
* \return -1 with errno set to EINVAL if \p fileoffset, \p mmap_address
|
||||
* or \p length aren't page-aligned, or do not match what was given to
|
||||
* hwloc_shmem_topology_write() earlier.
|
||||
*
|
||||
* \return -1 with errno set to EINVAL if the layout of the topology structure
|
||||
* is different between the writer process and the adopter process.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_shmem_topology_adopt(hwloc_topology_t *topologyp,
|
||||
int fd, hwloc_uint64_t fileoffset,
|
||||
void *mmap_address, size_t length,
|
||||
unsigned long flags);
|
||||
/** @} */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* HWLOC_SHMEM_H */
|
||||
672
src/3rdparty/hwloc/include/private/autogen/config.h
vendored
672
src/3rdparty/hwloc/include/private/autogen/config.h
vendored
@@ -1,672 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2009, 2011, 2012 CNRS. All rights reserved.
|
||||
* Copyright © 2009-2018 Inria. All rights reserved.
|
||||
* Copyright © 2009, 2011, 2012, 2015 Université Bordeaux. All rights reserved.
|
||||
* Copyright © 2009 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef HWLOC_CONFIGURE_H
|
||||
#define HWLOC_CONFIGURE_H
|
||||
|
||||
#define DECLSPEC_EXPORTS
|
||||
|
||||
#define HWLOC_HAVE_MSVC_CPUIDEX 1
|
||||
|
||||
/* Define to 1 if the system has the type `CACHE_DESCRIPTOR'. */
|
||||
#define HAVE_CACHE_DESCRIPTOR 0
|
||||
|
||||
/* Define to 1 if the system has the type `CACHE_RELATIONSHIP'. */
|
||||
#define HAVE_CACHE_RELATIONSHIP 0
|
||||
|
||||
/* Define to 1 if you have the `clz' function. */
|
||||
/* #undef HAVE_CLZ */
|
||||
|
||||
/* Define to 1 if you have the `clzl' function. */
|
||||
/* #undef HAVE_CLZL */
|
||||
|
||||
/* Define to 1 if you have the <CL/cl_ext.h> header file. */
|
||||
/* #undef HAVE_CL_CL_EXT_H */
|
||||
|
||||
/* Define to 1 if you have the `cpuset_setaffinity' function. */
|
||||
/* #undef HAVE_CPUSET_SETAFFINITY */
|
||||
|
||||
/* Define to 1 if you have the `cpuset_setid' function. */
|
||||
/* #undef HAVE_CPUSET_SETID */
|
||||
|
||||
/* Define to 1 if we have -lcuda */
|
||||
/* #undef HAVE_CUDA */
|
||||
|
||||
/* Define to 1 if you have the <cuda.h> header file. */
|
||||
/* #undef HAVE_CUDA_H */
|
||||
|
||||
/* Define to 1 if you have the <cuda_runtime_api.h> header file. */
|
||||
/* #undef HAVE_CUDA_RUNTIME_API_H */
|
||||
|
||||
/* Define to 1 if you have the declaration of `CL_DEVICE_TOPOLOGY_AMD', and to
|
||||
0 if you don't. */
|
||||
/* #undef HAVE_DECL_CL_DEVICE_TOPOLOGY_AMD */
|
||||
|
||||
/* Define to 1 if you have the declaration of `CTL_HW', and to 0 if you don't.
|
||||
*/
|
||||
/* #undef HAVE_DECL_CTL_HW */
|
||||
|
||||
/* Define to 1 if you have the declaration of `fabsf', and to 0 if you don't.
|
||||
*/
|
||||
#define HAVE_DECL_FABSF 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `modff', and to 0 if you don't.
|
||||
*/
|
||||
#define HAVE_DECL_MODFF 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `HW_NCPU', and to 0 if you
|
||||
don't. */
|
||||
/* #undef HAVE_DECL_HW_NCPU */
|
||||
|
||||
/* Define to 1 if you have the declaration of
|
||||
`nvmlDeviceGetMaxPcieLinkGeneration', and to 0 if you don't. */
|
||||
/* #undef HAVE_DECL_NVMLDEVICEGETMAXPCIELINKGENERATION */
|
||||
|
||||
/* Define to 1 if you have the declaration of `pthread_getaffinity_np', and to
|
||||
0 if you don't. */
|
||||
#define HAVE_DECL_PTHREAD_GETAFFINITY_NP 0
|
||||
|
||||
/* Define to 1 if you have the declaration of `pthread_setaffinity_np', and to
|
||||
0 if you don't. */
|
||||
#define HAVE_DECL_PTHREAD_SETAFFINITY_NP 0
|
||||
|
||||
/* Define to 1 if you have the declaration of `strtoull', and to 0 if you
|
||||
don't. */
|
||||
#define HAVE_DECL_STRTOULL 0
|
||||
|
||||
/* Define to 1 if you have the declaration of `strcasecmp', and to 0 if you
|
||||
don't. */
|
||||
/* #undef HWLOC_HAVE_DECL_STRCASECMP */
|
||||
|
||||
/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
|
||||
don't. */
|
||||
#define HAVE_DECL_SNPRINTF 0
|
||||
|
||||
/* Define to 1 if you have the declaration of `_strdup', and to 0 if you
|
||||
don't. */
|
||||
#define HAVE_DECL__STRDUP 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `_putenv', and to 0 if you
|
||||
don't. */
|
||||
#define HAVE_DECL__PUTENV 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `_SC_LARGE_PAGESIZE', and to 0
|
||||
if you don't. */
|
||||
#define HAVE_DECL__SC_LARGE_PAGESIZE 0
|
||||
|
||||
/* Define to 1 if you have the declaration of `_SC_NPROCESSORS_CONF', and to 0
|
||||
if you don't. */
|
||||
#define HAVE_DECL__SC_NPROCESSORS_CONF 0
|
||||
|
||||
/* Define to 1 if you have the declaration of `_SC_NPROCESSORS_ONLN', and to 0
|
||||
if you don't. */
|
||||
#define HAVE_DECL__SC_NPROCESSORS_ONLN 0
|
||||
|
||||
/* Define to 1 if you have the declaration of `_SC_NPROC_CONF', and to 0 if
|
||||
you don't. */
|
||||
#define HAVE_DECL__SC_NPROC_CONF 0
|
||||
|
||||
/* Define to 1 if you have the declaration of `_SC_NPROC_ONLN', and to 0 if
|
||||
you don't. */
|
||||
#define HAVE_DECL__SC_NPROC_ONLN 0
|
||||
|
||||
/* Define to 1 if you have the declaration of `_SC_PAGESIZE', and to 0 if you
|
||||
don't. */
|
||||
#define HAVE_DECL__SC_PAGESIZE 0
|
||||
|
||||
/* Define to 1 if you have the declaration of `_SC_PAGE_SIZE', and to 0 if you
|
||||
don't. */
|
||||
#define HAVE_DECL__SC_PAGE_SIZE 0
|
||||
|
||||
/* Define to 1 if you have the <dirent.h> header file. */
|
||||
/* #define HAVE_DIRENT_H 1 */
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
/* #undef HAVE_DLFCN_H */
|
||||
|
||||
/* Define to 1 if you have the `ffs' function. */
|
||||
/* #undef HAVE_FFS */
|
||||
|
||||
/* Define to 1 if you have the `ffsl' function. */
|
||||
/* #undef HAVE_FFSL */
|
||||
|
||||
/* Define to 1 if you have the `fls' function. */
|
||||
/* #undef HAVE_FLS */
|
||||
|
||||
/* Define to 1 if you have the `flsl' function. */
|
||||
/* #undef HAVE_FLSL */
|
||||
|
||||
/* Define to 1 if you have the `getpagesize' function. */
|
||||
#define HAVE_GETPAGESIZE 1
|
||||
|
||||
/* Define to 1 if the system has the type `GROUP_AFFINITY'. */
|
||||
#define HAVE_GROUP_AFFINITY 1
|
||||
|
||||
/* Define to 1 if the system has the type `GROUP_RELATIONSHIP'. */
|
||||
#define HAVE_GROUP_RELATIONSHIP 1
|
||||
|
||||
/* Define to 1 if you have the `host_info' function. */
|
||||
/* #undef HAVE_HOST_INFO */
|
||||
|
||||
/* Define to 1 if you have the <infiniband/verbs.h> header file. */
|
||||
/* #undef HAVE_INFINIBAND_VERBS_H */
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define to 1 if the system has the type `KAFFINITY'. */
|
||||
#define HAVE_KAFFINITY 1
|
||||
|
||||
/* Define to 1 if you have the <kstat.h> header file. */
|
||||
/* #undef HAVE_KSTAT_H */
|
||||
|
||||
/* Define to 1 if you have the <langinfo.h> header file. */
|
||||
/* #undef HAVE_LANGINFO_H */
|
||||
|
||||
/* Define to 1 if we have -lgdi32 */
|
||||
#define HAVE_LIBGDI32 1
|
||||
|
||||
/* Define to 1 if we have -libverbs */
|
||||
/* #undef HAVE_LIBIBVERBS */
|
||||
|
||||
/* Define to 1 if we have -lkstat */
|
||||
/* #undef HAVE_LIBKSTAT */
|
||||
|
||||
/* Define to 1 if we have -llgrp */
|
||||
/* #undef HAVE_LIBLGRP */
|
||||
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
#define HAVE_LOCALE_H 1
|
||||
|
||||
/* Define to 1 if the system has the type `LOGICAL_PROCESSOR_RELATIONSHIP'. */
|
||||
#define HAVE_LOGICAL_PROCESSOR_RELATIONSHIP 1
|
||||
|
||||
/* Define to 1 if you have the <mach/mach_host.h> header file. */
|
||||
/* #undef HAVE_MACH_MACH_HOST_H */
|
||||
|
||||
/* Define to 1 if you have the <mach/mach_init.h> header file. */
|
||||
/* #undef HAVE_MACH_MACH_INIT_H */
|
||||
|
||||
/* Define to 1 if you have the <malloc.h> header file. */
|
||||
#define HAVE_MALLOC_H 1
|
||||
|
||||
/* Define to 1 if you have the `memalign' function. */
|
||||
/* #undef HAVE_MEMALIGN */
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define to 1 if you have the `nl_langinfo' function. */
|
||||
/* #undef HAVE_NL_LANGINFO */
|
||||
|
||||
/* Define to 1 if you have the <numaif.h> header file. */
|
||||
/* #undef HAVE_NUMAIF_H */
|
||||
|
||||
/* Define to 1 if the system has the type `NUMA_NODE_RELATIONSHIP'. */
|
||||
#define HAVE_NUMA_NODE_RELATIONSHIP 1
|
||||
|
||||
/* Define to 1 if you have the <NVCtrl/NVCtrl.h> header file. */
|
||||
/* #undef HAVE_NVCTRL_NVCTRL_H */
|
||||
|
||||
/* Define to 1 if you have the <nvml.h> header file. */
|
||||
/* #undef HAVE_NVML_H */
|
||||
|
||||
/* Define to 1 if you have the `openat' function. */
|
||||
/* #undef HAVE_OPENAT */
|
||||
|
||||
/* Define to 1 if you have the <picl.h> header file. */
|
||||
/* #undef HAVE_PICL_H */
|
||||
|
||||
/* Define to 1 if you have the `posix_memalign' function. */
|
||||
/* #undef HAVE_POSIX_MEMALIGN */
|
||||
|
||||
/* Define to 1 if the system has the type `PROCESSOR_CACHE_TYPE'. */
|
||||
#define HAVE_PROCESSOR_CACHE_TYPE 1
|
||||
|
||||
/* Define to 1 if the system has the type `PROCESSOR_GROUP_INFO'. */
|
||||
#define HAVE_PROCESSOR_GROUP_INFO 1
|
||||
|
||||
/* Define to 1 if the system has the type `PROCESSOR_RELATIONSHIP'. */
|
||||
#define HAVE_PROCESSOR_RELATIONSHIP 1
|
||||
|
||||
/* Define to 1 if the system has the type `PSAPI_WORKING_SET_EX_BLOCK'. */
|
||||
/* #undef HAVE_PSAPI_WORKING_SET_EX_BLOCK */
|
||||
|
||||
/* Define to 1 if the system has the type `PSAPI_WORKING_SET_EX_INFORMATION'.
|
||||
*/
|
||||
/* #undef HAVE_PSAPI_WORKING_SET_EX_INFORMATION */
|
||||
|
||||
/* Define to 1 if the system has the type `PROCESSOR_NUMBER'. */
|
||||
#define HAVE_PROCESSOR_NUMBER 1
|
||||
|
||||
/* Define to 1 if you have the <pthread_np.h> header file. */
|
||||
/* #undef HAVE_PTHREAD_NP_H */
|
||||
|
||||
/* Define to 1 if the system has the type `pthread_t'. */
|
||||
/* #undef HAVE_PTHREAD_T */
|
||||
#undef HAVE_PTHREAD_T
|
||||
|
||||
/* Define to 1 if you have the `putwc' function. */
|
||||
#define HAVE_PUTWC 1
|
||||
|
||||
/* Define to 1 if the system has the type `RelationProcessorPackage'. */
|
||||
/* #undef HAVE_RELATIONPROCESSORPACKAGE */
|
||||
|
||||
/* Define to 1 if you have the `setlocale' function. */
|
||||
#define HAVE_SETLOCALE 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the `strftime' function. */
|
||||
#define HAVE_STRFTIME 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
/* #define HAVE_STRINGS_H 1*/
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the `strncasecmp' function. */
|
||||
#define HAVE_STRNCASECMP 1
|
||||
|
||||
/* Define to '1' if sysctl is present and usable */
|
||||
/* #undef HAVE_SYSCTL */
|
||||
|
||||
/* Define to '1' if sysctlbyname is present and usable */
|
||||
/* #undef HAVE_SYSCTLBYNAME */
|
||||
|
||||
/* Define to 1 if the system has the type
|
||||
`SYSTEM_LOGICAL_PROCESSOR_INFORMATION'. */
|
||||
#define HAVE_SYSTEM_LOGICAL_PROCESSOR_INFORMATION 1
|
||||
|
||||
/* Define to 1 if the system has the type
|
||||
`SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX'. */
|
||||
#define HAVE_SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX 1
|
||||
|
||||
/* Define to 1 if you have the <sys/cpuset.h> header file. */
|
||||
/* #undef HAVE_SYS_CPUSET_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/lgrp_user.h> header file. */
|
||||
/* #undef HAVE_SYS_LGRP_USER_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/mman.h> header file. */
|
||||
/* #undef HAVE_SYS_MMAN_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
/* #define HAVE_SYS_PARAM_H 1 */
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/sysctl.h> header file. */
|
||||
/* #undef HAVE_SYS_SYSCTL_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/utsname.h> header file. */
|
||||
/* #undef HAVE_SYS_UTSNAME_H */
|
||||
|
||||
/* Define to 1 if you have the `uname' function. */
|
||||
/* #undef HAVE_UNAME */
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
/* #define HAVE_UNISTD_H 1 */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `uselocale' function. */
|
||||
/* #undef HAVE_USELOCALE */
|
||||
|
||||
/* Define to 1 if the system has the type `wchar_t'. */
|
||||
#define HAVE_WCHAR_T 1
|
||||
|
||||
/* Define to 1 if you have the <X11/keysym.h> header file. */
|
||||
/* #undef HAVE_X11_KEYSYM_H */
|
||||
|
||||
/* Define to 1 if you have the <X11/Xlib.h> header file. */
|
||||
/* #undef HAVE_X11_XLIB_H */
|
||||
|
||||
/* Define to 1 if you have the <X11/Xutil.h> header file. */
|
||||
/* #undef HAVE_X11_XUTIL_H */
|
||||
|
||||
/* Define to 1 if you have the <xlocale.h> header file. */
|
||||
/* #undef HAVE_XLOCALE_H */
|
||||
|
||||
/* Define to 1 on AIX */
|
||||
/* #undef HWLOC_AIX_SYS */
|
||||
|
||||
/* Define to 1 on BlueGene/Q */
|
||||
/* #undef HWLOC_BGQ_SYS */
|
||||
|
||||
/* Whether C compiler supports symbol visibility or not */
|
||||
#define HWLOC_C_HAVE_VISIBILITY 0
|
||||
|
||||
/* Define to 1 on Darwin */
|
||||
/* #undef HWLOC_DARWIN_SYS */
|
||||
|
||||
/* Whether we are in debugging mode or not */
|
||||
/* #undef HWLOC_DEBUG */
|
||||
|
||||
/* Define to 1 on *FREEBSD */
|
||||
/* #undef HWLOC_FREEBSD_SYS */
|
||||
|
||||
/* Whether your compiler has __attribute__ or not */
|
||||
/* #define HWLOC_HAVE_ATTRIBUTE 1 */
|
||||
#undef HWLOC_HAVE_ATTRIBUTE
|
||||
|
||||
/* Whether your compiler has __attribute__ aligned or not */
|
||||
/* #define HWLOC_HAVE_ATTRIBUTE_ALIGNED 1 */
|
||||
|
||||
/* Whether your compiler has __attribute__ always_inline or not */
|
||||
/* #define HWLOC_HAVE_ATTRIBUTE_ALWAYS_INLINE 1 */
|
||||
|
||||
/* Whether your compiler has __attribute__ cold or not */
|
||||
/* #define HWLOC_HAVE_ATTRIBUTE_COLD 1 */
|
||||
|
||||
/* Whether your compiler has __attribute__ const or not */
|
||||
/* #define HWLOC_HAVE_ATTRIBUTE_CONST 1 */
|
||||
|
||||
/* Whether your compiler has __attribute__ deprecated or not */
|
||||
/* #define HWLOC_HAVE_ATTRIBUTE_DEPRECATED 1 */
|
||||
|
||||
/* Whether your compiler has __attribute__ format or not */
|
||||
/* #define HWLOC_HAVE_ATTRIBUTE_FORMAT 1 */
|
||||
|
||||
/* Whether your compiler has __attribute__ hot or not */
|
||||
/* #define HWLOC_HAVE_ATTRIBUTE_HOT 1 */
|
||||
|
||||
/* Whether your compiler has __attribute__ malloc or not */
|
||||
/* #define HWLOC_HAVE_ATTRIBUTE_MALLOC 1 */
|
||||
|
||||
/* Whether your compiler has __attribute__ may_alias or not */
|
||||
/* #define HWLOC_HAVE_ATTRIBUTE_MAY_ALIAS 1 */
|
||||
|
||||
/* Whether your compiler has __attribute__ nonnull or not */
|
||||
/* #define HWLOC_HAVE_ATTRIBUTE_NONNULL 1 */
|
||||
|
||||
/* Whether your compiler has __attribute__ noreturn or not */
|
||||
/* #define HWLOC_HAVE_ATTRIBUTE_NORETURN 1 */
|
||||
|
||||
/* Whether your compiler has __attribute__ no_instrument_function or not */
|
||||
/* #define HWLOC_HAVE_ATTRIBUTE_NO_INSTRUMENT_FUNCTION 1 */
|
||||
|
||||
/* Whether your compiler has __attribute__ packed or not */
|
||||
/* #define HWLOC_HAVE_ATTRIBUTE_PACKED 1 */
|
||||
|
||||
/* Whether your compiler has __attribute__ pure or not */
|
||||
/* #define HWLOC_HAVE_ATTRIBUTE_PURE 1 */
|
||||
|
||||
/* Whether your compiler has __attribute__ sentinel or not */
|
||||
/* #define HWLOC_HAVE_ATTRIBUTE_SENTINEL 1 */
|
||||
|
||||
/* Whether your compiler has __attribute__ unused or not */
|
||||
/* #define HWLOC_HAVE_ATTRIBUTE_UNUSED 1 */
|
||||
|
||||
/* Whether your compiler has __attribute__ warn unused result or not */
|
||||
/* #define HWLOC_HAVE_ATTRIBUTE_WARN_UNUSED_RESULT 1 */
|
||||
|
||||
/* Whether your compiler has __attribute__ weak alias or not */
|
||||
/* #define HWLOC_HAVE_ATTRIBUTE_WEAK_ALIAS 1 */
|
||||
|
||||
/* Define to 1 if your `ffs' function is known to be broken. */
|
||||
/* #undef HWLOC_HAVE_BROKEN_FFS */
|
||||
|
||||
/* Define to 1 if you have the `cairo' library. */
|
||||
/* #undef HWLOC_HAVE_CAIRO */
|
||||
|
||||
/* Define to 1 if you have the `clz' function. */
|
||||
/* #undef HWLOC_HAVE_CLZ */
|
||||
|
||||
/* Define to 1 if you have the `clzl' function. */
|
||||
/* #undef HWLOC_HAVE_CLZL */
|
||||
|
||||
/* Define to 1 if you have cpuid */
|
||||
/* #undef HWLOC_HAVE_CPUID */
|
||||
|
||||
/* Define to 1 if the CPU_SET macro works */
|
||||
/* #undef HWLOC_HAVE_CPU_SET */
|
||||
|
||||
/* Define to 1 if the CPU_SET_S macro works */
|
||||
/* #undef HWLOC_HAVE_CPU_SET_S */
|
||||
|
||||
/* Define to 1 if you have the `cudart' SDK. */
|
||||
/* #undef HWLOC_HAVE_CUDART */
|
||||
|
||||
/* Define to 1 if function `clz' is declared by system headers */
|
||||
/* #undef HWLOC_HAVE_DECL_CLZ */
|
||||
|
||||
/* Define to 1 if function `clzl' is declared by system headers */
|
||||
/* #undef HWLOC_HAVE_DECL_CLZL */
|
||||
|
||||
/* Define to 1 if function `ffs' is declared by system headers */
|
||||
/* #undef HWLOC_HAVE_DECL_FFS */
|
||||
|
||||
/* Define to 1 if function `ffsl' is declared by system headers */
|
||||
/* #undef HWLOC_HAVE_DECL_FFSL */
|
||||
|
||||
/* Define to 1 if function `fls' is declared by system headers */
|
||||
/* #undef HWLOC_HAVE_DECL_FLS */
|
||||
|
||||
/* Define to 1 if function `flsl' is declared by system headers */
|
||||
/* #undef HWLOC_HAVE_DECL_FLSL */
|
||||
|
||||
/* Define to 1 if you have the `ffs' function. */
|
||||
/* #undef HWLOC_HAVE_FFS */
|
||||
|
||||
/* Define to 1 if you have the `ffsl' function. */
|
||||
/* #undef HWLOC_HAVE_FFSL */
|
||||
|
||||
/* Define to 1 if you have the `fls' function. */
|
||||
/* #undef HWLOC_HAVE_FLS */
|
||||
|
||||
/* Define to 1 if you have the `flsl' function. */
|
||||
/* #undef HWLOC_HAVE_FLSL */
|
||||
|
||||
/* Define to 1 if you have the GL module components. */
|
||||
/* #undef HWLOC_HAVE_GL */
|
||||
|
||||
/* Define to 1 if you have a library providing the termcap interface */
|
||||
/* #undef HWLOC_HAVE_LIBTERMCAP */
|
||||
|
||||
/* Define to 1 if you have the `libxml2' library. */
|
||||
/* #undef HWLOC_HAVE_LIBXML2 */
|
||||
|
||||
/* Define to 1 if building the Linux PCI component */
|
||||
/* #undef HWLOC_HAVE_LINUXPCI */
|
||||
|
||||
/* Define to 1 if you have the `NVML' library. */
|
||||
/* #undef HWLOC_HAVE_NVML */
|
||||
|
||||
/* Define to 1 if glibc provides the old prototype (without length) of
|
||||
sched_setaffinity() */
|
||||
/* #undef HWLOC_HAVE_OLD_SCHED_SETAFFINITY */
|
||||
|
||||
/* Define to 1 if you have the `OpenCL' library. */
|
||||
/* #undef HWLOC_HAVE_OPENCL */
|
||||
|
||||
/* Define to 1 if the hwloc library should support dynamically-loaded plugins
|
||||
*/
|
||||
/* #undef HWLOC_HAVE_PLUGINS */
|
||||
|
||||
/* `Define to 1 if you have pthread_getthrds_np' */
|
||||
/* #undef HWLOC_HAVE_PTHREAD_GETTHRDS_NP */
|
||||
|
||||
/* Define to 1 if pthread mutexes are available */
|
||||
/* #undef HWLOC_HAVE_PTHREAD_MUTEX */
|
||||
|
||||
/* Define to 1 if glibc provides a prototype of sched_setaffinity() */
|
||||
#define HWLOC_HAVE_SCHED_SETAFFINITY 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HWLOC_HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the `windows.h' header. */
|
||||
#define HWLOC_HAVE_WINDOWS_H 1
|
||||
|
||||
/* Define to 1 if X11 headers including Xutil.h and keysym.h are available. */
|
||||
/* #undef HWLOC_HAVE_X11_KEYSYM */
|
||||
|
||||
/* Define to 1 if function `syscall' is available */
|
||||
/* #undef HWLOC_HAVE_SYSCALL */
|
||||
|
||||
/* Define to 1 on HP-UX */
|
||||
/* #undef HWLOC_HPUX_SYS */
|
||||
|
||||
/* Define to 1 on Linux */
|
||||
/* #undef HWLOC_LINUX_SYS */
|
||||
|
||||
/* Define to 1 on *NETBSD */
|
||||
/* #undef HWLOC_NETBSD_SYS */
|
||||
|
||||
/* The size of `unsigned int', as computed by sizeof */
|
||||
#define HWLOC_SIZEOF_UNSIGNED_INT 4
|
||||
|
||||
/* The size of `unsigned long', as computed by sizeof */
|
||||
#define HWLOC_SIZEOF_UNSIGNED_LONG 4
|
||||
|
||||
/* Define to 1 on Solaris */
|
||||
/* #undef HWLOC_SOLARIS_SYS */
|
||||
|
||||
/* The hwloc symbol prefix */
|
||||
#define HWLOC_SYM_PREFIX hwloc_
|
||||
|
||||
/* The hwloc symbol prefix in all caps */
|
||||
#define HWLOC_SYM_PREFIX_CAPS HWLOC_
|
||||
|
||||
/* Whether we need to re-define all the hwloc public symbols or not */
|
||||
#define HWLOC_SYM_TRANSFORM 0
|
||||
|
||||
/* Define to 1 on unsupported systems */
|
||||
/* #undef HWLOC_UNSUPPORTED_SYS */
|
||||
|
||||
/* Define to 1 if ncurses works, preferred over curses */
|
||||
/* #undef HWLOC_USE_NCURSES */
|
||||
|
||||
/* Define to 1 on WINDOWS */
|
||||
#define HWLOC_WIN_SYS 1
|
||||
|
||||
/* Define to 1 on x86_32 */
|
||||
/* #undef HWLOC_X86_32_ARCH */
|
||||
|
||||
/* Define to 1 on x86_64 */
|
||||
#define HWLOC_X86_64_ARCH 1
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#define LT_OBJDIR ".libs/"
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "hwloc"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT "http://www.open-mpi.org/projects/hwloc/"
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "hwloc"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "hwloc"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "hwloc"
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION HWLOC_VERSION
|
||||
|
||||
/* The size of `unsigned int', as computed by sizeof. */
|
||||
#define SIZEOF_UNSIGNED_INT 4
|
||||
|
||||
/* The size of `unsigned long', as computed by sizeof. */
|
||||
#define SIZEOF_UNSIGNED_LONG 4
|
||||
|
||||
/* The size of `void *', as computed by sizeof. */
|
||||
#define SIZEOF_VOID_P 8
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Enable extensions on HP-UX. */
|
||||
#ifndef _HPUX_SOURCE
|
||||
# define _HPUX_SOURCE 1
|
||||
#endif
|
||||
|
||||
|
||||
/* Enable extensions on AIX 3, Interix. */
|
||||
/*
|
||||
#ifndef _ALL_SOURCE
|
||||
# define _ALL_SOURCE 1
|
||||
#endif
|
||||
*/
|
||||
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
/*
|
||||
#ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE 1
|
||||
#endif
|
||||
*/
|
||||
/* Enable threading extensions on Solaris. */
|
||||
/*
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
# define _POSIX_PTHREAD_SEMANTICS 1
|
||||
#endif
|
||||
*/
|
||||
/* Enable extensions on HP NonStop. */
|
||||
/*
|
||||
#ifndef _TANDEM_SOURCE
|
||||
# define _TANDEM_SOURCE 1
|
||||
#endif
|
||||
*/
|
||||
/* Enable general extensions on Solaris. */
|
||||
/*
|
||||
#ifndef __EXTENSIONS__
|
||||
# define __EXTENSIONS__ 1
|
||||
#endif
|
||||
*/
|
||||
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION HWLOC_VERSION
|
||||
|
||||
/* Define to 1 if the X Window System is missing or not being used. */
|
||||
#define X_DISPLAY_MISSING 1
|
||||
|
||||
/* Define to 1 if on MINIX. */
|
||||
/* #undef _MINIX */
|
||||
|
||||
/* Define to 2 if the system does not provide POSIX.1 features except with
|
||||
this defined. */
|
||||
/* #undef _POSIX_1_SOURCE */
|
||||
|
||||
/* Define to 1 if you need to in order for `stat' and other things to work. */
|
||||
/* #undef _POSIX_SOURCE */
|
||||
|
||||
/* Define this to the process ID type */
|
||||
#define hwloc_pid_t HANDLE
|
||||
|
||||
/* Define this to either strncasecmp or strncmp */
|
||||
#define hwloc_strncasecmp strncasecmp
|
||||
|
||||
/* Define this to the thread ID type */
|
||||
#define hwloc_thread_t HANDLE
|
||||
|
||||
|
||||
#endif /* HWLOC_CONFIGURE_H */
|
||||
45
src/3rdparty/hwloc/include/private/components.h
vendored
45
src/3rdparty/hwloc/include/private/components.h
vendored
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2012-2019 Inria. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HWLOC_INSIDE_PLUGIN
|
||||
/*
|
||||
* these declarations are internal only, they are not available to plugins
|
||||
* (many functions below are internal static symbols).
|
||||
*/
|
||||
#error This file should not be used in plugins
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef PRIVATE_COMPONENTS_H
|
||||
#define PRIVATE_COMPONENTS_H 1
|
||||
|
||||
#include "hwloc/plugins.h"
|
||||
|
||||
struct hwloc_topology;
|
||||
|
||||
extern int hwloc_disc_component_force_enable(struct hwloc_topology *topology,
|
||||
int envvar_forced, /* 1 if forced through envvar, 0 if forced through API */
|
||||
const char *name,
|
||||
const void *data1, const void *data2, const void *data3);
|
||||
extern void hwloc_disc_components_enable_others(struct hwloc_topology *topology);
|
||||
|
||||
/* Compute the topology is_thissystem flag and find some callbacks based on enabled backends */
|
||||
extern void hwloc_backends_is_thissystem(struct hwloc_topology *topology);
|
||||
extern void hwloc_backends_find_callbacks(struct hwloc_topology *topology);
|
||||
|
||||
/* Initialize the lists of components and backends used by a topology */
|
||||
extern void hwloc_topology_components_init(struct hwloc_topology *topology);
|
||||
/* Disable and destroy all backends used by a topology */
|
||||
extern void hwloc_backends_disable_all(struct hwloc_topology *topology);
|
||||
/* Cleanup the lists of components used by a topology */
|
||||
extern void hwloc_topology_components_fini(struct hwloc_topology *topology);
|
||||
|
||||
/* Used by the core to setup/destroy the list of components */
|
||||
extern void hwloc_components_init(void); /* increases components refcount, should be called exactly once per topology (during init) */
|
||||
extern void hwloc_components_fini(void); /* decreases components refcount, should be called exactly once per topology (during destroy) */
|
||||
|
||||
#endif /* PRIVATE_COMPONENTS_H */
|
||||
|
||||
86
src/3rdparty/hwloc/include/private/cpuid-x86.h
vendored
86
src/3rdparty/hwloc/include/private/cpuid-x86.h
vendored
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2010-2012, 2014 Université Bordeaux
|
||||
* Copyright © 2010 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright © 2014 Inria. All rights reserved.
|
||||
*
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/* Internals for x86's cpuid. */
|
||||
|
||||
#ifndef HWLOC_PRIVATE_CPUID_X86_H
|
||||
#define HWLOC_PRIVATE_CPUID_X86_H
|
||||
|
||||
#if (defined HWLOC_X86_32_ARCH) && (!defined HWLOC_HAVE_MSVC_CPUIDEX)
|
||||
static __hwloc_inline int hwloc_have_x86_cpuid(void)
|
||||
{
|
||||
int ret;
|
||||
unsigned tmp, tmp2;
|
||||
__asm__(
|
||||
"mov $0,%0\n\t" /* Not supported a priori */
|
||||
|
||||
"pushfl \n\t" /* Save flags */
|
||||
|
||||
"pushfl \n\t" \
|
||||
"pop %1 \n\t" /* Get flags */ \
|
||||
|
||||
#define TRY_TOGGLE \
|
||||
"xor $0x00200000,%1\n\t" /* Try to toggle ID */ \
|
||||
"mov %1,%2\n\t" /* Save expected value */ \
|
||||
"push %1 \n\t" \
|
||||
"popfl \n\t" /* Try to toggle */ \
|
||||
"pushfl \n\t" \
|
||||
"pop %1 \n\t" \
|
||||
"cmp %1,%2\n\t" /* Compare with expected value */ \
|
||||
"jnz 0f\n\t" /* Unexpected, failure */ \
|
||||
|
||||
TRY_TOGGLE /* Try to set/clear */
|
||||
TRY_TOGGLE /* Try to clear/set */
|
||||
|
||||
"mov $1,%0\n\t" /* Passed the test! */
|
||||
|
||||
"0: \n\t"
|
||||
"popfl \n\t" /* Restore flags */
|
||||
|
||||
: "=r" (ret), "=&r" (tmp), "=&r" (tmp2));
|
||||
return ret;
|
||||
}
|
||||
#endif /* !defined HWLOC_X86_32_ARCH && !defined HWLOC_HAVE_MSVC_CPUIDEX*/
|
||||
#if (defined HWLOC_X86_64_ARCH) || (defined HWLOC_HAVE_MSVC_CPUIDEX)
|
||||
static __hwloc_inline int hwloc_have_x86_cpuid(void) { return 1; }
|
||||
#endif /* HWLOC_X86_64_ARCH */
|
||||
|
||||
static __hwloc_inline void hwloc_x86_cpuid(unsigned *eax, unsigned *ebx, unsigned *ecx, unsigned *edx)
|
||||
{
|
||||
#ifdef HWLOC_HAVE_MSVC_CPUIDEX
|
||||
int regs[4];
|
||||
__cpuidex(regs, *eax, *ecx);
|
||||
*eax = regs[0];
|
||||
*ebx = regs[1];
|
||||
*ecx = regs[2];
|
||||
*edx = regs[3];
|
||||
#else /* HWLOC_HAVE_MSVC_CPUIDEX */
|
||||
/* Note: gcc might want to use bx or the stack for %1 addressing, so we can't
|
||||
* use them :/ */
|
||||
#ifdef HWLOC_X86_64_ARCH
|
||||
hwloc_uint64_t sav_rbx;
|
||||
__asm__(
|
||||
"mov %%rbx,%2\n\t"
|
||||
"cpuid\n\t"
|
||||
"xchg %2,%%rbx\n\t"
|
||||
"movl %k2,%1\n\t"
|
||||
: "+a" (*eax), "=m" (*ebx), "=&r"(sav_rbx),
|
||||
"+c" (*ecx), "=&d" (*edx));
|
||||
#elif defined(HWLOC_X86_32_ARCH)
|
||||
__asm__(
|
||||
"mov %%ebx,%1\n\t"
|
||||
"cpuid\n\t"
|
||||
"xchg %%ebx,%1\n\t"
|
||||
: "+a" (*eax), "=&SD" (*ebx), "+c" (*ecx), "=&d" (*edx));
|
||||
#else
|
||||
#error unknown architecture
|
||||
#endif
|
||||
#endif /* HWLOC_HAVE_MSVC_CPUIDEX */
|
||||
}
|
||||
|
||||
#endif /* HWLOC_PRIVATE_X86_CPUID_H */
|
||||
83
src/3rdparty/hwloc/include/private/debug.h
vendored
83
src/3rdparty/hwloc/include/private/debug.h
vendored
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2017 Inria. All rights reserved.
|
||||
* Copyright © 2009, 2011 Université Bordeaux
|
||||
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/* The configuration file */
|
||||
|
||||
#ifndef HWLOC_DEBUG_H
|
||||
#define HWLOC_DEBUG_H
|
||||
|
||||
#include "private/autogen/config.h"
|
||||
#include "private/misc.h"
|
||||
|
||||
#ifdef HWLOC_DEBUG
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
/* Compile-time assertion */
|
||||
#define HWLOC_BUILD_ASSERT(condition) ((void)sizeof(char[1 - 2*!(condition)]))
|
||||
|
||||
#ifdef HWLOC_DEBUG
|
||||
static __hwloc_inline int hwloc_debug_enabled(void)
|
||||
{
|
||||
static int checked = 0;
|
||||
static int enabled = 1;
|
||||
if (!checked) {
|
||||
const char *env = getenv("HWLOC_DEBUG_VERBOSE");
|
||||
if (env)
|
||||
enabled = atoi(env);
|
||||
if (enabled)
|
||||
fprintf(stderr, "hwloc verbose debug enabled, may be disabled with HWLOC_DEBUG_VERBOSE=0 in the environment.\n");
|
||||
checked = 1;
|
||||
}
|
||||
return enabled;
|
||||
}
|
||||
#endif
|
||||
|
||||
static __hwloc_inline void hwloc_debug(const char *s __hwloc_attribute_unused, ...) __hwloc_attribute_format(printf, 1, 2);
|
||||
static __hwloc_inline void hwloc_debug(const char *s __hwloc_attribute_unused, ...)
|
||||
{
|
||||
#ifdef HWLOC_DEBUG
|
||||
if (hwloc_debug_enabled()) {
|
||||
va_list ap;
|
||||
va_start(ap, s);
|
||||
vfprintf(stderr, s, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HWLOC_DEBUG
|
||||
#define hwloc_debug_bitmap(fmt, bitmap) do { \
|
||||
if (hwloc_debug_enabled()) { \
|
||||
char *s; \
|
||||
hwloc_bitmap_asprintf(&s, bitmap); \
|
||||
fprintf(stderr, fmt, s); \
|
||||
free(s); \
|
||||
} } while (0)
|
||||
#define hwloc_debug_1arg_bitmap(fmt, arg1, bitmap) do { \
|
||||
if (hwloc_debug_enabled()) { \
|
||||
char *s; \
|
||||
hwloc_bitmap_asprintf(&s, bitmap); \
|
||||
fprintf(stderr, fmt, arg1, s); \
|
||||
free(s); \
|
||||
} } while (0)
|
||||
#define hwloc_debug_2args_bitmap(fmt, arg1, arg2, bitmap) do { \
|
||||
if (hwloc_debug_enabled()) { \
|
||||
char *s; \
|
||||
hwloc_bitmap_asprintf(&s, bitmap); \
|
||||
fprintf(stderr, fmt, arg1, arg2, s); \
|
||||
free(s); \
|
||||
} } while (0)
|
||||
#else
|
||||
#define hwloc_debug_bitmap(s, bitmap) do { } while(0)
|
||||
#define hwloc_debug_1arg_bitmap(s, arg1, bitmap) do { } while(0)
|
||||
#define hwloc_debug_2args_bitmap(s, arg1, arg2, bitmap) do { } while(0)
|
||||
#endif
|
||||
|
||||
#endif /* HWLOC_DEBUG_H */
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2018-2019 Inria. All rights reserved.
|
||||
*
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/* List of components defined inside hwloc */
|
||||
|
||||
#ifndef PRIVATE_INTERNAL_COMPONENTS_H
|
||||
#define PRIVATE_INTERNAL_COMPONENTS_H
|
||||
|
||||
/* global discovery */
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_xml_component;
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_synthetic_component;
|
||||
|
||||
/* CPU discovery */
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_aix_component;
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_bgq_component;
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_darwin_component;
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_freebsd_component;
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_hpux_component;
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_linux_component;
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_netbsd_component;
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_noos_component;
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_solaris_component;
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_windows_component;
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_x86_component;
|
||||
|
||||
/* I/O discovery */
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_cuda_component;
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_gl_component;
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_nvml_component;
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_opencl_component;
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_pci_component;
|
||||
|
||||
/* XML backend */
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_xml_nolibxml_component;
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_xml_libxml_component;
|
||||
|
||||
#endif /* PRIVATE_INTERNAL_COMPONENTS_H */
|
||||
576
src/3rdparty/hwloc/include/private/misc.h
vendored
576
src/3rdparty/hwloc/include/private/misc.h
vendored
@@ -1,576 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2019 Inria. All rights reserved.
|
||||
* Copyright © 2009-2012 Université Bordeaux
|
||||
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/* Misc macros and inlines. */
|
||||
|
||||
#ifndef HWLOC_PRIVATE_MISC_H
|
||||
#define HWLOC_PRIVATE_MISC_H
|
||||
|
||||
#include "hwloc/autogen/config.h"
|
||||
#include "private/autogen/config.h"
|
||||
#include "hwloc.h"
|
||||
|
||||
#ifdef HWLOC_HAVE_DECL_STRNCASECMP
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#else
|
||||
#ifdef HAVE_CTYPE_H
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define HWLOC_BITS_PER_LONG (HWLOC_SIZEOF_UNSIGNED_LONG * 8)
|
||||
#define HWLOC_BITS_PER_INT (HWLOC_SIZEOF_UNSIGNED_INT * 8)
|
||||
|
||||
#if (HWLOC_BITS_PER_LONG != 32) && (HWLOC_BITS_PER_LONG != 64)
|
||||
#error "unknown size for unsigned long."
|
||||
#endif
|
||||
|
||||
#if (HWLOC_BITS_PER_INT != 16) && (HWLOC_BITS_PER_INT != 32) && (HWLOC_BITS_PER_INT != 64)
|
||||
#error "unknown size for unsigned int."
|
||||
#endif
|
||||
|
||||
/* internal-use-only value for when we don't know the type or don't have any value */
|
||||
#define HWLOC_OBJ_TYPE_NONE ((hwloc_obj_type_t) -1)
|
||||
|
||||
/**
|
||||
* ffsl helpers.
|
||||
*/
|
||||
|
||||
#if defined(HWLOC_HAVE_BROKEN_FFS)
|
||||
|
||||
/* System has a broken ffs().
|
||||
* We must check the before __GNUC__ or HWLOC_HAVE_FFSL
|
||||
*/
|
||||
# define HWLOC_NO_FFS
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
# if (__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))
|
||||
/* Starting from 3.4, gcc has a long variant. */
|
||||
# define hwloc_ffsl(x) __builtin_ffsl(x)
|
||||
# else
|
||||
# define hwloc_ffs(x) __builtin_ffs(x)
|
||||
# define HWLOC_NEED_FFSL
|
||||
# endif
|
||||
|
||||
#elif defined(HWLOC_HAVE_FFSL)
|
||||
|
||||
# ifndef HWLOC_HAVE_DECL_FFSL
|
||||
extern int ffsl(long) __hwloc_attribute_const;
|
||||
# endif
|
||||
|
||||
# define hwloc_ffsl(x) ffsl(x)
|
||||
|
||||
#elif defined(HWLOC_HAVE_FFS)
|
||||
|
||||
# ifndef HWLOC_HAVE_DECL_FFS
|
||||
extern int ffs(int) __hwloc_attribute_const;
|
||||
# endif
|
||||
|
||||
# define hwloc_ffs(x) ffs(x)
|
||||
# define HWLOC_NEED_FFSL
|
||||
|
||||
#else /* no ffs implementation */
|
||||
|
||||
# define HWLOC_NO_FFS
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HWLOC_NO_FFS
|
||||
|
||||
/* no ffs or it is known to be broken */
|
||||
static __hwloc_inline int
|
||||
hwloc_ffsl_manual(unsigned long x) __hwloc_attribute_const;
|
||||
static __hwloc_inline int
|
||||
hwloc_ffsl_manual(unsigned long x)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!x)
|
||||
return 0;
|
||||
|
||||
i = 1;
|
||||
#if HWLOC_BITS_PER_LONG >= 64
|
||||
if (!(x & 0xfffffffful)) {
|
||||
x >>= 32;
|
||||
i += 32;
|
||||
}
|
||||
#endif
|
||||
if (!(x & 0xffffu)) {
|
||||
x >>= 16;
|
||||
i += 16;
|
||||
}
|
||||
if (!(x & 0xff)) {
|
||||
x >>= 8;
|
||||
i += 8;
|
||||
}
|
||||
if (!(x & 0xf)) {
|
||||
x >>= 4;
|
||||
i += 4;
|
||||
}
|
||||
if (!(x & 0x3)) {
|
||||
x >>= 2;
|
||||
i += 2;
|
||||
}
|
||||
if (!(x & 0x1)) {
|
||||
x >>= 1;
|
||||
i += 1;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
/* always define hwloc_ffsl as a macro, to avoid renaming breakage */
|
||||
#define hwloc_ffsl hwloc_ffsl_manual
|
||||
|
||||
#elif defined(HWLOC_NEED_FFSL)
|
||||
|
||||
/* We only have an int ffs(int) implementation, build a long one. */
|
||||
|
||||
/* First make it 32 bits if it was only 16. */
|
||||
static __hwloc_inline int
|
||||
hwloc_ffs32(unsigned long x) __hwloc_attribute_const;
|
||||
static __hwloc_inline int
|
||||
hwloc_ffs32(unsigned long x)
|
||||
{
|
||||
#if HWLOC_BITS_PER_INT == 16
|
||||
int low_ffs, hi_ffs;
|
||||
|
||||
low_ffs = hwloc_ffs(x & 0xfffful);
|
||||
if (low_ffs)
|
||||
return low_ffs;
|
||||
|
||||
hi_ffs = hwloc_ffs(x >> 16);
|
||||
if (hi_ffs)
|
||||
return hi_ffs + 16;
|
||||
|
||||
return 0;
|
||||
#else
|
||||
return hwloc_ffs(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Then make it 64 bit if longs are. */
|
||||
static __hwloc_inline int
|
||||
hwloc_ffsl_from_ffs32(unsigned long x) __hwloc_attribute_const;
|
||||
static __hwloc_inline int
|
||||
hwloc_ffsl_from_ffs32(unsigned long x)
|
||||
{
|
||||
#if HWLOC_BITS_PER_LONG == 64
|
||||
int low_ffs, hi_ffs;
|
||||
|
||||
low_ffs = hwloc_ffs32(x & 0xfffffffful);
|
||||
if (low_ffs)
|
||||
return low_ffs;
|
||||
|
||||
hi_ffs = hwloc_ffs32(x >> 32);
|
||||
if (hi_ffs)
|
||||
return hi_ffs + 32;
|
||||
|
||||
return 0;
|
||||
#else
|
||||
return hwloc_ffs32(x);
|
||||
#endif
|
||||
}
|
||||
/* always define hwloc_ffsl as a macro, to avoid renaming breakage */
|
||||
#define hwloc_ffsl hwloc_ffsl_from_ffs32
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* flsl helpers.
|
||||
*/
|
||||
#ifdef __GNUC_____
|
||||
|
||||
# if (__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))
|
||||
# define hwloc_flsl(x) ((x) ? (8*sizeof(long) - __builtin_clzl(x)) : 0)
|
||||
# else
|
||||
# define hwloc_fls(x) ((x) ? (8*sizeof(int) - __builtin_clz(x)) : 0)
|
||||
# define HWLOC_NEED_FLSL
|
||||
# endif
|
||||
|
||||
#elif defined(HWLOC_HAVE_FLSL)
|
||||
|
||||
# ifndef HWLOC_HAVE_DECL_FLSL
|
||||
extern int flsl(long) __hwloc_attribute_const;
|
||||
# endif
|
||||
|
||||
# define hwloc_flsl(x) flsl(x)
|
||||
|
||||
#elif defined(HWLOC_HAVE_CLZL)
|
||||
|
||||
# ifndef HWLOC_HAVE_DECL_CLZL
|
||||
extern int clzl(long) __hwloc_attribute_const;
|
||||
# endif
|
||||
|
||||
# define hwloc_flsl(x) ((x) ? (8*sizeof(long) - clzl(x)) : 0)
|
||||
|
||||
#elif defined(HWLOC_HAVE_FLS)
|
||||
|
||||
# ifndef HWLOC_HAVE_DECL_FLS
|
||||
extern int fls(int) __hwloc_attribute_const;
|
||||
# endif
|
||||
|
||||
# define hwloc_fls(x) fls(x)
|
||||
# define HWLOC_NEED_FLSL
|
||||
|
||||
#elif defined(HWLOC_HAVE_CLZ)
|
||||
|
||||
# ifndef HWLOC_HAVE_DECL_CLZ
|
||||
extern int clz(int) __hwloc_attribute_const;
|
||||
# endif
|
||||
|
||||
# define hwloc_fls(x) ((x) ? (8*sizeof(int) - clz(x)) : 0)
|
||||
# define HWLOC_NEED_FLSL
|
||||
|
||||
#else /* no fls implementation */
|
||||
|
||||
static __hwloc_inline int
|
||||
hwloc_flsl_manual(unsigned long x) __hwloc_attribute_const;
|
||||
static __hwloc_inline int
|
||||
hwloc_flsl_manual(unsigned long x)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if (!x)
|
||||
return 0;
|
||||
|
||||
i = 1;
|
||||
#if HWLOC_BITS_PER_LONG >= 64
|
||||
if ((x & 0xffffffff00000000ul)) {
|
||||
x >>= 32;
|
||||
i += 32;
|
||||
}
|
||||
#endif
|
||||
if ((x & 0xffff0000u)) {
|
||||
x >>= 16;
|
||||
i += 16;
|
||||
}
|
||||
if ((x & 0xff00)) {
|
||||
x >>= 8;
|
||||
i += 8;
|
||||
}
|
||||
if ((x & 0xf0)) {
|
||||
x >>= 4;
|
||||
i += 4;
|
||||
}
|
||||
if ((x & 0xc)) {
|
||||
x >>= 2;
|
||||
i += 2;
|
||||
}
|
||||
if ((x & 0x2)) {
|
||||
x >>= 1;
|
||||
i += 1;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
/* always define hwloc_flsl as a macro, to avoid renaming breakage */
|
||||
#define hwloc_flsl hwloc_flsl_manual
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HWLOC_NEED_FLSL
|
||||
|
||||
/* We only have an int fls(int) implementation, build a long one. */
|
||||
|
||||
/* First make it 32 bits if it was only 16. */
|
||||
static __hwloc_inline int
|
||||
hwloc_fls32(unsigned long x) __hwloc_attribute_const;
|
||||
static __hwloc_inline int
|
||||
hwloc_fls32(unsigned long x)
|
||||
{
|
||||
#if HWLOC_BITS_PER_INT == 16
|
||||
int low_fls, hi_fls;
|
||||
|
||||
hi_fls = hwloc_fls(x >> 16);
|
||||
if (hi_fls)
|
||||
return hi_fls + 16;
|
||||
|
||||
low_fls = hwloc_fls(x & 0xfffful);
|
||||
if (low_fls)
|
||||
return low_fls;
|
||||
|
||||
return 0;
|
||||
#else
|
||||
return hwloc_fls(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Then make it 64 bit if longs are. */
|
||||
static __hwloc_inline int
|
||||
hwloc_flsl_from_fls32(unsigned long x) __hwloc_attribute_const;
|
||||
static __hwloc_inline int
|
||||
hwloc_flsl_from_fls32(unsigned long x)
|
||||
{
|
||||
#if HWLOC_BITS_PER_LONG == 64
|
||||
int low_fls, hi_fls;
|
||||
|
||||
hi_fls = hwloc_fls32(x >> 32);
|
||||
if (hi_fls)
|
||||
return hi_fls + 32;
|
||||
|
||||
low_fls = hwloc_fls32(x & 0xfffffffful);
|
||||
if (low_fls)
|
||||
return low_fls;
|
||||
|
||||
return 0;
|
||||
#else
|
||||
return hwloc_fls32(x);
|
||||
#endif
|
||||
}
|
||||
/* always define hwloc_flsl as a macro, to avoid renaming breakage */
|
||||
#define hwloc_flsl hwloc_flsl_from_fls32
|
||||
|
||||
#endif
|
||||
|
||||
static __hwloc_inline int
|
||||
hwloc_weight_long(unsigned long w) __hwloc_attribute_const;
|
||||
static __hwloc_inline int
|
||||
hwloc_weight_long(unsigned long w)
|
||||
{
|
||||
#if HWLOC_BITS_PER_LONG == 32
|
||||
#if (__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__) >= 4)
|
||||
return __builtin_popcount(w);
|
||||
#else
|
||||
unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555);
|
||||
res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
|
||||
res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F);
|
||||
res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF);
|
||||
return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
|
||||
#endif
|
||||
#else /* HWLOC_BITS_PER_LONG == 32 */
|
||||
#if (__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__) >= 4)
|
||||
return __builtin_popcountll(w);
|
||||
#else
|
||||
unsigned long res;
|
||||
res = (w & 0x5555555555555555ul) + ((w >> 1) & 0x5555555555555555ul);
|
||||
res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul);
|
||||
res = (res & 0x0F0F0F0F0F0F0F0Ful) + ((res >> 4) & 0x0F0F0F0F0F0F0F0Ful);
|
||||
res = (res & 0x00FF00FF00FF00FFul) + ((res >> 8) & 0x00FF00FF00FF00FFul);
|
||||
res = (res & 0x0000FFFF0000FFFFul) + ((res >> 16) & 0x0000FFFF0000FFFFul);
|
||||
return (res & 0x00000000FFFFFFFFul) + ((res >> 32) & 0x00000000FFFFFFFFul);
|
||||
#endif
|
||||
#endif /* HWLOC_BITS_PER_LONG == 64 */
|
||||
}
|
||||
|
||||
#if !HAVE_DECL_STRTOULL && defined(HAVE_STRTOULL)
|
||||
unsigned long long int strtoull(const char *nptr, char **endptr, int base);
|
||||
#endif
|
||||
|
||||
static __hwloc_inline int hwloc_strncasecmp(const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
#ifdef HWLOC_HAVE_DECL_STRNCASECMP
|
||||
return strncasecmp(s1, s2, n);
|
||||
#else
|
||||
while (n) {
|
||||
char c1 = tolower(*s1), c2 = tolower(*s2);
|
||||
if (!c1 || !c2 || c1 != c2)
|
||||
return c1-c2;
|
||||
n--; s1++; s2++;
|
||||
}
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static __hwloc_inline hwloc_obj_type_t hwloc_cache_type_by_depth_type(unsigned depth, hwloc_obj_cache_type_t type)
|
||||
{
|
||||
if (type == HWLOC_OBJ_CACHE_INSTRUCTION) {
|
||||
if (depth >= 1 && depth <= 3)
|
||||
return HWLOC_OBJ_L1ICACHE + depth-1;
|
||||
else
|
||||
return HWLOC_OBJ_TYPE_NONE;
|
||||
} else {
|
||||
if (depth >= 1 && depth <= 5)
|
||||
return HWLOC_OBJ_L1CACHE + depth-1;
|
||||
else
|
||||
return HWLOC_OBJ_TYPE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
#define HWLOC_BITMAP_EQUAL 0 /* Bitmaps are equal */
|
||||
#define HWLOC_BITMAP_INCLUDED 1 /* First bitmap included in second */
|
||||
#define HWLOC_BITMAP_CONTAINS 2 /* First bitmap contains second */
|
||||
#define HWLOC_BITMAP_INTERSECTS 3 /* Bitmaps intersect without any inclusion */
|
||||
#define HWLOC_BITMAP_DIFFERENT 4 /* Bitmaps do not intersect */
|
||||
|
||||
/* Compare bitmaps \p bitmap1 and \p bitmap2 from an inclusion point of view. */
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_compare_inclusion(hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) __hwloc_attribute_pure;
|
||||
|
||||
/* Return a stringified PCI class. */
|
||||
HWLOC_DECLSPEC extern const char * hwloc_pci_class_string(unsigned short class_id);
|
||||
|
||||
/* Parse a PCI link speed (GT/s) string from Linux sysfs */
|
||||
#ifdef HWLOC_LINUX_SYS
|
||||
#include <stdlib.h> /* for atof() */
|
||||
static __hwloc_inline float
|
||||
hwloc_linux_pci_link_speed_from_string(const char *string)
|
||||
{
|
||||
/* don't parse Gen1 with atof() since it expects a localized string
|
||||
* while the kernel sysfs files aren't.
|
||||
*/
|
||||
if (!strncmp(string, "2.5 ", 4))
|
||||
/* "2.5 GT/s" is Gen1 with 8/10 encoding */
|
||||
return 2.5 * .8;
|
||||
|
||||
/* also hardwire Gen2 since it also has a specific encoding */
|
||||
if (!strncmp(string, "5 ", 2))
|
||||
/* "5 GT/s" is Gen2 with 8/10 encoding */
|
||||
return 5 * .8;
|
||||
|
||||
/* handle Gen3+ in a generic way */
|
||||
return atof(string) * 128./130; /* Gen3+ encoding is 128/130 */
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Traverse children of a parent */
|
||||
#define for_each_child(child, parent) for(child = parent->first_child; child; child = child->next_sibling)
|
||||
#define for_each_memory_child(child, parent) for(child = parent->memory_first_child; child; child = child->next_sibling)
|
||||
#define for_each_io_child(child, parent) for(child = parent->io_first_child; child; child = child->next_sibling)
|
||||
#define for_each_misc_child(child, parent) for(child = parent->misc_first_child; child; child = child->next_sibling)
|
||||
|
||||
/* Any object attached to normal children */
|
||||
static __hwloc_inline int hwloc__obj_type_is_normal (hwloc_obj_type_t type)
|
||||
{
|
||||
/* type contiguity is asserted in topology_check() */
|
||||
return type <= HWLOC_OBJ_GROUP || type == HWLOC_OBJ_DIE;
|
||||
}
|
||||
|
||||
/* Any object attached to memory children, currently NUMA nodes or Memory-side caches */
|
||||
static __hwloc_inline int hwloc__obj_type_is_memory (hwloc_obj_type_t type)
|
||||
{
|
||||
/* type contiguity is asserted in topology_check() */
|
||||
return type == HWLOC_OBJ_NUMANODE || type == HWLOC_OBJ_MEMCACHE;
|
||||
}
|
||||
|
||||
/* I/O or Misc object, without cpusets or nodesets. */
|
||||
static __hwloc_inline int hwloc__obj_type_is_special (hwloc_obj_type_t type)
|
||||
{
|
||||
/* type contiguity is asserted in topology_check() */
|
||||
return type >= HWLOC_OBJ_BRIDGE && type <= HWLOC_OBJ_MISC;
|
||||
}
|
||||
|
||||
/* Any object attached to io children */
|
||||
static __hwloc_inline int hwloc__obj_type_is_io (hwloc_obj_type_t type)
|
||||
{
|
||||
/* type contiguity is asserted in topology_check() */
|
||||
return type >= HWLOC_OBJ_BRIDGE && type <= HWLOC_OBJ_OS_DEVICE;
|
||||
}
|
||||
|
||||
/* Any CPU caches (not Memory-side caches) */
|
||||
static __hwloc_inline int
|
||||
hwloc__obj_type_is_cache(hwloc_obj_type_t type)
|
||||
{
|
||||
/* type contiguity is asserted in topology_check() */
|
||||
return (type >= HWLOC_OBJ_L1CACHE && type <= HWLOC_OBJ_L3ICACHE);
|
||||
}
|
||||
|
||||
static __hwloc_inline int
|
||||
hwloc__obj_type_is_dcache(hwloc_obj_type_t type)
|
||||
{
|
||||
/* type contiguity is asserted in topology_check() */
|
||||
return (type >= HWLOC_OBJ_L1CACHE && type <= HWLOC_OBJ_L5CACHE);
|
||||
}
|
||||
|
||||
/** \brief Check whether an object is a Instruction Cache. */
|
||||
static __hwloc_inline int
|
||||
hwloc__obj_type_is_icache(hwloc_obj_type_t type)
|
||||
{
|
||||
/* type contiguity is asserted in topology_check() */
|
||||
return (type >= HWLOC_OBJ_L1ICACHE && type <= HWLOC_OBJ_L3ICACHE);
|
||||
}
|
||||
|
||||
#ifdef HAVE_USELOCALE
|
||||
#include "locale.h"
|
||||
#ifdef HAVE_XLOCALE_H
|
||||
#include "xlocale.h"
|
||||
#endif
|
||||
#define hwloc_localeswitch_declare locale_t __old_locale = (locale_t)0, __new_locale
|
||||
#define hwloc_localeswitch_init() do { \
|
||||
__new_locale = newlocale(LC_ALL_MASK, "C", (locale_t)0); \
|
||||
if (__new_locale != (locale_t)0) \
|
||||
__old_locale = uselocale(__new_locale); \
|
||||
} while (0)
|
||||
#define hwloc_localeswitch_fini() do { \
|
||||
if (__new_locale != (locale_t)0) { \
|
||||
uselocale(__old_locale); \
|
||||
freelocale(__new_locale); \
|
||||
} \
|
||||
} while(0)
|
||||
#else /* HAVE_USELOCALE */
|
||||
#if __HWLOC_HAVE_ATTRIBUTE_UNUSED
|
||||
#define hwloc_localeswitch_declare int __dummy_nolocale __hwloc_attribute_unused
|
||||
#define hwloc_localeswitch_init()
|
||||
#else
|
||||
#define hwloc_localeswitch_declare int __dummy_nolocale
|
||||
#define hwloc_localeswitch_init() (void)__dummy_nolocale
|
||||
#endif
|
||||
#define hwloc_localeswitch_fini()
|
||||
#endif /* HAVE_USELOCALE */
|
||||
|
||||
#if !HAVE_DECL_FABSF
|
||||
#define fabsf(f) fabs((double)(f))
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_MODFF
|
||||
#define modff(x,iptr) (float)modf((double)x,(double *)iptr)
|
||||
#endif
|
||||
|
||||
#if HAVE_DECL__SC_PAGE_SIZE
|
||||
#define hwloc_getpagesize() sysconf(_SC_PAGE_SIZE)
|
||||
#elif HAVE_DECL__SC_PAGESIZE
|
||||
#define hwloc_getpagesize() sysconf(_SC_PAGESIZE)
|
||||
#elif defined HAVE_GETPAGESIZE
|
||||
#define hwloc_getpagesize() getpagesize()
|
||||
#else
|
||||
#undef hwloc_getpagesize
|
||||
#endif
|
||||
|
||||
#if HWLOC_HAVE_ATTRIBUTE_FORMAT
|
||||
# define __hwloc_attribute_format(type, str, arg) __attribute__((__format__(type, str, arg)))
|
||||
#else
|
||||
# define __hwloc_attribute_format(type, str, arg)
|
||||
#endif
|
||||
|
||||
#define hwloc_memory_size_printf_value(_size, _verbose) \
|
||||
((_size) < (10ULL<<20) || (_verbose) ? (((_size)>>9)+1)>>1 : (_size) < (10ULL<<30) ? (((_size)>>19)+1)>>1 : (_size) < (10ULL<<40) ? (((_size)>>29)+1)>>1 : (((_size)>>39)+1)>>1)
|
||||
#define hwloc_memory_size_printf_unit(_size, _verbose) \
|
||||
((_size) < (10ULL<<20) || (_verbose) ? "KB" : (_size) < (10ULL<<30) ? "MB" : (_size) < (10ULL<<40) ? "GB" : "TB")
|
||||
|
||||
#ifdef HWLOC_WIN_SYS
|
||||
# ifndef HAVE_SSIZE_T
|
||||
typedef SSIZE_T ssize_t;
|
||||
# endif
|
||||
# if !HAVE_DECL_STRTOULL && !defined(HAVE_STRTOULL)
|
||||
# define strtoull _strtoui64
|
||||
# endif
|
||||
# ifndef S_ISREG
|
||||
# define S_ISREG(m) ((m) & S_IFREG)
|
||||
# endif
|
||||
# ifndef S_ISDIR
|
||||
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
# endif
|
||||
# ifndef S_IRWXU
|
||||
# define S_IRWXU 00700
|
||||
# endif
|
||||
# ifndef HWLOC_HAVE_DECL_STRCASECMP
|
||||
# define strcasecmp _stricmp
|
||||
# endif
|
||||
# if !HAVE_DECL_SNPRINTF
|
||||
# define snprintf _snprintf
|
||||
# endif
|
||||
# if HAVE_DECL__STRDUP
|
||||
# define strdup _strdup
|
||||
# endif
|
||||
# if HAVE_DECL__PUTENV
|
||||
# define putenv _putenv
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* HWLOC_PRIVATE_MISC_H */
|
||||
578
src/3rdparty/hwloc/include/private/netloc.h
vendored
578
src/3rdparty/hwloc/include/private/netloc.h
vendored
@@ -1,578 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2014 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright © 2013-2014 University of Wisconsin-La Crosse.
|
||||
* All rights reserved.
|
||||
* Copyright © 2015-2017 Inria. All rights reserved.
|
||||
*
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
* See COPYING in top-level directory.
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef _NETLOC_PRIVATE_H_
|
||||
#define _NETLOC_PRIVATE_H_
|
||||
|
||||
#include <hwloc.h>
|
||||
#include <netloc.h>
|
||||
#include <netloc/uthash.h>
|
||||
#include <netloc/utarray.h>
|
||||
#include <private/autogen/config.h>
|
||||
|
||||
#define NETLOCFILE_VERSION 1
|
||||
|
||||
#ifdef NETLOC_SCOTCH
|
||||
#include <stdint.h>
|
||||
#include <scotch.h>
|
||||
#define NETLOC_int SCOTCH_Num
|
||||
#else
|
||||
#define NETLOC_int int
|
||||
#endif
|
||||
|
||||
/*
|
||||
* "Import" a few things from hwloc
|
||||
*/
|
||||
#define __netloc_attribute_unused __hwloc_attribute_unused
|
||||
#define __netloc_attribute_malloc __hwloc_attribute_malloc
|
||||
#define __netloc_attribute_const __hwloc_attribute_const
|
||||
#define __netloc_attribute_pure __hwloc_attribute_pure
|
||||
#define __netloc_attribute_deprecated __hwloc_attribute_deprecated
|
||||
#define __netloc_attribute_may_alias __hwloc_attribute_may_alias
|
||||
#define NETLOC_DECLSPEC HWLOC_DECLSPEC
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Types
|
||||
**********************************************************************/
|
||||
|
||||
/**
|
||||
* Definitions for Comparators
|
||||
* \sa These are the return values from the following functions:
|
||||
* netloc_network_compare, netloc_dt_edge_t_compare, netloc_dt_node_t_compare
|
||||
*/
|
||||
typedef enum {
|
||||
NETLOC_CMP_SAME = 0, /**< Compared as the Same */
|
||||
NETLOC_CMP_SIMILAR = -1, /**< Compared as Similar, but not the Same */
|
||||
NETLOC_CMP_DIFF = -2 /**< Compared as Different */
|
||||
} netloc_compare_type_t;
|
||||
|
||||
/**
|
||||
* Enumerated type for the various types of supported networks
|
||||
*/
|
||||
typedef enum {
|
||||
NETLOC_NETWORK_TYPE_ETHERNET = 1, /**< Ethernet network */
|
||||
NETLOC_NETWORK_TYPE_INFINIBAND = 2, /**< InfiniBand network */
|
||||
NETLOC_NETWORK_TYPE_INVALID = 3 /**< Invalid network */
|
||||
} netloc_network_type_t;
|
||||
|
||||
/**
|
||||
* Enumerated type for the various types of supported topologies
|
||||
*/
|
||||
typedef enum {
|
||||
NETLOC_TOPOLOGY_TYPE_INVALID = -1, /**< Invalid */
|
||||
NETLOC_TOPOLOGY_TYPE_TREE = 1, /**< Tree */
|
||||
} netloc_topology_type_t;
|
||||
|
||||
/**
|
||||
* Enumerated type for the various types of nodes
|
||||
*/
|
||||
typedef enum {
|
||||
NETLOC_NODE_TYPE_HOST = 0, /**< Host (a.k.a., network addressable endpoint - e.g., MAC Address) node */
|
||||
NETLOC_NODE_TYPE_SWITCH = 1, /**< Switch node */
|
||||
NETLOC_NODE_TYPE_INVALID = 2 /**< Invalid node */
|
||||
} netloc_node_type_t;
|
||||
|
||||
typedef enum {
|
||||
NETLOC_ARCH_TREE = 0, /* Fat tree */
|
||||
} netloc_arch_type_t;
|
||||
|
||||
|
||||
/* Pre declarations to avoid inter dependency problems */
|
||||
/** \cond IGNORE */
|
||||
struct netloc_topology_t;
|
||||
typedef struct netloc_topology_t netloc_topology_t;
|
||||
struct netloc_node_t;
|
||||
typedef struct netloc_node_t netloc_node_t;
|
||||
struct netloc_edge_t;
|
||||
typedef struct netloc_edge_t netloc_edge_t;
|
||||
struct netloc_physical_link_t;
|
||||
typedef struct netloc_physical_link_t netloc_physical_link_t;
|
||||
struct netloc_path_t;
|
||||
typedef struct netloc_path_t netloc_path_t;
|
||||
|
||||
struct netloc_arch_tree_t;
|
||||
typedef struct netloc_arch_tree_t netloc_arch_tree_t;
|
||||
struct netloc_arch_node_t;
|
||||
typedef struct netloc_arch_node_t netloc_arch_node_t;
|
||||
struct netloc_arch_node_slot_t;
|
||||
typedef struct netloc_arch_node_slot_t netloc_arch_node_slot_t;
|
||||
struct netloc_arch_t;
|
||||
typedef struct netloc_arch_t netloc_arch_t;
|
||||
/** \endcond */
|
||||
|
||||
/**
|
||||
* \struct netloc_topology_t
|
||||
* \brief Netloc Topology Context
|
||||
*
|
||||
* An opaque data structure used to reference a network topology.
|
||||
*
|
||||
* \note Must be initialized with \ref netloc_topology_construct()
|
||||
*/
|
||||
struct netloc_topology_t {
|
||||
/** Topology path */
|
||||
char *topopath;
|
||||
/** Subnet ID */
|
||||
char *subnet_id;
|
||||
|
||||
/** Node List */
|
||||
netloc_node_t *nodes; /* Hash table of nodes by physical_id */
|
||||
netloc_node_t *nodesByHostname; /* Hash table of nodes by hostname */
|
||||
|
||||
netloc_physical_link_t *physical_links; /* Hash table with physcial links */
|
||||
|
||||
/** Partition List */
|
||||
UT_array *partitions;
|
||||
|
||||
/** Hwloc topology List */
|
||||
char *hwlocpath;
|
||||
UT_array *topos;
|
||||
hwloc_topology_t *hwloc_topos;
|
||||
|
||||
/** Type of the graph */
|
||||
netloc_topology_type_t type;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Netloc Node Type
|
||||
*
|
||||
* Represents the concept of a node (a.k.a., vertex, endpoint) within a network
|
||||
* graph. This could be a server or a network switch. The \ref node_type parameter
|
||||
* will distinguish the exact type of node this represents in the graph.
|
||||
*/
|
||||
struct netloc_node_t {
|
||||
UT_hash_handle hh; /* makes this structure hashable with physical_id */
|
||||
UT_hash_handle hh2; /* makes this structure hashable with hostname */
|
||||
|
||||
/** Physical ID of the node */
|
||||
char physical_id[20];
|
||||
|
||||
/** Logical ID of the node (if any) */
|
||||
int logical_id;
|
||||
|
||||
/** Type of the node */
|
||||
netloc_node_type_t type;
|
||||
|
||||
/* Pointer to physical_links */
|
||||
UT_array *physical_links;
|
||||
|
||||
/** Description information from discovery (if any) */
|
||||
char *description;
|
||||
|
||||
/**
|
||||
* Application-given private data pointer.
|
||||
* Initialized to NULL, and not used by the netloc library.
|
||||
*/
|
||||
void * userdata;
|
||||
|
||||
/** Outgoing edges from this node */
|
||||
netloc_edge_t *edges;
|
||||
|
||||
UT_array *subnodes; /* the group of nodes for the virtual nodes */
|
||||
|
||||
netloc_path_t *paths;
|
||||
|
||||
char *hostname;
|
||||
|
||||
UT_array *partitions; /* index in the list from the topology */
|
||||
|
||||
hwloc_topology_t hwlocTopo;
|
||||
int hwlocTopoIdx;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Netloc Edge Type
|
||||
*
|
||||
* Represents the concept of a directed edge within a network graph.
|
||||
*
|
||||
* \note We do not point to the netloc_node_t structure directly to
|
||||
* simplify the representation, and allow the information to more easily
|
||||
* be entered into the data store without circular references.
|
||||
* \todo JJH Is the note above still true?
|
||||
*/
|
||||
struct netloc_edge_t {
|
||||
UT_hash_handle hh; /* makes this structure hashable */
|
||||
|
||||
netloc_node_t *dest;
|
||||
|
||||
int id;
|
||||
|
||||
/** Pointers to the parent node */
|
||||
netloc_node_t *node;
|
||||
|
||||
/* Pointer to physical_links */
|
||||
UT_array *physical_links;
|
||||
|
||||
/** total gbits of the links */
|
||||
float total_gbits;
|
||||
|
||||
UT_array *partitions; /* index in the list from the topology */
|
||||
|
||||
UT_array *subnode_edges; /* for edges going to virtual nodes */
|
||||
|
||||
struct netloc_edge_t *other_way;
|
||||
|
||||
/**
|
||||
* Application-given private data pointer.
|
||||
* Initialized to NULL, and not used by the netloc library.
|
||||
*/
|
||||
void * userdata;
|
||||
};
|
||||
|
||||
|
||||
struct netloc_physical_link_t {
|
||||
UT_hash_handle hh; /* makes this structure hashable */
|
||||
|
||||
int id; // TODO long long
|
||||
netloc_node_t *src;
|
||||
netloc_node_t *dest;
|
||||
int ports[2];
|
||||
char *width;
|
||||
char *speed;
|
||||
|
||||
netloc_edge_t *edge;
|
||||
|
||||
int other_way_id;
|
||||
struct netloc_physical_link_t *other_way;
|
||||
|
||||
UT_array *partitions; /* index in the list from the topology */
|
||||
|
||||
/** gbits of the link from speed and width */
|
||||
float gbits;
|
||||
|
||||
/** Description information from discovery (if any) */
|
||||
char *description;
|
||||
};
|
||||
|
||||
struct netloc_path_t {
|
||||
UT_hash_handle hh; /* makes this structure hashable */
|
||||
char dest_id[20];
|
||||
UT_array *links;
|
||||
};
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Architecture structures
|
||||
**********************************************************************/
|
||||
struct netloc_arch_tree_t {
|
||||
NETLOC_int num_levels;
|
||||
NETLOC_int *degrees;
|
||||
NETLOC_int *cost;
|
||||
};
|
||||
|
||||
struct netloc_arch_node_t {
|
||||
UT_hash_handle hh; /* makes this structure hashable */
|
||||
char *name; /* Hash key */
|
||||
netloc_node_t *node; /* Corresponding node */
|
||||
int idx_in_topo; /* idx with ghost hosts to have complete topo */
|
||||
int num_slots; /* it is not the real number of slots but the maximum slot idx */
|
||||
int *slot_idx; /* corresponding idx in slot_tree */
|
||||
int *slot_os_idx; /* corresponding os index for each leaf in tree */
|
||||
netloc_arch_tree_t *slot_tree; /* Tree built from hwloc */
|
||||
int num_current_slots; /* Number of PUs */
|
||||
NETLOC_int *current_slots; /* indices in the complete tree */
|
||||
int *slot_ranks; /* corresponding MPI rank for each leaf in tree */
|
||||
};
|
||||
|
||||
struct netloc_arch_node_slot_t {
|
||||
netloc_arch_node_t *node;
|
||||
int slot;
|
||||
};
|
||||
|
||||
struct netloc_arch_t {
|
||||
netloc_topology_t *topology;
|
||||
int has_slots; /* if slots are included in the architecture */
|
||||
netloc_arch_type_t type;
|
||||
union {
|
||||
netloc_arch_tree_t *node_tree;
|
||||
netloc_arch_tree_t *global_tree;
|
||||
} arch;
|
||||
netloc_arch_node_t *nodes_by_name;
|
||||
netloc_arch_node_slot_t *node_slot_by_idx; /* node_slot by index in complete topo */
|
||||
NETLOC_int num_current_hosts; /* if has_slots, host is a slot, else host is a node */
|
||||
NETLOC_int *current_hosts; /* indices in the complete topology */
|
||||
};
|
||||
|
||||
/**********************************************************************
|
||||
* Topology Functions
|
||||
**********************************************************************/
|
||||
/**
|
||||
* Allocate a topology handle.
|
||||
*
|
||||
* User is responsible for calling \ref netloc_detach on the topology handle.
|
||||
* The network parameter information is deep copied into the topology handle, so the
|
||||
* user may destruct the network handle after calling this function and/or reuse
|
||||
* the network handle.
|
||||
*
|
||||
* \returns NETLOC_SUCCESS on success
|
||||
* \returns NETLOC_ERROR upon an error.
|
||||
*/
|
||||
netloc_topology_t *netloc_topology_construct(char *path);
|
||||
|
||||
/**
|
||||
* Destruct a topology handle
|
||||
*
|
||||
* \param topology A valid pointer to a \ref netloc_topology_t handle created
|
||||
* from a prior call to \ref netloc_topology_construct.
|
||||
*
|
||||
* \returns NETLOC_SUCCESS on success
|
||||
* \returns NETLOC_ERROR upon an error.
|
||||
*/
|
||||
int netloc_topology_destruct(netloc_topology_t *topology);
|
||||
|
||||
int netloc_topology_find_partition_idx(netloc_topology_t *topology, char *partition_name);
|
||||
|
||||
int netloc_topology_read_hwloc(netloc_topology_t *topology, int num_nodes,
|
||||
netloc_node_t **node_list);
|
||||
|
||||
#define netloc_topology_iter_partitions(topology,partition) \
|
||||
for ((partition) = (char **)utarray_front(topology->partitions); \
|
||||
(partition) != NULL; \
|
||||
(partition) = (char **)utarray_next(topology->partitions, partition))
|
||||
|
||||
#define netloc_topology_iter_hwloctopos(topology,hwloctopo) \
|
||||
for ((hwloctopo) = (char **)utarray_front(topology->topos); \
|
||||
(hwloctopo) != NULL; \
|
||||
(hwloctopo) = (char **)utarray_next(topology->topos, hwloctopo))
|
||||
|
||||
#define netloc_topology_find_node(topology,node_id,node) \
|
||||
HASH_FIND_STR(topology->nodes, node_id, node)
|
||||
|
||||
#define netloc_topology_iter_nodes(topology,node,_tmp) \
|
||||
HASH_ITER(hh, topology->nodes, node, _tmp)
|
||||
|
||||
#define netloc_topology_num_nodes(topology) \
|
||||
HASH_COUNT(topology->nodes)
|
||||
|
||||
/*************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* Constructor for netloc_node_t
|
||||
*
|
||||
* User is responsible for calling the destructor on the handle.
|
||||
*
|
||||
* Returns
|
||||
* A newly allocated pointer to the network information.
|
||||
*/
|
||||
netloc_node_t *netloc_node_construct(void);
|
||||
|
||||
/**
|
||||
* Destructor for netloc_node_t
|
||||
*
|
||||
* \param node A valid node handle
|
||||
*
|
||||
* Returns
|
||||
* NETLOC_SUCCESS on success
|
||||
* NETLOC_ERROR on error
|
||||
*/
|
||||
int netloc_node_destruct(netloc_node_t *node);
|
||||
|
||||
char *netloc_node_pretty_print(netloc_node_t* node);
|
||||
|
||||
#define netloc_node_get_num_subnodes(node) \
|
||||
utarray_len((node)->subnodes)
|
||||
|
||||
#define netloc_node_get_subnode(node,i) \
|
||||
(*(netloc_node_t **)utarray_eltptr((node)->subnodes, (i)))
|
||||
|
||||
#define netloc_node_get_num_edges(node) \
|
||||
utarray_len((node)->edges)
|
||||
|
||||
#define netloc_node_get_edge(node,i) \
|
||||
(*(netloc_edge_t **)utarray_eltptr((node)->edges, (i)))
|
||||
|
||||
#define netloc_node_iter_edges(node,edge,_tmp) \
|
||||
HASH_ITER(hh, node->edges, edge, _tmp)
|
||||
|
||||
#define netloc_node_iter_paths(node,path,_tmp) \
|
||||
HASH_ITER(hh, node->paths, path, _tmp)
|
||||
|
||||
#define netloc_node_is_host(node) \
|
||||
(node->type == NETLOC_NODE_TYPE_HOST)
|
||||
|
||||
#define netloc_node_is_switch(node) \
|
||||
(node->type == NETLOC_NODE_TYPE_SWITCH)
|
||||
|
||||
#define netloc_node_iter_paths(node, path,_tmp) \
|
||||
HASH_ITER(hh, node->paths, path, _tmp)
|
||||
|
||||
int netloc_node_is_in_partition(netloc_node_t *node, int partition);
|
||||
|
||||
/*************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* Constructor for netloc_edge_t
|
||||
*
|
||||
* User is responsible for calling the destructor on the handle.
|
||||
*
|
||||
* Returns
|
||||
* A newly allocated pointer to the edge information.
|
||||
*/
|
||||
netloc_edge_t *netloc_edge_construct(void);
|
||||
|
||||
/**
|
||||
* Destructor for netloc_edge_t
|
||||
*
|
||||
* \param edge A valid edge handle
|
||||
*
|
||||
* Returns
|
||||
* NETLOC_SUCCESS on success
|
||||
* NETLOC_ERROR on error
|
||||
*/
|
||||
int netloc_edge_destruct(netloc_edge_t *edge);
|
||||
|
||||
char * netloc_edge_pretty_print(netloc_edge_t* edge);
|
||||
|
||||
void netloc_edge_reset_uid(void);
|
||||
|
||||
int netloc_edge_is_in_partition(netloc_edge_t *edge, int partition);
|
||||
|
||||
#define netloc_edge_get_num_links(edge) \
|
||||
utarray_len((edge)->physical_links)
|
||||
|
||||
#define netloc_edge_get_link(edge,i) \
|
||||
(*(netloc_physical_link_t **)utarray_eltptr((edge)->physical_links, (i)))
|
||||
|
||||
#define netloc_edge_get_num_subedges(edge) \
|
||||
utarray_len((edge)->subnode_edges)
|
||||
|
||||
#define netloc_edge_get_subedge(edge,i) \
|
||||
(*(netloc_edge_t **)utarray_eltptr((edge)->subnode_edges, (i)))
|
||||
|
||||
/*************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* Constructor for netloc_physical_link_t
|
||||
*
|
||||
* User is responsible for calling the destructor on the handle.
|
||||
*
|
||||
* Returns
|
||||
* A newly allocated pointer to the physical link information.
|
||||
*/
|
||||
netloc_physical_link_t * netloc_physical_link_construct(void);
|
||||
|
||||
/**
|
||||
* Destructor for netloc_physical_link_t
|
||||
*
|
||||
* Returns
|
||||
* NETLOC_SUCCESS on success
|
||||
* NETLOC_ERROR on error
|
||||
*/
|
||||
int netloc_physical_link_destruct(netloc_physical_link_t *link);
|
||||
|
||||
char * netloc_link_pretty_print(netloc_physical_link_t* link);
|
||||
|
||||
/*************************************************/
|
||||
|
||||
|
||||
netloc_path_t *netloc_path_construct(void);
|
||||
int netloc_path_destruct(netloc_path_t *path);
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Architecture functions
|
||||
**********************************************************************/
|
||||
|
||||
netloc_arch_t * netloc_arch_construct(void);
|
||||
|
||||
int netloc_arch_destruct(netloc_arch_t *arch);
|
||||
|
||||
int netloc_arch_build(netloc_arch_t *arch, int add_slots);
|
||||
|
||||
int netloc_arch_set_current_resources(netloc_arch_t *arch);
|
||||
|
||||
int netloc_arch_set_global_resources(netloc_arch_t *arch);
|
||||
|
||||
int netloc_arch_node_get_hwloc_info(netloc_arch_node_t *arch);
|
||||
|
||||
void netloc_arch_tree_complete(netloc_arch_tree_t *tree, UT_array **down_degrees_by_level,
|
||||
int num_hosts, int **parch_idx);
|
||||
|
||||
NETLOC_int netloc_arch_tree_num_leaves(netloc_arch_tree_t *tree);
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Access functions of various elements of the topology
|
||||
**********************************************************************/
|
||||
|
||||
#define netloc_get_num_partitions(object) \
|
||||
utarray_len((object)->partitions)
|
||||
|
||||
#define netloc_get_partition(object,i) \
|
||||
(*(int *)utarray_eltptr((object)->partitions, (i)))
|
||||
|
||||
|
||||
#define netloc_path_iter_links(path,link) \
|
||||
for ((link) = (netloc_physical_link_t **)utarray_front(path->links); \
|
||||
(link) != NULL; \
|
||||
(link) = (netloc_physical_link_t **)utarray_next(path->links, link))
|
||||
|
||||
/**********************************************************************
|
||||
* Misc functions
|
||||
**********************************************************************/
|
||||
|
||||
/**
|
||||
* Decode the network type
|
||||
*
|
||||
* \param net_type A valid member of the \ref netloc_network_type_t type
|
||||
*
|
||||
* \returns NULL if the type is invalid
|
||||
* \returns A string for that \ref netloc_network_type_t type
|
||||
*/
|
||||
static inline const char * netloc_network_type_decode(netloc_network_type_t net_type) {
|
||||
if( NETLOC_NETWORK_TYPE_ETHERNET == net_type ) {
|
||||
return "ETH";
|
||||
}
|
||||
else if( NETLOC_NETWORK_TYPE_INFINIBAND == net_type ) {
|
||||
return "IB";
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode the node type
|
||||
*
|
||||
* \param node_type A valid member of the \ref netloc_node_type_t type
|
||||
*
|
||||
* \returns NULL if the type is invalid
|
||||
* \returns A string for that \ref netloc_node_type_t type
|
||||
*/
|
||||
static inline const char * netloc_node_type_decode(netloc_node_type_t node_type) {
|
||||
if( NETLOC_NODE_TYPE_SWITCH == node_type ) {
|
||||
return "SW";
|
||||
}
|
||||
else if( NETLOC_NODE_TYPE_HOST == node_type ) {
|
||||
return "CA";
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
ssize_t netloc_line_get(char **lineptr, size_t *n, FILE *stream);
|
||||
|
||||
char *netloc_line_get_next_token(char **string, char c);
|
||||
|
||||
int netloc_build_comm_mat(char *filename, int *pn, double ***pmat);
|
||||
|
||||
#define STRDUP_IF_NOT_NULL(str) (NULL == str ? NULL : strdup(str))
|
||||
#define STR_EMPTY_IF_NULL(str) (NULL == str ? "" : str)
|
||||
|
||||
|
||||
#endif // _NETLOC_PRIVATE_H_
|
||||
460
src/3rdparty/hwloc/include/private/private.h
vendored
460
src/3rdparty/hwloc/include/private/private.h
vendored
@@ -1,460 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2019 Inria. All rights reserved.
|
||||
* Copyright © 2009-2012, 2020 Université Bordeaux
|
||||
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
|
||||
*
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
/* Internal types and helpers. */
|
||||
|
||||
|
||||
#ifdef HWLOC_INSIDE_PLUGIN
|
||||
/*
|
||||
* these declarations are internal only, they are not available to plugins
|
||||
* (many functions below are internal static symbols).
|
||||
*/
|
||||
#error This file should not be used in plugins
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HWLOC_PRIVATE_H
|
||||
#define HWLOC_PRIVATE_H
|
||||
|
||||
#include "private/autogen/config.h"
|
||||
#include "hwloc.h"
|
||||
#include "hwloc/bitmap.h"
|
||||
#include "private/components.h"
|
||||
#include "private/misc.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_UTSNAME_H
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
#define HWLOC_TOPOLOGY_ABI 0x20100 /* version of the layout of struct topology */
|
||||
|
||||
/*****************************************************
|
||||
* WARNING:
|
||||
* changes below in this structure (and its children)
|
||||
* should cause a bump of HWLOC_TOPOLOGY_ABI.
|
||||
*****************************************************/
|
||||
|
||||
struct hwloc_topology {
|
||||
unsigned topology_abi;
|
||||
|
||||
unsigned nb_levels; /* Number of horizontal levels */
|
||||
unsigned nb_levels_allocated; /* Number of levels allocated and zeroed in level_nbobjects and levels below */
|
||||
unsigned *level_nbobjects; /* Number of objects on each horizontal level */
|
||||
struct hwloc_obj ***levels; /* Direct access to levels, levels[l = 0 .. nblevels-1][0..level_nbobjects[l]] */
|
||||
unsigned long flags;
|
||||
int type_depth[HWLOC_OBJ_TYPE_MAX];
|
||||
enum hwloc_type_filter_e type_filter[HWLOC_OBJ_TYPE_MAX];
|
||||
int is_thissystem;
|
||||
int is_loaded;
|
||||
int modified; /* >0 if objects were added/removed recently, which means a reconnect is needed */
|
||||
hwloc_pid_t pid; /* Process ID the topology is view from, 0 for self */
|
||||
void *userdata;
|
||||
uint64_t next_gp_index;
|
||||
|
||||
void *adopted_shmem_addr;
|
||||
size_t adopted_shmem_length;
|
||||
|
||||
#define HWLOC_NR_SLEVELS 6
|
||||
#define HWLOC_SLEVEL_NUMANODE 0
|
||||
#define HWLOC_SLEVEL_BRIDGE 1
|
||||
#define HWLOC_SLEVEL_PCIDEV 2
|
||||
#define HWLOC_SLEVEL_OSDEV 3
|
||||
#define HWLOC_SLEVEL_MISC 4
|
||||
#define HWLOC_SLEVEL_MEMCACHE 5
|
||||
/* order must match negative depth, it's asserted in setup_defaults() */
|
||||
#define HWLOC_SLEVEL_FROM_DEPTH(x) (HWLOC_TYPE_DEPTH_NUMANODE-(x))
|
||||
#define HWLOC_SLEVEL_TO_DEPTH(x) (HWLOC_TYPE_DEPTH_NUMANODE-(x))
|
||||
struct hwloc_special_level_s {
|
||||
unsigned nbobjs;
|
||||
struct hwloc_obj **objs;
|
||||
struct hwloc_obj *first, *last; /* Temporarily used while listing object before building the objs array */
|
||||
} slevels[HWLOC_NR_SLEVELS];
|
||||
|
||||
hwloc_bitmap_t allowed_cpuset;
|
||||
hwloc_bitmap_t allowed_nodeset;
|
||||
|
||||
struct hwloc_binding_hooks {
|
||||
/* These are actually rather OS hooks since some of them are not about binding */
|
||||
int (*set_thisproc_cpubind)(hwloc_topology_t topology, hwloc_const_cpuset_t set, int flags);
|
||||
int (*get_thisproc_cpubind)(hwloc_topology_t topology, hwloc_cpuset_t set, int flags);
|
||||
int (*set_thisthread_cpubind)(hwloc_topology_t topology, hwloc_const_cpuset_t set, int flags);
|
||||
int (*get_thisthread_cpubind)(hwloc_topology_t topology, hwloc_cpuset_t set, int flags);
|
||||
int (*set_proc_cpubind)(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_const_cpuset_t set, int flags);
|
||||
int (*get_proc_cpubind)(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_cpuset_t set, int flags);
|
||||
#ifdef hwloc_thread_t
|
||||
int (*set_thread_cpubind)(hwloc_topology_t topology, hwloc_thread_t tid, hwloc_const_cpuset_t set, int flags);
|
||||
int (*get_thread_cpubind)(hwloc_topology_t topology, hwloc_thread_t tid, hwloc_cpuset_t set, int flags);
|
||||
#endif
|
||||
|
||||
int (*get_thisproc_last_cpu_location)(hwloc_topology_t topology, hwloc_cpuset_t set, int flags);
|
||||
int (*get_thisthread_last_cpu_location)(hwloc_topology_t topology, hwloc_cpuset_t set, int flags);
|
||||
int (*get_proc_last_cpu_location)(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_cpuset_t set, int flags);
|
||||
|
||||
int (*set_thisproc_membind)(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags);
|
||||
int (*get_thisproc_membind)(hwloc_topology_t topology, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags);
|
||||
int (*set_thisthread_membind)(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags);
|
||||
int (*get_thisthread_membind)(hwloc_topology_t topology, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags);
|
||||
int (*set_proc_membind)(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags);
|
||||
int (*get_proc_membind)(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags);
|
||||
int (*set_area_membind)(hwloc_topology_t topology, const void *addr, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags);
|
||||
int (*get_area_membind)(hwloc_topology_t topology, const void *addr, size_t len, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags);
|
||||
int (*get_area_memlocation)(hwloc_topology_t topology, const void *addr, size_t len, hwloc_nodeset_t nodeset, int flags);
|
||||
/* This has to return the same kind of pointer as alloc_membind, so that free_membind can be used on it */
|
||||
void *(*alloc)(hwloc_topology_t topology, size_t len);
|
||||
/* alloc_membind has to always succeed if !(flags & HWLOC_MEMBIND_STRICT).
|
||||
* see hwloc_alloc_or_fail which is convenient for that. */
|
||||
void *(*alloc_membind)(hwloc_topology_t topology, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags);
|
||||
int (*free_membind)(hwloc_topology_t topology, void *addr, size_t len);
|
||||
|
||||
int (*get_allowed_resources)(hwloc_topology_t topology);
|
||||
} binding_hooks;
|
||||
|
||||
struct hwloc_topology_support support;
|
||||
|
||||
void (*userdata_export_cb)(void *reserved, struct hwloc_topology *topology, struct hwloc_obj *obj);
|
||||
void (*userdata_import_cb)(struct hwloc_topology *topology, struct hwloc_obj *obj, const char *name, const void *buffer, size_t length);
|
||||
int userdata_not_decoded;
|
||||
|
||||
struct hwloc_internal_distances_s {
|
||||
char *name; /* FIXME: needs an API to set it from user */
|
||||
|
||||
unsigned id; /* to match the container id field of public distances structure
|
||||
* not exported to XML, regenerated during _add()
|
||||
*/
|
||||
|
||||
/* if all objects have the same type, different_types is NULL and unique_type is valid.
|
||||
* otherwise unique_type is HWLOC_OBJ_TYPE_NONE and different_types contains individual objects types.
|
||||
*/
|
||||
hwloc_obj_type_t unique_type;
|
||||
hwloc_obj_type_t *different_types;
|
||||
|
||||
/* add union hwloc_obj_attr_u if we ever support groups */
|
||||
unsigned nbobjs;
|
||||
uint64_t *indexes; /* array of OS or GP indexes before we can convert them into objs.
|
||||
* OS indexes for distances covering only PUs or only NUMAnodes.
|
||||
*/
|
||||
#define HWLOC_DIST_TYPE_USE_OS_INDEX(_type) ((_type) == HWLOC_OBJ_PU || (_type == HWLOC_OBJ_NUMANODE))
|
||||
uint64_t *values; /* distance matrices, ordered according to the above indexes/objs array.
|
||||
* distance from i to j is stored in slot i*nbnodes+j.
|
||||
*/
|
||||
unsigned long kind;
|
||||
|
||||
#define HWLOC_INTERNAL_DIST_FLAG_OBJS_VALID (1U<<0) /* if the objs array is valid below */
|
||||
unsigned iflags;
|
||||
|
||||
/* objects are currently stored in physical_index order */
|
||||
hwloc_obj_t *objs; /* array of objects */
|
||||
|
||||
struct hwloc_internal_distances_s *prev, *next;
|
||||
} *first_dist, *last_dist;
|
||||
unsigned next_dist_id;
|
||||
|
||||
int grouping;
|
||||
int grouping_verbose;
|
||||
unsigned grouping_nbaccuracies;
|
||||
float grouping_accuracies[5];
|
||||
unsigned grouping_next_subkind;
|
||||
|
||||
/* list of enabled backends. */
|
||||
struct hwloc_backend * backends;
|
||||
struct hwloc_backend * get_pci_busid_cpuset_backend; /* first backend that provides get_pci_busid_cpuset() callback */
|
||||
unsigned backend_phases;
|
||||
unsigned backend_excluded_phases;
|
||||
|
||||
/* memory allocator for topology objects */
|
||||
struct hwloc_tma * tma;
|
||||
|
||||
/*****************************************************
|
||||
* WARNING:
|
||||
* changes above in this structure (and its children)
|
||||
* should cause a bump of HWLOC_TOPOLOGY_ABI.
|
||||
*****************************************************/
|
||||
|
||||
/*
|
||||
* temporary variables during discovery
|
||||
*/
|
||||
|
||||
/* machine-wide memory.
|
||||
* temporarily stored there by OSes that only provide this without NUMA information,
|
||||
* and actually used later by the core.
|
||||
*/
|
||||
struct hwloc_numanode_attr_s machine_memory;
|
||||
|
||||
/* pci stuff */
|
||||
int pci_has_forced_locality;
|
||||
unsigned pci_forced_locality_nr;
|
||||
struct hwloc_pci_forced_locality_s {
|
||||
unsigned domain;
|
||||
unsigned bus_first, bus_last;
|
||||
hwloc_bitmap_t cpuset;
|
||||
} * pci_forced_locality;
|
||||
|
||||
/* component blacklisting */
|
||||
unsigned nr_blacklisted_components;
|
||||
struct hwloc_topology_forced_component_s {
|
||||
struct hwloc_disc_component *component;
|
||||
unsigned phases;
|
||||
} *blacklisted_components;
|
||||
|
||||
/* FIXME: keep until topo destroy and reuse for finding specific buses */
|
||||
struct hwloc_pci_locality_s {
|
||||
unsigned domain;
|
||||
unsigned bus_min;
|
||||
unsigned bus_max;
|
||||
hwloc_bitmap_t cpuset;
|
||||
hwloc_obj_t parent;
|
||||
struct hwloc_pci_locality_s *prev, *next;
|
||||
} *first_pci_locality, *last_pci_locality;
|
||||
};
|
||||
|
||||
extern void hwloc_alloc_root_sets(hwloc_obj_t root);
|
||||
extern void hwloc_setup_pu_level(struct hwloc_topology *topology, unsigned nb_pus);
|
||||
extern int hwloc_get_sysctlbyname(const char *name, int64_t *n);
|
||||
extern int hwloc_get_sysctl(int name[], unsigned namelen, int64_t *n);
|
||||
|
||||
/* returns the number of CPU from the OS (only valid if thissystem) */
|
||||
#define HWLOC_FALLBACK_NBPROCESSORS_INCLUDE_OFFLINE 1 /* by default we try to get only the online CPUs */
|
||||
extern int hwloc_fallback_nbprocessors(unsigned flags);
|
||||
/* returns the memory size from the OS (only valid if thissystem) */
|
||||
extern int64_t hwloc_fallback_memsize(void);
|
||||
|
||||
extern int hwloc__object_cpusets_compare_first(hwloc_obj_t obj1, hwloc_obj_t obj2);
|
||||
extern void hwloc__reorder_children(hwloc_obj_t parent);
|
||||
|
||||
extern void hwloc_topology_setup_defaults(struct hwloc_topology *topology);
|
||||
extern void hwloc_topology_clear(struct hwloc_topology *topology);
|
||||
|
||||
/* insert memory object as memory child of normal parent */
|
||||
extern struct hwloc_obj * hwloc__attach_memory_object(struct hwloc_topology *topology, hwloc_obj_t parent,
|
||||
hwloc_obj_t obj,
|
||||
hwloc_report_error_t report_error);
|
||||
|
||||
extern void hwloc_pci_discovery_init(struct hwloc_topology *topology);
|
||||
extern void hwloc_pci_discovery_prepare(struct hwloc_topology *topology);
|
||||
extern void hwloc_pci_discovery_exit(struct hwloc_topology *topology);
|
||||
|
||||
/* Look for an object matching the given domain/bus/func,
|
||||
* either exactly or return the smallest container bridge
|
||||
*/
|
||||
extern struct hwloc_obj * hwloc_pci_find_by_busid(struct hwloc_topology *topology, unsigned domain, unsigned bus, unsigned dev, unsigned func);
|
||||
|
||||
/* Look for an object matching complete cpuset exactly, or insert one.
|
||||
* Return NULL on failure.
|
||||
* Return a good fallback (object above) on failure to insert.
|
||||
*/
|
||||
extern hwloc_obj_t hwloc_find_insert_io_parent_by_complete_cpuset(struct hwloc_topology *topology, hwloc_cpuset_t cpuset);
|
||||
|
||||
extern int hwloc__add_info(struct hwloc_info_s **infosp, unsigned *countp, const char *name, const char *value);
|
||||
extern int hwloc__add_info_nodup(struct hwloc_info_s **infosp, unsigned *countp, const char *name, const char *value, int replace);
|
||||
extern int hwloc__move_infos(struct hwloc_info_s **dst_infosp, unsigned *dst_countp, struct hwloc_info_s **src_infosp, unsigned *src_countp);
|
||||
extern void hwloc__free_infos(struct hwloc_info_s *infos, unsigned count);
|
||||
|
||||
/* set native OS binding hooks */
|
||||
extern void hwloc_set_native_binding_hooks(struct hwloc_binding_hooks *hooks, struct hwloc_topology_support *support);
|
||||
/* set either native OS binding hooks (if thissystem), or dummy ones */
|
||||
extern void hwloc_set_binding_hooks(struct hwloc_topology *topology);
|
||||
|
||||
#if defined(HWLOC_LINUX_SYS)
|
||||
extern void hwloc_set_linuxfs_hooks(struct hwloc_binding_hooks *binding_hooks, struct hwloc_topology_support *support);
|
||||
#endif /* HWLOC_LINUX_SYS */
|
||||
|
||||
#if defined(HWLOC_BGQ_SYS)
|
||||
extern void hwloc_set_bgq_hooks(struct hwloc_binding_hooks *binding_hooks, struct hwloc_topology_support *support);
|
||||
#endif /* HWLOC_BGQ_SYS */
|
||||
|
||||
#ifdef HWLOC_SOLARIS_SYS
|
||||
extern void hwloc_set_solaris_hooks(struct hwloc_binding_hooks *binding_hooks, struct hwloc_topology_support *support);
|
||||
#endif /* HWLOC_SOLARIS_SYS */
|
||||
|
||||
#ifdef HWLOC_AIX_SYS
|
||||
extern void hwloc_set_aix_hooks(struct hwloc_binding_hooks *binding_hooks, struct hwloc_topology_support *support);
|
||||
#endif /* HWLOC_AIX_SYS */
|
||||
|
||||
#ifdef HWLOC_WIN_SYS
|
||||
extern void hwloc_set_windows_hooks(struct hwloc_binding_hooks *binding_hooks, struct hwloc_topology_support *support);
|
||||
#endif /* HWLOC_WIN_SYS */
|
||||
|
||||
#ifdef HWLOC_DARWIN_SYS
|
||||
extern void hwloc_set_darwin_hooks(struct hwloc_binding_hooks *binding_hooks, struct hwloc_topology_support *support);
|
||||
#endif /* HWLOC_DARWIN_SYS */
|
||||
|
||||
#ifdef HWLOC_FREEBSD_SYS
|
||||
extern void hwloc_set_freebsd_hooks(struct hwloc_binding_hooks *binding_hooks, struct hwloc_topology_support *support);
|
||||
#endif /* HWLOC_FREEBSD_SYS */
|
||||
|
||||
#ifdef HWLOC_NETBSD_SYS
|
||||
extern void hwloc_set_netbsd_hooks(struct hwloc_binding_hooks *binding_hooks, struct hwloc_topology_support *support);
|
||||
#endif /* HWLOC_NETBSD_SYS */
|
||||
|
||||
#ifdef HWLOC_HPUX_SYS
|
||||
extern void hwloc_set_hpux_hooks(struct hwloc_binding_hooks *binding_hooks, struct hwloc_topology_support *support);
|
||||
#endif /* HWLOC_HPUX_SYS */
|
||||
|
||||
extern int hwloc_look_hardwired_fujitsu_k(struct hwloc_topology *topology);
|
||||
extern int hwloc_look_hardwired_fujitsu_fx10(struct hwloc_topology *topology);
|
||||
extern int hwloc_look_hardwired_fujitsu_fx100(struct hwloc_topology *topology);
|
||||
|
||||
/* Insert uname-specific names/values in the object infos array.
|
||||
* If cached_uname isn't NULL, it is used as a struct utsname instead of recalling uname.
|
||||
* Any field that starts with \0 is ignored.
|
||||
*/
|
||||
extern void hwloc_add_uname_info(struct hwloc_topology *topology, void *cached_uname);
|
||||
|
||||
/* Free obj and its attributes assuming it's not linked to a parent and doesn't have any child */
|
||||
extern void hwloc_free_unlinked_object(hwloc_obj_t obj);
|
||||
|
||||
/* Free obj and its children, assuming it's not linked to a parent */
|
||||
extern void hwloc_free_object_and_children(hwloc_obj_t obj);
|
||||
|
||||
/* Free obj, its next siblings, and their children, assuming they're not linked to a parent */
|
||||
extern void hwloc_free_object_siblings_and_children(hwloc_obj_t obj);
|
||||
|
||||
/* This can be used for the alloc field to get allocated data that can be freed by free() */
|
||||
void *hwloc_alloc_heap(hwloc_topology_t topology, size_t len);
|
||||
|
||||
/* This can be used for the alloc field to get allocated data that can be freed by munmap() */
|
||||
void *hwloc_alloc_mmap(hwloc_topology_t topology, size_t len);
|
||||
|
||||
/* This can be used for the free_membind field to free data using free() */
|
||||
int hwloc_free_heap(hwloc_topology_t topology, void *addr, size_t len);
|
||||
|
||||
/* This can be used for the free_membind field to free data using munmap() */
|
||||
int hwloc_free_mmap(hwloc_topology_t topology, void *addr, size_t len);
|
||||
|
||||
/* Allocates unbound memory or fail, depending on whether STRICT is requested
|
||||
* or not */
|
||||
static __hwloc_inline void *
|
||||
hwloc_alloc_or_fail(hwloc_topology_t topology, size_t len, int flags)
|
||||
{
|
||||
if (flags & HWLOC_MEMBIND_STRICT)
|
||||
return NULL;
|
||||
return hwloc_alloc(topology, len);
|
||||
}
|
||||
|
||||
extern void hwloc_internal_distances_init(hwloc_topology_t topology);
|
||||
extern void hwloc_internal_distances_prepare(hwloc_topology_t topology);
|
||||
extern void hwloc_internal_distances_destroy(hwloc_topology_t topology);
|
||||
extern int hwloc_internal_distances_dup(hwloc_topology_t new, hwloc_topology_t old);
|
||||
extern void hwloc_internal_distances_refresh(hwloc_topology_t topology);
|
||||
extern int hwloc_internal_distances_add(hwloc_topology_t topology, const char *name, unsigned nbobjs, hwloc_obj_t *objs, uint64_t *values, unsigned long kind, unsigned long flags);
|
||||
extern int hwloc_internal_distances_add_by_index(hwloc_topology_t topology, const char *name, hwloc_obj_type_t unique_type, hwloc_obj_type_t *different_types, unsigned nbobjs, uint64_t *indexes, uint64_t *values, unsigned long kind, unsigned long flags);
|
||||
extern void hwloc_internal_distances_invalidate_cached_objs(hwloc_topology_t topology);
|
||||
|
||||
/* encode src buffer into target buffer.
|
||||
* targsize must be at least 4*((srclength+2)/3)+1.
|
||||
* target will be 0-terminated.
|
||||
*/
|
||||
extern int hwloc_encode_to_base64(const char *src, size_t srclength, char *target, size_t targsize);
|
||||
/* decode src buffer into target buffer.
|
||||
* src is 0-terminated.
|
||||
* targsize must be at least srclength*3/4+1 (srclength not including \0)
|
||||
* but only srclength*3/4 characters will be meaningful
|
||||
* (the next one may be partially written during decoding, but it should be ignored).
|
||||
*/
|
||||
extern int hwloc_decode_from_base64(char const *src, char *target, size_t targsize);
|
||||
|
||||
/* On some systems, snprintf returns the size of written data, not the actually
|
||||
* required size. Sometimes it returns -1 on truncation too.
|
||||
* And sometimes it doesn't like NULL output buffers.
|
||||
* http://www.gnu.org/software/gnulib/manual/html_node/snprintf.html
|
||||
*
|
||||
* hwloc_snprintf behaves properly, but it's a bit overkill on the vast majority
|
||||
* of platforms, so don't enable it unless really needed.
|
||||
*/
|
||||
#ifdef HWLOC_HAVE_CORRECT_SNPRINTF
|
||||
#define hwloc_snprintf snprintf
|
||||
#else
|
||||
extern int hwloc_snprintf(char *str, size_t size, const char *format, ...) __hwloc_attribute_format(printf, 3, 4);
|
||||
#endif
|
||||
|
||||
/* Return the name of the currently running program, if supported.
|
||||
* If not NULL, must be freed by the caller.
|
||||
*/
|
||||
extern char * hwloc_progname(struct hwloc_topology *topology);
|
||||
|
||||
/* obj->attr->group.kind internal values.
|
||||
* the core will keep the smallest ones when merging two groups,
|
||||
* that's why user-given kinds are first.
|
||||
*/
|
||||
/* first, user-given groups, should remain as long as possible */
|
||||
#define HWLOC_GROUP_KIND_USER 0 /* user-given, user may use subkind too */
|
||||
#define HWLOC_GROUP_KIND_SYNTHETIC 10 /* subkind is group depth within synthetic description */
|
||||
/* then, hardware-specific groups */
|
||||
#define HWLOC_GROUP_KIND_INTEL_KNL_SUBNUMA_CLUSTER 100 /* no subkind */
|
||||
#define HWLOC_GROUP_KIND_INTEL_EXTTOPOENUM_UNKNOWN 101 /* subkind is unknown level */
|
||||
#define HWLOC_GROUP_KIND_INTEL_MODULE 102 /* no subkind */
|
||||
#define HWLOC_GROUP_KIND_INTEL_TILE 103 /* no subkind */
|
||||
#define HWLOC_GROUP_KIND_INTEL_DIE 104 /* no subkind */
|
||||
#define HWLOC_GROUP_KIND_S390_BOOK 110 /* subkind 0 is book, subkind 1 is drawer (group of books) */
|
||||
#define HWLOC_GROUP_KIND_AMD_COMPUTE_UNIT 120 /* no subkind */
|
||||
/* then, OS-specific groups */
|
||||
#define HWLOC_GROUP_KIND_SOLARIS_PG_HW_PERF 200 /* subkind is group width */
|
||||
#define HWLOC_GROUP_KIND_AIX_SDL_UNKNOWN 210 /* subkind is SDL level */
|
||||
#define HWLOC_GROUP_KIND_WINDOWS_PROCESSOR_GROUP 220 /* no subkind */
|
||||
#define HWLOC_GROUP_KIND_WINDOWS_RELATIONSHIP_UNKNOWN 221 /* no subkind */
|
||||
/* distance groups */
|
||||
#define HWLOC_GROUP_KIND_DISTANCE 900 /* subkind is round of adding these groups during distance based grouping */
|
||||
/* finally, hwloc-specific groups required to insert something else, should disappear as soon as possible */
|
||||
#define HWLOC_GROUP_KIND_IO 1000 /* no subkind */
|
||||
#define HWLOC_GROUP_KIND_MEMORY 1001 /* no subkind */
|
||||
|
||||
/* memory allocator for topology objects */
|
||||
struct hwloc_tma {
|
||||
void * (*malloc)(struct hwloc_tma *, size_t);
|
||||
void *data;
|
||||
int dontfree; /* when set, free() or realloc() cannot be used, and tma->malloc() cannot fail */
|
||||
};
|
||||
|
||||
static __hwloc_inline void *
|
||||
hwloc_tma_malloc(struct hwloc_tma *tma,
|
||||
size_t size)
|
||||
{
|
||||
if (tma) {
|
||||
return tma->malloc(tma, size);
|
||||
} else {
|
||||
return malloc(size);
|
||||
}
|
||||
}
|
||||
|
||||
static __hwloc_inline void *
|
||||
hwloc_tma_calloc(struct hwloc_tma *tma,
|
||||
size_t size)
|
||||
{
|
||||
char *ptr = hwloc_tma_malloc(tma, size);
|
||||
if (ptr)
|
||||
memset(ptr, 0, size);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static __hwloc_inline char *
|
||||
hwloc_tma_strdup(struct hwloc_tma *tma,
|
||||
const char *src)
|
||||
{
|
||||
size_t len = strlen(src);
|
||||
char *ptr = hwloc_tma_malloc(tma, len+1);
|
||||
if (ptr)
|
||||
memcpy(ptr, src, len+1);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/* bitmap allocator to be used inside hwloc */
|
||||
extern hwloc_bitmap_t hwloc_bitmap_tma_dup(struct hwloc_tma *tma, hwloc_const_bitmap_t old);
|
||||
|
||||
extern int hwloc__topology_dup(hwloc_topology_t *newp, hwloc_topology_t old, struct hwloc_tma *tma);
|
||||
extern void hwloc__topology_disadopt(hwloc_topology_t topology);
|
||||
|
||||
#endif /* HWLOC_PRIVATE_H */
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2009-2010 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Copyright © 2017 Inria. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HWLOC_INSIDE_PLUGIN
|
||||
/*
|
||||
* these declarations are internal only, they are not available to plugins
|
||||
* (functions below are internal static symbols).
|
||||
*/
|
||||
#error This file should not be used in plugins
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HWLOC_PRIVATE_SOLARIS_CHIPTYPE_H
|
||||
#define HWLOC_PRIVATE_SOLARIS_CHIPTYPE_H
|
||||
|
||||
struct hwloc_solaris_chip_info_s {
|
||||
char *model;
|
||||
char *type;
|
||||
/* L1i, L1d, L2, L3 */
|
||||
#define HWLOC_SOLARIS_CHIP_INFO_L1I 0
|
||||
#define HWLOC_SOLARIS_CHIP_INFO_L1D 1
|
||||
#define HWLOC_SOLARIS_CHIP_INFO_L2I 2
|
||||
#define HWLOC_SOLARIS_CHIP_INFO_L2D 3
|
||||
#define HWLOC_SOLARIS_CHIP_INFO_L3 4
|
||||
long cache_size[5]; /* cleared to -1 if we don't want of that cache */
|
||||
unsigned cache_linesize[5];
|
||||
unsigned cache_associativity[5];
|
||||
int l2_unified;
|
||||
};
|
||||
|
||||
/* fills the structure with 0 on error */
|
||||
extern void hwloc_solaris_get_chip_info(struct hwloc_solaris_chip_info_s *info);
|
||||
|
||||
#endif /* HWLOC_PRIVATE_SOLARIS_CHIPTYPE_H */
|
||||
107
src/3rdparty/hwloc/include/private/xml.h
vendored
107
src/3rdparty/hwloc/include/private/xml.h
vendored
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2009-2017 Inria. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef PRIVATE_XML_H
|
||||
#define PRIVATE_XML_H 1
|
||||
|
||||
#include "hwloc.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
HWLOC_DECLSPEC int hwloc__xml_verbose(void);
|
||||
|
||||
/**************
|
||||
* XML import *
|
||||
**************/
|
||||
|
||||
typedef struct hwloc__xml_import_state_s {
|
||||
struct hwloc__xml_import_state_s *parent;
|
||||
|
||||
/* globals shared because the entire stack of states during import */
|
||||
struct hwloc_xml_backend_data_s *global;
|
||||
|
||||
/* opaque data used to store backend-specific data.
|
||||
* statically allocated to allow stack-allocation by the common code without knowing actual backend needs.
|
||||
*/
|
||||
char data[32];
|
||||
} * hwloc__xml_import_state_t;
|
||||
|
||||
struct hwloc__xml_imported_v1distances_s {
|
||||
unsigned long kind;
|
||||
unsigned nbobjs;
|
||||
float *floats;
|
||||
struct hwloc__xml_imported_v1distances_s *prev, *next;
|
||||
};
|
||||
|
||||
HWLOC_DECLSPEC int hwloc__xml_import_diff(hwloc__xml_import_state_t state, hwloc_topology_diff_t *firstdiffp);
|
||||
|
||||
struct hwloc_xml_backend_data_s {
|
||||
/* xml backend parameters */
|
||||
int (*look_init)(struct hwloc_xml_backend_data_s *bdata, struct hwloc__xml_import_state_s *state);
|
||||
void (*look_done)(struct hwloc_xml_backend_data_s *bdata, int result);
|
||||
void (*backend_exit)(struct hwloc_xml_backend_data_s *bdata);
|
||||
int (*next_attr)(struct hwloc__xml_import_state_s * state, char **namep, char **valuep);
|
||||
int (*find_child)(struct hwloc__xml_import_state_s * state, struct hwloc__xml_import_state_s * childstate, char **tagp);
|
||||
int (*close_tag)(struct hwloc__xml_import_state_s * state); /* look for an explicit closing tag </name> */
|
||||
void (*close_child)(struct hwloc__xml_import_state_s * state);
|
||||
int (*get_content)(struct hwloc__xml_import_state_s * state, char **beginp, size_t expected_length); /* return 0 on empty content (and sets beginp to empty string), 1 on actual content, -1 on error or unexpected content length */
|
||||
void (*close_content)(struct hwloc__xml_import_state_s * state);
|
||||
char * msgprefix;
|
||||
void *data; /* libxml2 doc, or nolibxml buffer */
|
||||
unsigned version_major, version_minor;
|
||||
unsigned nbnumanodes;
|
||||
hwloc_obj_t first_numanode, last_numanode; /* temporary cousin-list for handling v1distances */
|
||||
struct hwloc__xml_imported_v1distances_s *first_v1dist, *last_v1dist;
|
||||
};
|
||||
|
||||
/**************
|
||||
* XML export *
|
||||
**************/
|
||||
|
||||
typedef struct hwloc__xml_export_state_s {
|
||||
struct hwloc__xml_export_state_s *parent;
|
||||
|
||||
void (*new_child)(struct hwloc__xml_export_state_s *parentstate, struct hwloc__xml_export_state_s *state, const char *name);
|
||||
void (*new_prop)(struct hwloc__xml_export_state_s *state, const char *name, const char *value);
|
||||
void (*add_content)(struct hwloc__xml_export_state_s *state, const char *buffer, size_t length);
|
||||
void (*end_object)(struct hwloc__xml_export_state_s *state, const char *name);
|
||||
|
||||
struct hwloc__xml_export_data_s {
|
||||
hwloc_obj_t v1_memory_group; /* if we need to insert intermediate group above memory children when exporting to v1 */
|
||||
} *global;
|
||||
|
||||
/* opaque data used to store backend-specific data.
|
||||
* statically allocated to allow stack-allocation by the common code without knowing actual backend needs.
|
||||
*/
|
||||
char data[40];
|
||||
} * hwloc__xml_export_state_t;
|
||||
|
||||
HWLOC_DECLSPEC void hwloc__xml_export_topology(hwloc__xml_export_state_t parentstate, hwloc_topology_t topology, unsigned long flags);
|
||||
|
||||
HWLOC_DECLSPEC void hwloc__xml_export_diff(hwloc__xml_export_state_t parentstate, hwloc_topology_diff_t diff);
|
||||
|
||||
/******************
|
||||
* XML components *
|
||||
******************/
|
||||
|
||||
struct hwloc_xml_callbacks {
|
||||
int (*backend_init)(struct hwloc_xml_backend_data_s *bdata, const char *xmlpath, const char *xmlbuffer, int xmlbuflen);
|
||||
int (*export_file)(struct hwloc_topology *topology, struct hwloc__xml_export_data_s *edata, const char *filename, unsigned long flags);
|
||||
int (*export_buffer)(struct hwloc_topology *topology, struct hwloc__xml_export_data_s *edata, char **xmlbuffer, int *buflen, unsigned long flags);
|
||||
void (*free_buffer)(void *xmlbuffer);
|
||||
int (*import_diff)(struct hwloc__xml_import_state_s *state, const char *xmlpath, const char *xmlbuffer, int xmlbuflen, hwloc_topology_diff_t *diff, char **refnamep);
|
||||
int (*export_diff_file)(union hwloc_topology_diff_u *diff, const char *refname, const char *filename);
|
||||
int (*export_diff_buffer)(union hwloc_topology_diff_u *diff, const char *refname, char **xmlbuffer, int *buflen);
|
||||
};
|
||||
|
||||
struct hwloc_xml_component {
|
||||
struct hwloc_xml_callbacks *nolibxml_callbacks;
|
||||
struct hwloc_xml_callbacks *libxml_callbacks;
|
||||
};
|
||||
|
||||
HWLOC_DECLSPEC void hwloc_xml_callbacks_register(struct hwloc_xml_component *component);
|
||||
HWLOC_DECLSPEC void hwloc_xml_callbacks_reset(void);
|
||||
|
||||
#endif /* PRIVATE_XML_H */
|
||||
309
src/3rdparty/hwloc/src/base64.c
vendored
309
src/3rdparty/hwloc/src/base64.c
vendored
@@ -1,309 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2012-2018 Inria. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*
|
||||
* Modifications after import:
|
||||
* - removed all #if
|
||||
* - updated prototypes
|
||||
* - updated #include
|
||||
*/
|
||||
|
||||
/* include hwloc's config before anything else
|
||||
* so that extensions and features are properly enabled
|
||||
*/
|
||||
#include "private/private.h"
|
||||
|
||||
/* $OpenBSD: base64.c,v 1.5 2006/10/21 09:55:03 otto Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Portions Copyright (c) 1995 by International Business Machines, Inc.
|
||||
*
|
||||
* International Business Machines, Inc. (hereinafter called IBM) grants
|
||||
* permission under its copyrights to use, copy, modify, and distribute this
|
||||
* Software with or without fee, provided that the above copyright notice and
|
||||
* all paragraphs of this notice appear in all copies, and that the name of IBM
|
||||
* not be used in connection with the marketing of any product incorporating
|
||||
* the Software or modifications thereof, without specific, written prior
|
||||
* permission.
|
||||
*
|
||||
* To the extent it has a right to do so, IBM grants an immunity from suit
|
||||
* under its patents, if any, for the use, sale or manufacture of products to
|
||||
* the extent that such products are used for performing Domain Name System
|
||||
* dynamic updates in TCP/IP networks by means of the Software. No immunity is
|
||||
* granted for any product per se or for any other function of any product.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
|
||||
* DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
|
||||
* IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
/* OPENBSD ORIGINAL: lib/libc/net/base64.c */
|
||||
|
||||
static const char Base64[] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
static const char Pad64 = '=';
|
||||
|
||||
/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt)
|
||||
The following encoding technique is taken from RFC 1521 by Borenstein
|
||||
and Freed. It is reproduced here in a slightly edited form for
|
||||
convenience.
|
||||
|
||||
A 65-character subset of US-ASCII is used, enabling 6 bits to be
|
||||
represented per printable character. (The extra 65th character, "=",
|
||||
is used to signify a special processing function.)
|
||||
|
||||
The encoding process represents 24-bit groups of input bits as output
|
||||
strings of 4 encoded characters. Proceeding from left to right, a
|
||||
24-bit input group is formed by concatenating 3 8-bit input groups.
|
||||
These 24 bits are then treated as 4 concatenated 6-bit groups, each
|
||||
of which is translated into a single digit in the base64 alphabet.
|
||||
|
||||
Each 6-bit group is used as an index into an array of 64 printable
|
||||
characters. The character referenced by the index is placed in the
|
||||
output string.
|
||||
|
||||
Table 1: The Base64 Alphabet
|
||||
|
||||
Value Encoding Value Encoding Value Encoding Value Encoding
|
||||
0 A 17 R 34 i 51 z
|
||||
1 B 18 S 35 j 52 0
|
||||
2 C 19 T 36 k 53 1
|
||||
3 D 20 U 37 l 54 2
|
||||
4 E 21 V 38 m 55 3
|
||||
5 F 22 W 39 n 56 4
|
||||
6 G 23 X 40 o 57 5
|
||||
7 H 24 Y 41 p 58 6
|
||||
8 I 25 Z 42 q 59 7
|
||||
9 J 26 a 43 r 60 8
|
||||
10 K 27 b 44 s 61 9
|
||||
11 L 28 c 45 t 62 +
|
||||
12 M 29 d 46 u 63 /
|
||||
13 N 30 e 47 v
|
||||
14 O 31 f 48 w (pad) =
|
||||
15 P 32 g 49 x
|
||||
16 Q 33 h 50 y
|
||||
|
||||
Special processing is performed if fewer than 24 bits are available
|
||||
at the end of the data being encoded. A full encoding quantum is
|
||||
always completed at the end of a quantity. When fewer than 24 input
|
||||
bits are available in an input group, zero bits are added (on the
|
||||
right) to form an integral number of 6-bit groups. Padding at the
|
||||
end of the data is performed using the '=' character.
|
||||
|
||||
Since all base64 input is an integral number of octets, only the
|
||||
-------------------------------------------------
|
||||
following cases can arise:
|
||||
|
||||
(1) the final quantum of encoding input is an integral
|
||||
multiple of 24 bits; here, the final unit of encoded
|
||||
output will be an integral multiple of 4 characters
|
||||
with no "=" padding,
|
||||
(2) the final quantum of encoding input is exactly 8 bits;
|
||||
here, the final unit of encoded output will be two
|
||||
characters followed by two "=" padding characters, or
|
||||
(3) the final quantum of encoding input is exactly 16 bits;
|
||||
here, the final unit of encoded output will be three
|
||||
characters followed by one "=" padding character.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
int
|
||||
hwloc_encode_to_base64(const char *src, size_t srclength, char *target, size_t targsize)
|
||||
{
|
||||
size_t datalength = 0;
|
||||
unsigned char input[3];
|
||||
unsigned char output[4];
|
||||
unsigned int i;
|
||||
|
||||
while (2 < srclength) {
|
||||
input[0] = *src++;
|
||||
input[1] = *src++;
|
||||
input[2] = *src++;
|
||||
srclength -= 3;
|
||||
|
||||
output[0] = input[0] >> 2;
|
||||
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
|
||||
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
|
||||
output[3] = input[2] & 0x3f;
|
||||
|
||||
if (datalength + 4 > targsize)
|
||||
return (-1);
|
||||
target[datalength++] = Base64[output[0]];
|
||||
target[datalength++] = Base64[output[1]];
|
||||
target[datalength++] = Base64[output[2]];
|
||||
target[datalength++] = Base64[output[3]];
|
||||
}
|
||||
|
||||
/* Now we worry about padding. */
|
||||
if (0 != srclength) {
|
||||
/* Get what's left. */
|
||||
input[0] = input[1] = input[2] = '\0';
|
||||
for (i = 0; i < srclength; i++)
|
||||
input[i] = *src++;
|
||||
|
||||
output[0] = input[0] >> 2;
|
||||
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
|
||||
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
|
||||
|
||||
if (datalength + 4 > targsize)
|
||||
return (-1);
|
||||
target[datalength++] = Base64[output[0]];
|
||||
target[datalength++] = Base64[output[1]];
|
||||
if (srclength == 1)
|
||||
target[datalength++] = Pad64;
|
||||
else
|
||||
target[datalength++] = Base64[output[2]];
|
||||
target[datalength++] = Pad64;
|
||||
}
|
||||
if (datalength >= targsize)
|
||||
return (-1);
|
||||
target[datalength] = '\0'; /* Returned value doesn't count \0. */
|
||||
return (int)(datalength);
|
||||
}
|
||||
|
||||
/* skips all whitespace anywhere.
|
||||
converts characters, four at a time, starting at (or after)
|
||||
src from base - 64 numbers into three 8 bit bytes in the target area.
|
||||
it returns the number of data bytes stored at the target, or -1 on error.
|
||||
*/
|
||||
|
||||
int
|
||||
hwloc_decode_from_base64(char const *src, char *target, size_t targsize)
|
||||
{
|
||||
unsigned int tarindex, state;
|
||||
int ch;
|
||||
char *pos;
|
||||
|
||||
state = 0;
|
||||
tarindex = 0;
|
||||
|
||||
while ((ch = *src++) != '\0') {
|
||||
if (isspace(ch)) /* Skip whitespace anywhere. */
|
||||
continue;
|
||||
|
||||
if (ch == Pad64)
|
||||
break;
|
||||
|
||||
pos = strchr(Base64, ch);
|
||||
if (pos == 0) /* A non-base64 character. */
|
||||
return (-1);
|
||||
|
||||
switch (state) {
|
||||
case 0:
|
||||
if (target) {
|
||||
if (tarindex >= targsize)
|
||||
return (-1);
|
||||
target[tarindex] = (char)(pos - Base64) << 2;
|
||||
}
|
||||
state = 1;
|
||||
break;
|
||||
case 1:
|
||||
if (target) {
|
||||
if (tarindex + 1 >= targsize)
|
||||
return (-1);
|
||||
target[tarindex] |= (pos - Base64) >> 4;
|
||||
target[tarindex+1] = ((pos - Base64) & 0x0f)
|
||||
<< 4 ;
|
||||
}
|
||||
tarindex++;
|
||||
state = 2;
|
||||
break;
|
||||
case 2:
|
||||
if (target) {
|
||||
if (tarindex + 1 >= targsize)
|
||||
return (-1);
|
||||
target[tarindex] |= (pos - Base64) >> 2;
|
||||
target[tarindex+1] = ((pos - Base64) & 0x03)
|
||||
<< 6;
|
||||
}
|
||||
tarindex++;
|
||||
state = 3;
|
||||
break;
|
||||
case 3:
|
||||
if (target) {
|
||||
if (tarindex >= targsize)
|
||||
return (-1);
|
||||
target[tarindex] |= (pos - Base64);
|
||||
}
|
||||
tarindex++;
|
||||
state = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We are done decoding Base-64 chars. Let's see if we ended
|
||||
* on a byte boundary, and/or with erroneous trailing characters.
|
||||
*/
|
||||
|
||||
if (ch == Pad64) { /* We got a pad char. */
|
||||
ch = *src++; /* Skip it, get next. */
|
||||
switch (state) {
|
||||
case 0: /* Invalid = in first position */
|
||||
case 1: /* Invalid = in second position */
|
||||
return (-1);
|
||||
|
||||
case 2: /* Valid, means one byte of info */
|
||||
/* Skip any number of spaces. */
|
||||
for (; ch != '\0'; ch = *src++)
|
||||
if (!isspace(ch))
|
||||
break;
|
||||
/* Make sure there is another trailing = sign. */
|
||||
if (ch != Pad64)
|
||||
return (-1);
|
||||
ch = *src++; /* Skip the = */
|
||||
/* Fall through to "single trailing =" case. */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case 3: /* Valid, means two bytes of info */
|
||||
/*
|
||||
* We know this char is an =. Is there anything but
|
||||
* whitespace after it?
|
||||
*/
|
||||
for (; ch != '\0'; ch = *src++)
|
||||
if (!isspace(ch))
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* Now make sure for cases 2 and 3 that the "extra"
|
||||
* bits that slopped past the last full byte were
|
||||
* zeros. If we don't check them, they become a
|
||||
* subliminal channel.
|
||||
*/
|
||||
if (target && target[tarindex] != 0)
|
||||
return (-1);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* We ended by seeing the end of the string. Make sure we
|
||||
* have no partial bytes lying around.
|
||||
*/
|
||||
if (state != 0)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
return (tarindex);
|
||||
}
|
||||
925
src/3rdparty/hwloc/src/bind.c
vendored
925
src/3rdparty/hwloc/src/bind.c
vendored
@@ -1,925 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2019 Inria. All rights reserved.
|
||||
* Copyright © 2009-2010, 2012 Université Bordeaux
|
||||
* Copyright © 2011-2015 Cisco Systems, Inc. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
#include "private/autogen/config.h"
|
||||
#include "hwloc.h"
|
||||
#include "private/private.h"
|
||||
#include "hwloc/helper.h"
|
||||
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
# include <sys/mman.h>
|
||||
#endif
|
||||
/* <malloc.h> is only needed if we don't have posix_memalign() */
|
||||
#if defined(hwloc_getpagesize) && !defined(HAVE_POSIX_MEMALIGN) && defined(HAVE_MEMALIGN) && defined(HAVE_MALLOC_H)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* TODO: HWLOC_GNU_SYS,
|
||||
*
|
||||
* We could use glibc's sched_setaffinity generically when it is available
|
||||
*
|
||||
* Darwin and OpenBSD don't seem to have binding facilities.
|
||||
*/
|
||||
|
||||
#define HWLOC_CPUBIND_ALLFLAGS (HWLOC_CPUBIND_PROCESS|HWLOC_CPUBIND_THREAD|HWLOC_CPUBIND_STRICT|HWLOC_CPUBIND_NOMEMBIND)
|
||||
|
||||
static hwloc_const_bitmap_t
|
||||
hwloc_fix_cpubind(hwloc_topology_t topology, hwloc_const_bitmap_t set)
|
||||
{
|
||||
hwloc_const_bitmap_t topology_set = hwloc_topology_get_topology_cpuset(topology);
|
||||
hwloc_const_bitmap_t complete_set = hwloc_topology_get_complete_cpuset(topology);
|
||||
|
||||
if (hwloc_bitmap_iszero(set)) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!hwloc_bitmap_isincluded(set, complete_set)) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (hwloc_bitmap_isincluded(topology_set, set))
|
||||
set = complete_set;
|
||||
|
||||
return set;
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_set_cpubind(hwloc_topology_t topology, hwloc_const_bitmap_t set, int flags)
|
||||
{
|
||||
if (flags & ~HWLOC_CPUBIND_ALLFLAGS) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
set = hwloc_fix_cpubind(topology, set);
|
||||
if (!set)
|
||||
return -1;
|
||||
|
||||
if (flags & HWLOC_CPUBIND_PROCESS) {
|
||||
if (topology->binding_hooks.set_thisproc_cpubind)
|
||||
return topology->binding_hooks.set_thisproc_cpubind(topology, set, flags);
|
||||
} else if (flags & HWLOC_CPUBIND_THREAD) {
|
||||
if (topology->binding_hooks.set_thisthread_cpubind)
|
||||
return topology->binding_hooks.set_thisthread_cpubind(topology, set, flags);
|
||||
} else {
|
||||
if (topology->binding_hooks.set_thisproc_cpubind) {
|
||||
int err = topology->binding_hooks.set_thisproc_cpubind(topology, set, flags);
|
||||
if (err >= 0 || errno != ENOSYS)
|
||||
return err;
|
||||
/* ENOSYS, fallback */
|
||||
}
|
||||
if (topology->binding_hooks.set_thisthread_cpubind)
|
||||
return topology->binding_hooks.set_thisthread_cpubind(topology, set, flags);
|
||||
}
|
||||
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_get_cpubind(hwloc_topology_t topology, hwloc_bitmap_t set, int flags)
|
||||
{
|
||||
if (flags & ~HWLOC_CPUBIND_ALLFLAGS) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (flags & HWLOC_CPUBIND_PROCESS) {
|
||||
if (topology->binding_hooks.get_thisproc_cpubind)
|
||||
return topology->binding_hooks.get_thisproc_cpubind(topology, set, flags);
|
||||
} else if (flags & HWLOC_CPUBIND_THREAD) {
|
||||
if (topology->binding_hooks.get_thisthread_cpubind)
|
||||
return topology->binding_hooks.get_thisthread_cpubind(topology, set, flags);
|
||||
} else {
|
||||
if (topology->binding_hooks.get_thisproc_cpubind) {
|
||||
int err = topology->binding_hooks.get_thisproc_cpubind(topology, set, flags);
|
||||
if (err >= 0 || errno != ENOSYS)
|
||||
return err;
|
||||
/* ENOSYS, fallback */
|
||||
}
|
||||
if (topology->binding_hooks.get_thisthread_cpubind)
|
||||
return topology->binding_hooks.get_thisthread_cpubind(topology, set, flags);
|
||||
}
|
||||
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_set_proc_cpubind(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_const_bitmap_t set, int flags)
|
||||
{
|
||||
if (flags & ~HWLOC_CPUBIND_ALLFLAGS) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
set = hwloc_fix_cpubind(topology, set);
|
||||
if (!set)
|
||||
return -1;
|
||||
|
||||
if (topology->binding_hooks.set_proc_cpubind)
|
||||
return topology->binding_hooks.set_proc_cpubind(topology, pid, set, flags);
|
||||
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_get_proc_cpubind(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_bitmap_t set, int flags)
|
||||
{
|
||||
if (flags & ~HWLOC_CPUBIND_ALLFLAGS) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (topology->binding_hooks.get_proc_cpubind)
|
||||
return topology->binding_hooks.get_proc_cpubind(topology, pid, set, flags);
|
||||
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef hwloc_thread_t
|
||||
int
|
||||
hwloc_set_thread_cpubind(hwloc_topology_t topology, hwloc_thread_t tid, hwloc_const_bitmap_t set, int flags)
|
||||
{
|
||||
if (flags & ~HWLOC_CPUBIND_ALLFLAGS) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
set = hwloc_fix_cpubind(topology, set);
|
||||
if (!set)
|
||||
return -1;
|
||||
|
||||
if (topology->binding_hooks.set_thread_cpubind)
|
||||
return topology->binding_hooks.set_thread_cpubind(topology, tid, set, flags);
|
||||
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_get_thread_cpubind(hwloc_topology_t topology, hwloc_thread_t tid, hwloc_bitmap_t set, int flags)
|
||||
{
|
||||
if (flags & ~HWLOC_CPUBIND_ALLFLAGS) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (topology->binding_hooks.get_thread_cpubind)
|
||||
return topology->binding_hooks.get_thread_cpubind(topology, tid, set, flags);
|
||||
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
hwloc_get_last_cpu_location(hwloc_topology_t topology, hwloc_bitmap_t set, int flags)
|
||||
{
|
||||
if (flags & ~HWLOC_CPUBIND_ALLFLAGS) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (flags & HWLOC_CPUBIND_PROCESS) {
|
||||
if (topology->binding_hooks.get_thisproc_last_cpu_location)
|
||||
return topology->binding_hooks.get_thisproc_last_cpu_location(topology, set, flags);
|
||||
} else if (flags & HWLOC_CPUBIND_THREAD) {
|
||||
if (topology->binding_hooks.get_thisthread_last_cpu_location)
|
||||
return topology->binding_hooks.get_thisthread_last_cpu_location(topology, set, flags);
|
||||
} else {
|
||||
if (topology->binding_hooks.get_thisproc_last_cpu_location) {
|
||||
int err = topology->binding_hooks.get_thisproc_last_cpu_location(topology, set, flags);
|
||||
if (err >= 0 || errno != ENOSYS)
|
||||
return err;
|
||||
/* ENOSYS, fallback */
|
||||
}
|
||||
if (topology->binding_hooks.get_thisthread_last_cpu_location)
|
||||
return topology->binding_hooks.get_thisthread_last_cpu_location(topology, set, flags);
|
||||
}
|
||||
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_get_proc_last_cpu_location(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_bitmap_t set, int flags)
|
||||
{
|
||||
if (flags & ~HWLOC_CPUBIND_ALLFLAGS) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (topology->binding_hooks.get_proc_last_cpu_location)
|
||||
return topology->binding_hooks.get_proc_last_cpu_location(topology, pid, set, flags);
|
||||
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#define HWLOC_MEMBIND_ALLFLAGS (HWLOC_MEMBIND_PROCESS|HWLOC_MEMBIND_THREAD|HWLOC_MEMBIND_STRICT|HWLOC_MEMBIND_MIGRATE|HWLOC_MEMBIND_NOCPUBIND|HWLOC_MEMBIND_BYNODESET)
|
||||
|
||||
static hwloc_const_nodeset_t
|
||||
hwloc_fix_membind(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset)
|
||||
{
|
||||
hwloc_const_bitmap_t topology_nodeset = hwloc_topology_get_topology_nodeset(topology);
|
||||
hwloc_const_bitmap_t complete_nodeset = hwloc_topology_get_complete_nodeset(topology);
|
||||
|
||||
if (hwloc_bitmap_iszero(nodeset)) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!hwloc_bitmap_isincluded(nodeset, complete_nodeset)) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (hwloc_bitmap_isincluded(topology_nodeset, nodeset))
|
||||
return complete_nodeset;
|
||||
|
||||
return nodeset;
|
||||
}
|
||||
|
||||
static int
|
||||
hwloc_fix_membind_cpuset(hwloc_topology_t topology, hwloc_nodeset_t nodeset, hwloc_const_cpuset_t cpuset)
|
||||
{
|
||||
hwloc_const_bitmap_t topology_set = hwloc_topology_get_topology_cpuset(topology);
|
||||
hwloc_const_bitmap_t complete_set = hwloc_topology_get_complete_cpuset(topology);
|
||||
hwloc_const_bitmap_t complete_nodeset = hwloc_topology_get_complete_nodeset(topology);
|
||||
|
||||
if (hwloc_bitmap_iszero(cpuset)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!hwloc_bitmap_isincluded(cpuset, complete_set)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (hwloc_bitmap_isincluded(topology_set, cpuset)) {
|
||||
hwloc_bitmap_copy(nodeset, complete_nodeset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
hwloc_cpuset_to_nodeset(topology, cpuset, nodeset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __hwloc_inline int hwloc__check_membind_policy(hwloc_membind_policy_t policy)
|
||||
{
|
||||
if (policy == HWLOC_MEMBIND_DEFAULT
|
||||
|| policy == HWLOC_MEMBIND_FIRSTTOUCH
|
||||
|| policy == HWLOC_MEMBIND_BIND
|
||||
|| policy == HWLOC_MEMBIND_INTERLEAVE
|
||||
|| policy == HWLOC_MEMBIND_NEXTTOUCH)
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
hwloc_set_membind_by_nodeset(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
|
||||
{
|
||||
if ((flags & ~HWLOC_MEMBIND_ALLFLAGS) || hwloc__check_membind_policy(policy) < 0) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
nodeset = hwloc_fix_membind(topology, nodeset);
|
||||
if (!nodeset)
|
||||
return -1;
|
||||
|
||||
if (flags & HWLOC_MEMBIND_PROCESS) {
|
||||
if (topology->binding_hooks.set_thisproc_membind)
|
||||
return topology->binding_hooks.set_thisproc_membind(topology, nodeset, policy, flags);
|
||||
} else if (flags & HWLOC_MEMBIND_THREAD) {
|
||||
if (topology->binding_hooks.set_thisthread_membind)
|
||||
return topology->binding_hooks.set_thisthread_membind(topology, nodeset, policy, flags);
|
||||
} else {
|
||||
if (topology->binding_hooks.set_thisproc_membind) {
|
||||
int err = topology->binding_hooks.set_thisproc_membind(topology, nodeset, policy, flags);
|
||||
if (err >= 0 || errno != ENOSYS)
|
||||
return err;
|
||||
/* ENOSYS, fallback */
|
||||
}
|
||||
if (topology->binding_hooks.set_thisthread_membind)
|
||||
return topology->binding_hooks.set_thisthread_membind(topology, nodeset, policy, flags);
|
||||
}
|
||||
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_set_membind(hwloc_topology_t topology, hwloc_const_bitmap_t set, hwloc_membind_policy_t policy, int flags)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (flags & HWLOC_MEMBIND_BYNODESET) {
|
||||
ret = hwloc_set_membind_by_nodeset(topology, set, policy, flags);
|
||||
} else {
|
||||
hwloc_nodeset_t nodeset = hwloc_bitmap_alloc();
|
||||
if (hwloc_fix_membind_cpuset(topology, nodeset, set))
|
||||
ret = -1;
|
||||
else
|
||||
ret = hwloc_set_membind_by_nodeset(topology, nodeset, policy, flags);
|
||||
hwloc_bitmap_free(nodeset);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
hwloc_get_membind_by_nodeset(hwloc_topology_t topology, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags)
|
||||
{
|
||||
if (flags & ~HWLOC_MEMBIND_ALLFLAGS) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (flags & HWLOC_MEMBIND_PROCESS) {
|
||||
if (topology->binding_hooks.get_thisproc_membind)
|
||||
return topology->binding_hooks.get_thisproc_membind(topology, nodeset, policy, flags);
|
||||
} else if (flags & HWLOC_MEMBIND_THREAD) {
|
||||
if (topology->binding_hooks.get_thisthread_membind)
|
||||
return topology->binding_hooks.get_thisthread_membind(topology, nodeset, policy, flags);
|
||||
} else {
|
||||
if (topology->binding_hooks.get_thisproc_membind) {
|
||||
int err = topology->binding_hooks.get_thisproc_membind(topology, nodeset, policy, flags);
|
||||
if (err >= 0 || errno != ENOSYS)
|
||||
return err;
|
||||
/* ENOSYS, fallback */
|
||||
}
|
||||
if (topology->binding_hooks.get_thisthread_membind)
|
||||
return topology->binding_hooks.get_thisthread_membind(topology, nodeset, policy, flags);
|
||||
}
|
||||
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_get_membind(hwloc_topology_t topology, hwloc_bitmap_t set, hwloc_membind_policy_t * policy, int flags)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (flags & HWLOC_MEMBIND_BYNODESET) {
|
||||
ret = hwloc_get_membind_by_nodeset(topology, set, policy, flags);
|
||||
} else {
|
||||
hwloc_nodeset_t nodeset = hwloc_bitmap_alloc();
|
||||
ret = hwloc_get_membind_by_nodeset(topology, nodeset, policy, flags);
|
||||
if (!ret)
|
||||
hwloc_cpuset_from_nodeset(topology, set, nodeset);
|
||||
hwloc_bitmap_free(nodeset);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
hwloc_set_proc_membind_by_nodeset(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
|
||||
{
|
||||
if ((flags & ~HWLOC_MEMBIND_ALLFLAGS) || hwloc__check_membind_policy(policy) < 0) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
nodeset = hwloc_fix_membind(topology, nodeset);
|
||||
if (!nodeset)
|
||||
return -1;
|
||||
|
||||
if (topology->binding_hooks.set_proc_membind)
|
||||
return topology->binding_hooks.set_proc_membind(topology, pid, nodeset, policy, flags);
|
||||
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
hwloc_set_proc_membind(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_const_bitmap_t set, hwloc_membind_policy_t policy, int flags)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (flags & HWLOC_MEMBIND_BYNODESET) {
|
||||
ret = hwloc_set_proc_membind_by_nodeset(topology, pid, set, policy, flags);
|
||||
} else {
|
||||
hwloc_nodeset_t nodeset = hwloc_bitmap_alloc();
|
||||
if (hwloc_fix_membind_cpuset(topology, nodeset, set))
|
||||
ret = -1;
|
||||
else
|
||||
ret = hwloc_set_proc_membind_by_nodeset(topology, pid, nodeset, policy, flags);
|
||||
hwloc_bitmap_free(nodeset);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
hwloc_get_proc_membind_by_nodeset(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags)
|
||||
{
|
||||
if (flags & ~HWLOC_MEMBIND_ALLFLAGS) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (topology->binding_hooks.get_proc_membind)
|
||||
return topology->binding_hooks.get_proc_membind(topology, pid, nodeset, policy, flags);
|
||||
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_get_proc_membind(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_bitmap_t set, hwloc_membind_policy_t * policy, int flags)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (flags & HWLOC_MEMBIND_BYNODESET) {
|
||||
ret = hwloc_get_proc_membind_by_nodeset(topology, pid, set, policy, flags);
|
||||
} else {
|
||||
hwloc_nodeset_t nodeset = hwloc_bitmap_alloc();
|
||||
ret = hwloc_get_proc_membind_by_nodeset(topology, pid, nodeset, policy, flags);
|
||||
if (!ret)
|
||||
hwloc_cpuset_from_nodeset(topology, set, nodeset);
|
||||
hwloc_bitmap_free(nodeset);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
hwloc_set_area_membind_by_nodeset(hwloc_topology_t topology, const void *addr, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
|
||||
{
|
||||
if ((flags & ~HWLOC_MEMBIND_ALLFLAGS) || hwloc__check_membind_policy(policy) < 0) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!len)
|
||||
/* nothing to do */
|
||||
return 0;
|
||||
|
||||
nodeset = hwloc_fix_membind(topology, nodeset);
|
||||
if (!nodeset)
|
||||
return -1;
|
||||
|
||||
if (topology->binding_hooks.set_area_membind)
|
||||
return topology->binding_hooks.set_area_membind(topology, addr, len, nodeset, policy, flags);
|
||||
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_set_area_membind(hwloc_topology_t topology, const void *addr, size_t len, hwloc_const_bitmap_t set, hwloc_membind_policy_t policy, int flags)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (flags & HWLOC_MEMBIND_BYNODESET) {
|
||||
ret = hwloc_set_area_membind_by_nodeset(topology, addr, len, set, policy, flags);
|
||||
} else {
|
||||
hwloc_nodeset_t nodeset = hwloc_bitmap_alloc();
|
||||
if (hwloc_fix_membind_cpuset(topology, nodeset, set))
|
||||
ret = -1;
|
||||
else
|
||||
ret = hwloc_set_area_membind_by_nodeset(topology, addr, len, nodeset, policy, flags);
|
||||
hwloc_bitmap_free(nodeset);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
hwloc_get_area_membind_by_nodeset(hwloc_topology_t topology, const void *addr, size_t len, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags)
|
||||
{
|
||||
if (flags & ~HWLOC_MEMBIND_ALLFLAGS) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!len) {
|
||||
/* nothing to query */
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (topology->binding_hooks.get_area_membind)
|
||||
return topology->binding_hooks.get_area_membind(topology, addr, len, nodeset, policy, flags);
|
||||
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_get_area_membind(hwloc_topology_t topology, const void *addr, size_t len, hwloc_bitmap_t set, hwloc_membind_policy_t * policy, int flags)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (flags & HWLOC_MEMBIND_BYNODESET) {
|
||||
ret = hwloc_get_area_membind_by_nodeset(topology, addr, len, set, policy, flags);
|
||||
} else {
|
||||
hwloc_nodeset_t nodeset = hwloc_bitmap_alloc();
|
||||
ret = hwloc_get_area_membind_by_nodeset(topology, addr, len, nodeset, policy, flags);
|
||||
if (!ret)
|
||||
hwloc_cpuset_from_nodeset(topology, set, nodeset);
|
||||
hwloc_bitmap_free(nodeset);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
hwloc_get_area_memlocation_by_nodeset(hwloc_topology_t topology, const void *addr, size_t len, hwloc_nodeset_t nodeset, int flags)
|
||||
{
|
||||
if (flags & ~HWLOC_MEMBIND_ALLFLAGS) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!len)
|
||||
/* nothing to do */
|
||||
return 0;
|
||||
|
||||
if (topology->binding_hooks.get_area_memlocation)
|
||||
return topology->binding_hooks.get_area_memlocation(topology, addr, len, nodeset, flags);
|
||||
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_get_area_memlocation(hwloc_topology_t topology, const void *addr, size_t len, hwloc_cpuset_t set, int flags)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (flags & HWLOC_MEMBIND_BYNODESET) {
|
||||
ret = hwloc_get_area_memlocation_by_nodeset(topology, addr, len, set, flags);
|
||||
} else {
|
||||
hwloc_nodeset_t nodeset = hwloc_bitmap_alloc();
|
||||
ret = hwloc_get_area_memlocation_by_nodeset(topology, addr, len, nodeset, flags);
|
||||
if (!ret)
|
||||
hwloc_cpuset_from_nodeset(topology, set, nodeset);
|
||||
hwloc_bitmap_free(nodeset);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void *
|
||||
hwloc_alloc_heap(hwloc_topology_t topology __hwloc_attribute_unused, size_t len)
|
||||
{
|
||||
void *p = NULL;
|
||||
#if defined(hwloc_getpagesize) && defined(HAVE_POSIX_MEMALIGN)
|
||||
errno = posix_memalign(&p, hwloc_getpagesize(), len);
|
||||
if (errno)
|
||||
p = NULL;
|
||||
#elif defined(hwloc_getpagesize) && defined(HAVE_MEMALIGN)
|
||||
p = memalign(hwloc_getpagesize(), len);
|
||||
#else
|
||||
p = malloc(len);
|
||||
#endif
|
||||
return p;
|
||||
}
|
||||
|
||||
#ifdef MAP_ANONYMOUS
|
||||
void *
|
||||
hwloc_alloc_mmap(hwloc_topology_t topology __hwloc_attribute_unused, size_t len)
|
||||
{
|
||||
void * buffer = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
|
||||
return buffer == MAP_FAILED ? NULL : buffer;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
hwloc_free_heap(hwloc_topology_t topology __hwloc_attribute_unused, void *addr, size_t len __hwloc_attribute_unused)
|
||||
{
|
||||
free(addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef MAP_ANONYMOUS
|
||||
int
|
||||
hwloc_free_mmap(hwloc_topology_t topology __hwloc_attribute_unused, void *addr, size_t len)
|
||||
{
|
||||
if (!addr)
|
||||
return 0;
|
||||
return munmap(addr, len);
|
||||
}
|
||||
#endif
|
||||
|
||||
void *
|
||||
hwloc_alloc(hwloc_topology_t topology, size_t len)
|
||||
{
|
||||
if (topology->binding_hooks.alloc)
|
||||
return topology->binding_hooks.alloc(topology, len);
|
||||
return hwloc_alloc_heap(topology, len);
|
||||
}
|
||||
|
||||
static void *
|
||||
hwloc_alloc_membind_by_nodeset(hwloc_topology_t topology, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
|
||||
{
|
||||
void *p;
|
||||
|
||||
if ((flags & ~HWLOC_MEMBIND_ALLFLAGS) || hwloc__check_membind_policy(policy) < 0) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
nodeset = hwloc_fix_membind(topology, nodeset);
|
||||
if (!nodeset)
|
||||
goto fallback;
|
||||
if (flags & HWLOC_MEMBIND_MIGRATE) {
|
||||
errno = EINVAL;
|
||||
goto fallback;
|
||||
}
|
||||
|
||||
if (topology->binding_hooks.alloc_membind)
|
||||
return topology->binding_hooks.alloc_membind(topology, len, nodeset, policy, flags);
|
||||
else if (topology->binding_hooks.set_area_membind) {
|
||||
p = hwloc_alloc(topology, len);
|
||||
if (!p)
|
||||
return NULL;
|
||||
if (topology->binding_hooks.set_area_membind(topology, p, len, nodeset, policy, flags) && flags & HWLOC_MEMBIND_STRICT) {
|
||||
int error = errno;
|
||||
free(p);
|
||||
errno = error;
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
} else {
|
||||
errno = ENOSYS;
|
||||
}
|
||||
|
||||
fallback:
|
||||
if (flags & HWLOC_MEMBIND_STRICT)
|
||||
/* Report error */
|
||||
return NULL;
|
||||
/* Never mind, allocate anyway */
|
||||
return hwloc_alloc(topology, len);
|
||||
}
|
||||
|
||||
void *
|
||||
hwloc_alloc_membind(hwloc_topology_t topology, size_t len, hwloc_const_bitmap_t set, hwloc_membind_policy_t policy, int flags)
|
||||
{
|
||||
void *ret;
|
||||
|
||||
if (flags & HWLOC_MEMBIND_BYNODESET) {
|
||||
ret = hwloc_alloc_membind_by_nodeset(topology, len, set, policy, flags);
|
||||
} else {
|
||||
hwloc_nodeset_t nodeset = hwloc_bitmap_alloc();
|
||||
if (hwloc_fix_membind_cpuset(topology, nodeset, set)) {
|
||||
if (flags & HWLOC_MEMBIND_STRICT)
|
||||
ret = NULL;
|
||||
else
|
||||
ret = hwloc_alloc(topology, len);
|
||||
} else
|
||||
ret = hwloc_alloc_membind_by_nodeset(topology, len, nodeset, policy, flags);
|
||||
hwloc_bitmap_free(nodeset);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_free(hwloc_topology_t topology, void *addr, size_t len)
|
||||
{
|
||||
if (topology->binding_hooks.free_membind)
|
||||
return topology->binding_hooks.free_membind(topology, addr, len);
|
||||
return hwloc_free_heap(topology, addr, len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Empty binding hooks always returning success
|
||||
*/
|
||||
|
||||
static int dontset_return_complete_cpuset(hwloc_topology_t topology, hwloc_cpuset_t set)
|
||||
{
|
||||
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dontset_thisthread_cpubind(hwloc_topology_t topology __hwloc_attribute_unused, hwloc_const_bitmap_t set __hwloc_attribute_unused, int flags __hwloc_attribute_unused)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static int dontget_thisthread_cpubind(hwloc_topology_t topology __hwloc_attribute_unused, hwloc_bitmap_t set, int flags __hwloc_attribute_unused)
|
||||
{
|
||||
return dontset_return_complete_cpuset(topology, set);
|
||||
}
|
||||
static int dontset_thisproc_cpubind(hwloc_topology_t topology __hwloc_attribute_unused, hwloc_const_bitmap_t set __hwloc_attribute_unused, int flags __hwloc_attribute_unused)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static int dontget_thisproc_cpubind(hwloc_topology_t topology __hwloc_attribute_unused, hwloc_bitmap_t set, int flags __hwloc_attribute_unused)
|
||||
{
|
||||
return dontset_return_complete_cpuset(topology, set);
|
||||
}
|
||||
static int dontset_proc_cpubind(hwloc_topology_t topology __hwloc_attribute_unused, hwloc_pid_t pid __hwloc_attribute_unused, hwloc_const_bitmap_t set __hwloc_attribute_unused, int flags __hwloc_attribute_unused)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static int dontget_proc_cpubind(hwloc_topology_t topology __hwloc_attribute_unused, hwloc_pid_t pid __hwloc_attribute_unused, hwloc_bitmap_t cpuset, int flags __hwloc_attribute_unused)
|
||||
{
|
||||
return dontset_return_complete_cpuset(topology, cpuset);
|
||||
}
|
||||
#ifdef hwloc_thread_t
|
||||
static int dontset_thread_cpubind(hwloc_topology_t topology __hwloc_attribute_unused, hwloc_thread_t tid __hwloc_attribute_unused, hwloc_const_bitmap_t set __hwloc_attribute_unused, int flags __hwloc_attribute_unused)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static int dontget_thread_cpubind(hwloc_topology_t topology __hwloc_attribute_unused, hwloc_thread_t tid __hwloc_attribute_unused, hwloc_bitmap_t cpuset, int flags __hwloc_attribute_unused)
|
||||
{
|
||||
return dontset_return_complete_cpuset(topology, cpuset);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int dontset_return_complete_nodeset(hwloc_topology_t topology, hwloc_nodeset_t set, hwloc_membind_policy_t *policy)
|
||||
{
|
||||
hwloc_bitmap_copy(set, hwloc_topology_get_complete_nodeset(topology));
|
||||
*policy = HWLOC_MEMBIND_MIXED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dontset_thisproc_membind(hwloc_topology_t topology __hwloc_attribute_unused, hwloc_const_bitmap_t set __hwloc_attribute_unused, hwloc_membind_policy_t policy __hwloc_attribute_unused, int flags __hwloc_attribute_unused)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static int dontget_thisproc_membind(hwloc_topology_t topology __hwloc_attribute_unused, hwloc_bitmap_t set, hwloc_membind_policy_t * policy, int flags __hwloc_attribute_unused)
|
||||
{
|
||||
return dontset_return_complete_nodeset(topology, set, policy);
|
||||
}
|
||||
|
||||
static int dontset_thisthread_membind(hwloc_topology_t topology __hwloc_attribute_unused, hwloc_const_bitmap_t set __hwloc_attribute_unused, hwloc_membind_policy_t policy __hwloc_attribute_unused, int flags __hwloc_attribute_unused)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static int dontget_thisthread_membind(hwloc_topology_t topology __hwloc_attribute_unused, hwloc_bitmap_t set, hwloc_membind_policy_t * policy, int flags __hwloc_attribute_unused)
|
||||
{
|
||||
return dontset_return_complete_nodeset(topology, set, policy);
|
||||
}
|
||||
|
||||
static int dontset_proc_membind(hwloc_topology_t topology __hwloc_attribute_unused, hwloc_pid_t pid __hwloc_attribute_unused, hwloc_const_bitmap_t set __hwloc_attribute_unused, hwloc_membind_policy_t policy __hwloc_attribute_unused, int flags __hwloc_attribute_unused)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static int dontget_proc_membind(hwloc_topology_t topology __hwloc_attribute_unused, hwloc_pid_t pid __hwloc_attribute_unused, hwloc_bitmap_t set, hwloc_membind_policy_t * policy, int flags __hwloc_attribute_unused)
|
||||
{
|
||||
return dontset_return_complete_nodeset(topology, set, policy);
|
||||
}
|
||||
|
||||
static int dontset_area_membind(hwloc_topology_t topology __hwloc_attribute_unused, const void *addr __hwloc_attribute_unused, size_t size __hwloc_attribute_unused, hwloc_const_bitmap_t set __hwloc_attribute_unused, hwloc_membind_policy_t policy __hwloc_attribute_unused, int flags __hwloc_attribute_unused)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static int dontget_area_membind(hwloc_topology_t topology __hwloc_attribute_unused, const void *addr __hwloc_attribute_unused, size_t size __hwloc_attribute_unused, hwloc_bitmap_t set, hwloc_membind_policy_t * policy, int flags __hwloc_attribute_unused)
|
||||
{
|
||||
return dontset_return_complete_nodeset(topology, set, policy);
|
||||
}
|
||||
static int dontget_area_memlocation(hwloc_topology_t topology __hwloc_attribute_unused, const void *addr __hwloc_attribute_unused, size_t size __hwloc_attribute_unused, hwloc_bitmap_t set, int flags __hwloc_attribute_unused)
|
||||
{
|
||||
hwloc_membind_policy_t policy;
|
||||
return dontset_return_complete_nodeset(topology, set, &policy);
|
||||
}
|
||||
|
||||
static void * dontalloc_membind(hwloc_topology_t topology __hwloc_attribute_unused, size_t size __hwloc_attribute_unused, hwloc_const_bitmap_t set __hwloc_attribute_unused, hwloc_membind_policy_t policy __hwloc_attribute_unused, int flags __hwloc_attribute_unused)
|
||||
{
|
||||
return malloc(size);
|
||||
}
|
||||
static int dontfree_membind(hwloc_topology_t topology __hwloc_attribute_unused, void *addr __hwloc_attribute_unused, size_t size __hwloc_attribute_unused)
|
||||
{
|
||||
free(addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hwloc_set_dummy_hooks(struct hwloc_binding_hooks *hooks,
|
||||
struct hwloc_topology_support *support __hwloc_attribute_unused)
|
||||
{
|
||||
hooks->set_thisproc_cpubind = dontset_thisproc_cpubind;
|
||||
hooks->get_thisproc_cpubind = dontget_thisproc_cpubind;
|
||||
hooks->set_thisthread_cpubind = dontset_thisthread_cpubind;
|
||||
hooks->get_thisthread_cpubind = dontget_thisthread_cpubind;
|
||||
hooks->set_proc_cpubind = dontset_proc_cpubind;
|
||||
hooks->get_proc_cpubind = dontget_proc_cpubind;
|
||||
#ifdef hwloc_thread_t
|
||||
hooks->set_thread_cpubind = dontset_thread_cpubind;
|
||||
hooks->get_thread_cpubind = dontget_thread_cpubind;
|
||||
#endif
|
||||
hooks->get_thisproc_last_cpu_location = dontget_thisproc_cpubind; /* cpubind instead of last_cpu_location is ok */
|
||||
hooks->get_thisthread_last_cpu_location = dontget_thisthread_cpubind; /* cpubind instead of last_cpu_location is ok */
|
||||
hooks->get_proc_last_cpu_location = dontget_proc_cpubind; /* cpubind instead of last_cpu_location is ok */
|
||||
/* TODO: get_thread_last_cpu_location */
|
||||
hooks->set_thisproc_membind = dontset_thisproc_membind;
|
||||
hooks->get_thisproc_membind = dontget_thisproc_membind;
|
||||
hooks->set_thisthread_membind = dontset_thisthread_membind;
|
||||
hooks->get_thisthread_membind = dontget_thisthread_membind;
|
||||
hooks->set_proc_membind = dontset_proc_membind;
|
||||
hooks->get_proc_membind = dontget_proc_membind;
|
||||
hooks->set_area_membind = dontset_area_membind;
|
||||
hooks->get_area_membind = dontget_area_membind;
|
||||
hooks->get_area_memlocation = dontget_area_memlocation;
|
||||
hooks->alloc_membind = dontalloc_membind;
|
||||
hooks->free_membind = dontfree_membind;
|
||||
}
|
||||
|
||||
void
|
||||
hwloc_set_native_binding_hooks(struct hwloc_binding_hooks *hooks, struct hwloc_topology_support *support)
|
||||
{
|
||||
# ifdef HWLOC_LINUX_SYS
|
||||
hwloc_set_linuxfs_hooks(hooks, support);
|
||||
# endif /* HWLOC_LINUX_SYS */
|
||||
|
||||
# ifdef HWLOC_BGQ_SYS
|
||||
hwloc_set_bgq_hooks(hooks, support);
|
||||
# endif /* HWLOC_BGQ_SYS */
|
||||
|
||||
# ifdef HWLOC_AIX_SYS
|
||||
hwloc_set_aix_hooks(hooks, support);
|
||||
# endif /* HWLOC_AIX_SYS */
|
||||
|
||||
# ifdef HWLOC_SOLARIS_SYS
|
||||
hwloc_set_solaris_hooks(hooks, support);
|
||||
# endif /* HWLOC_SOLARIS_SYS */
|
||||
|
||||
# ifdef HWLOC_WIN_SYS
|
||||
hwloc_set_windows_hooks(hooks, support);
|
||||
# endif /* HWLOC_WIN_SYS */
|
||||
|
||||
# ifdef HWLOC_DARWIN_SYS
|
||||
hwloc_set_darwin_hooks(hooks, support);
|
||||
# endif /* HWLOC_DARWIN_SYS */
|
||||
|
||||
# ifdef HWLOC_FREEBSD_SYS
|
||||
hwloc_set_freebsd_hooks(hooks, support);
|
||||
# endif /* HWLOC_FREEBSD_SYS */
|
||||
|
||||
# ifdef HWLOC_NETBSD_SYS
|
||||
hwloc_set_netbsd_hooks(hooks, support);
|
||||
# endif /* HWLOC_NETBSD_SYS */
|
||||
|
||||
# ifdef HWLOC_HPUX_SYS
|
||||
hwloc_set_hpux_hooks(hooks, support);
|
||||
# endif /* HWLOC_HPUX_SYS */
|
||||
}
|
||||
|
||||
/* If the represented system is actually not this system, use dummy binding hooks. */
|
||||
void
|
||||
hwloc_set_binding_hooks(struct hwloc_topology *topology)
|
||||
{
|
||||
if (topology->is_thissystem) {
|
||||
hwloc_set_native_binding_hooks(&topology->binding_hooks, &topology->support);
|
||||
/* every hook not set above will return ENOSYS */
|
||||
} else {
|
||||
/* not this system, use dummy binding hooks that do nothing (but don't return ENOSYS) */
|
||||
hwloc_set_dummy_hooks(&topology->binding_hooks, &topology->support);
|
||||
|
||||
/* Linux has some hooks that also work in this case, but they are not strictly needed yet. */
|
||||
}
|
||||
|
||||
/* if not is_thissystem, set_cpubind is fake
|
||||
* and get_cpubind returns the whole system cpuset,
|
||||
* so don't report that set/get_cpubind as supported
|
||||
*/
|
||||
if (topology->is_thissystem) {
|
||||
#define DO(which,kind) \
|
||||
if (topology->binding_hooks.kind) \
|
||||
topology->support.which##bind->kind = 1;
|
||||
DO(cpu,set_thisproc_cpubind);
|
||||
DO(cpu,get_thisproc_cpubind);
|
||||
DO(cpu,set_proc_cpubind);
|
||||
DO(cpu,get_proc_cpubind);
|
||||
DO(cpu,set_thisthread_cpubind);
|
||||
DO(cpu,get_thisthread_cpubind);
|
||||
#ifdef hwloc_thread_t
|
||||
DO(cpu,set_thread_cpubind);
|
||||
DO(cpu,get_thread_cpubind);
|
||||
#endif
|
||||
DO(cpu,get_thisproc_last_cpu_location);
|
||||
DO(cpu,get_proc_last_cpu_location);
|
||||
DO(cpu,get_thisthread_last_cpu_location);
|
||||
DO(mem,set_thisproc_membind);
|
||||
DO(mem,get_thisproc_membind);
|
||||
DO(mem,set_thisthread_membind);
|
||||
DO(mem,get_thisthread_membind);
|
||||
DO(mem,set_proc_membind);
|
||||
DO(mem,get_proc_membind);
|
||||
DO(mem,set_area_membind);
|
||||
DO(mem,get_area_membind);
|
||||
DO(mem,get_area_memlocation);
|
||||
DO(mem,alloc_membind);
|
||||
}
|
||||
}
|
||||
1717
src/3rdparty/hwloc/src/bitmap.c
vendored
1717
src/3rdparty/hwloc/src/bitmap.c
vendored
File diff suppressed because it is too large
Load Diff
1086
src/3rdparty/hwloc/src/components.c
vendored
1086
src/3rdparty/hwloc/src/components.c
vendored
File diff suppressed because it is too large
Load Diff
497
src/3rdparty/hwloc/src/diff.c
vendored
497
src/3rdparty/hwloc/src/diff.c
vendored
@@ -1,497 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013-2019 Inria. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
#include "private/autogen/config.h"
|
||||
#include "private/private.h"
|
||||
#include "private/misc.h"
|
||||
|
||||
int hwloc_topology_diff_destroy(hwloc_topology_diff_t diff)
|
||||
{
|
||||
hwloc_topology_diff_t next;
|
||||
while (diff) {
|
||||
next = diff->generic.next;
|
||||
switch (diff->generic.type) {
|
||||
default:
|
||||
break;
|
||||
case HWLOC_TOPOLOGY_DIFF_OBJ_ATTR:
|
||||
switch (diff->obj_attr.diff.generic.type) {
|
||||
default:
|
||||
break;
|
||||
case HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_NAME:
|
||||
case HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_INFO:
|
||||
free(diff->obj_attr.diff.string.name);
|
||||
free(diff->obj_attr.diff.string.oldvalue);
|
||||
free(diff->obj_attr.diff.string.newvalue);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
free(diff);
|
||||
diff = next;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/************************
|
||||
* Computing diffs
|
||||
*/
|
||||
|
||||
static void hwloc_append_diff(hwloc_topology_diff_t newdiff,
|
||||
hwloc_topology_diff_t *firstdiffp,
|
||||
hwloc_topology_diff_t *lastdiffp)
|
||||
{
|
||||
if (*firstdiffp)
|
||||
(*lastdiffp)->generic.next = newdiff;
|
||||
else
|
||||
*firstdiffp = newdiff;
|
||||
*lastdiffp = newdiff;
|
||||
newdiff->generic.next = NULL;
|
||||
}
|
||||
|
||||
static int hwloc_append_diff_too_complex(hwloc_obj_t obj1,
|
||||
hwloc_topology_diff_t *firstdiffp,
|
||||
hwloc_topology_diff_t *lastdiffp)
|
||||
{
|
||||
hwloc_topology_diff_t newdiff;
|
||||
newdiff = malloc(sizeof(*newdiff));
|
||||
if (!newdiff)
|
||||
return -1;
|
||||
|
||||
newdiff->too_complex.type = HWLOC_TOPOLOGY_DIFF_TOO_COMPLEX;
|
||||
newdiff->too_complex.obj_depth = obj1->depth;
|
||||
newdiff->too_complex.obj_index = obj1->logical_index;
|
||||
hwloc_append_diff(newdiff, firstdiffp, lastdiffp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hwloc_append_diff_obj_attr_string(hwloc_obj_t obj,
|
||||
hwloc_topology_diff_obj_attr_type_t type,
|
||||
const char *name,
|
||||
const char *oldvalue,
|
||||
const char *newvalue,
|
||||
hwloc_topology_diff_t *firstdiffp,
|
||||
hwloc_topology_diff_t *lastdiffp)
|
||||
{
|
||||
hwloc_topology_diff_t newdiff;
|
||||
newdiff = malloc(sizeof(*newdiff));
|
||||
if (!newdiff)
|
||||
return -1;
|
||||
|
||||
newdiff->obj_attr.type = HWLOC_TOPOLOGY_DIFF_OBJ_ATTR;
|
||||
newdiff->obj_attr.obj_depth = obj->depth;
|
||||
newdiff->obj_attr.obj_index = obj->logical_index;
|
||||
newdiff->obj_attr.diff.string.type = type;
|
||||
newdiff->obj_attr.diff.string.name = name ? strdup(name) : NULL;
|
||||
newdiff->obj_attr.diff.string.oldvalue = oldvalue ? strdup(oldvalue) : NULL;
|
||||
newdiff->obj_attr.diff.string.newvalue = newvalue ? strdup(newvalue) : NULL;
|
||||
hwloc_append_diff(newdiff, firstdiffp, lastdiffp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hwloc_append_diff_obj_attr_uint64(hwloc_obj_t obj,
|
||||
hwloc_topology_diff_obj_attr_type_t type,
|
||||
hwloc_uint64_t idx,
|
||||
hwloc_uint64_t oldvalue,
|
||||
hwloc_uint64_t newvalue,
|
||||
hwloc_topology_diff_t *firstdiffp,
|
||||
hwloc_topology_diff_t *lastdiffp)
|
||||
{
|
||||
hwloc_topology_diff_t newdiff;
|
||||
newdiff = malloc(sizeof(*newdiff));
|
||||
if (!newdiff)
|
||||
return -1;
|
||||
|
||||
newdiff->obj_attr.type = HWLOC_TOPOLOGY_DIFF_OBJ_ATTR;
|
||||
newdiff->obj_attr.obj_depth = obj->depth;
|
||||
newdiff->obj_attr.obj_index = obj->logical_index;
|
||||
newdiff->obj_attr.diff.uint64.type = type;
|
||||
newdiff->obj_attr.diff.uint64.index = idx;
|
||||
newdiff->obj_attr.diff.uint64.oldvalue = oldvalue;
|
||||
newdiff->obj_attr.diff.uint64.newvalue = newvalue;
|
||||
hwloc_append_diff(newdiff, firstdiffp, lastdiffp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
hwloc_diff_trees(hwloc_topology_t topo1, hwloc_obj_t obj1,
|
||||
hwloc_topology_t topo2, hwloc_obj_t obj2,
|
||||
unsigned flags,
|
||||
hwloc_topology_diff_t *firstdiffp, hwloc_topology_diff_t *lastdiffp)
|
||||
{
|
||||
unsigned i;
|
||||
int err;
|
||||
hwloc_obj_t child1, child2;
|
||||
|
||||
if (obj1->depth != obj2->depth)
|
||||
goto out_too_complex;
|
||||
|
||||
if (obj1->type != obj2->type)
|
||||
goto out_too_complex;
|
||||
if ((!obj1->subtype) != (!obj2->subtype)
|
||||
|| (obj1->subtype && strcmp(obj1->subtype, obj2->subtype)))
|
||||
goto out_too_complex;
|
||||
|
||||
if (obj1->os_index != obj2->os_index)
|
||||
/* we could allow different os_index for non-PU non-NUMAnode objects
|
||||
* but it's likely useless anyway */
|
||||
goto out_too_complex;
|
||||
|
||||
#define _SETS_DIFFERENT(_set1, _set2) \
|
||||
( ( !(_set1) != !(_set2) ) \
|
||||
|| ( (_set1) && !hwloc_bitmap_isequal(_set1, _set2) ) )
|
||||
#define SETS_DIFFERENT(_set, _obj1, _obj2) _SETS_DIFFERENT((_obj1)->_set, (_obj2)->_set)
|
||||
if (SETS_DIFFERENT(cpuset, obj1, obj2)
|
||||
|| SETS_DIFFERENT(complete_cpuset, obj1, obj2)
|
||||
|| SETS_DIFFERENT(nodeset, obj1, obj2)
|
||||
|| SETS_DIFFERENT(complete_nodeset, obj1, obj2))
|
||||
goto out_too_complex;
|
||||
|
||||
/* no need to check logical_index, sibling_rank, symmetric_subtree,
|
||||
* the parents did it */
|
||||
|
||||
/* gp_index don't have to be strictly identical */
|
||||
|
||||
if ((!obj1->name) != (!obj2->name)
|
||||
|| (obj1->name && strcmp(obj1->name, obj2->name))) {
|
||||
err = hwloc_append_diff_obj_attr_string(obj1,
|
||||
HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_NAME,
|
||||
NULL,
|
||||
obj1->name,
|
||||
obj2->name,
|
||||
firstdiffp, lastdiffp);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
|
||||
/* type-specific attrs */
|
||||
switch (obj1->type) {
|
||||
default:
|
||||
break;
|
||||
case HWLOC_OBJ_NUMANODE:
|
||||
if (obj1->attr->numanode.local_memory != obj2->attr->numanode.local_memory) {
|
||||
err = hwloc_append_diff_obj_attr_uint64(obj1,
|
||||
HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_SIZE,
|
||||
0,
|
||||
obj1->attr->numanode.local_memory,
|
||||
obj2->attr->numanode.local_memory,
|
||||
firstdiffp, lastdiffp);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
/* ignore memory page_types */
|
||||
break;
|
||||
case HWLOC_OBJ_L1CACHE:
|
||||
case HWLOC_OBJ_L2CACHE:
|
||||
case HWLOC_OBJ_L3CACHE:
|
||||
case HWLOC_OBJ_L4CACHE:
|
||||
case HWLOC_OBJ_L5CACHE:
|
||||
case HWLOC_OBJ_L1ICACHE:
|
||||
case HWLOC_OBJ_L2ICACHE:
|
||||
case HWLOC_OBJ_L3ICACHE:
|
||||
if (memcmp(obj1->attr, obj2->attr, sizeof(obj1->attr->cache)))
|
||||
goto out_too_complex;
|
||||
break;
|
||||
case HWLOC_OBJ_GROUP:
|
||||
if (memcmp(obj1->attr, obj2->attr, sizeof(obj1->attr->group)))
|
||||
goto out_too_complex;
|
||||
break;
|
||||
case HWLOC_OBJ_PCI_DEVICE:
|
||||
if (memcmp(obj1->attr, obj2->attr, sizeof(obj1->attr->pcidev)))
|
||||
goto out_too_complex;
|
||||
break;
|
||||
case HWLOC_OBJ_BRIDGE:
|
||||
if (memcmp(obj1->attr, obj2->attr, sizeof(obj1->attr->bridge)))
|
||||
goto out_too_complex;
|
||||
break;
|
||||
case HWLOC_OBJ_OS_DEVICE:
|
||||
if (memcmp(obj1->attr, obj2->attr, sizeof(obj1->attr->osdev)))
|
||||
goto out_too_complex;
|
||||
break;
|
||||
}
|
||||
|
||||
/* infos */
|
||||
if (obj1->infos_count != obj2->infos_count)
|
||||
goto out_too_complex;
|
||||
for(i=0; i<obj1->infos_count; i++) {
|
||||
struct hwloc_info_s *info1 = &obj1->infos[i], *info2 = &obj2->infos[i];
|
||||
if (strcmp(info1->name, info2->name))
|
||||
goto out_too_complex;
|
||||
if (strcmp(obj1->infos[i].value, obj2->infos[i].value)) {
|
||||
err = hwloc_append_diff_obj_attr_string(obj1,
|
||||
HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_INFO,
|
||||
info1->name,
|
||||
info1->value,
|
||||
info2->value,
|
||||
firstdiffp, lastdiffp);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
/* ignore userdata */
|
||||
|
||||
/* children */
|
||||
for(child1 = obj1->first_child, child2 = obj2->first_child;
|
||||
child1 != NULL && child2 != NULL;
|
||||
child1 = child1->next_sibling, child2 = child2->next_sibling) {
|
||||
err = hwloc_diff_trees(topo1, child1,
|
||||
topo2, child2,
|
||||
flags,
|
||||
firstdiffp, lastdiffp);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
if (child1 || child2)
|
||||
goto out_too_complex;
|
||||
|
||||
/* memory children */
|
||||
for(child1 = obj1->memory_first_child, child2 = obj2->memory_first_child;
|
||||
child1 != NULL && child2 != NULL;
|
||||
child1 = child1->next_sibling, child2 = child2->next_sibling) {
|
||||
err = hwloc_diff_trees(topo1, child1,
|
||||
topo2, child2,
|
||||
flags,
|
||||
firstdiffp, lastdiffp);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
if (child1 || child2)
|
||||
goto out_too_complex;
|
||||
|
||||
/* I/O children */
|
||||
for(child1 = obj1->io_first_child, child2 = obj2->io_first_child;
|
||||
child1 != NULL && child2 != NULL;
|
||||
child1 = child1->next_sibling, child2 = child2->next_sibling) {
|
||||
err = hwloc_diff_trees(topo1, child1,
|
||||
topo2, child2,
|
||||
flags,
|
||||
firstdiffp, lastdiffp);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
if (child1 || child2)
|
||||
goto out_too_complex;
|
||||
|
||||
/* misc children */
|
||||
for(child1 = obj1->misc_first_child, child2 = obj2->misc_first_child;
|
||||
child1 != NULL && child2 != NULL;
|
||||
child1 = child1->next_sibling, child2 = child2->next_sibling) {
|
||||
err = hwloc_diff_trees(topo1, child1,
|
||||
topo2, child2,
|
||||
flags,
|
||||
firstdiffp, lastdiffp);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
if (child1 || child2)
|
||||
goto out_too_complex;
|
||||
|
||||
return 0;
|
||||
|
||||
out_too_complex:
|
||||
hwloc_append_diff_too_complex(obj1, firstdiffp, lastdiffp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hwloc_topology_diff_build(hwloc_topology_t topo1,
|
||||
hwloc_topology_t topo2,
|
||||
unsigned long flags,
|
||||
hwloc_topology_diff_t *diffp)
|
||||
{
|
||||
hwloc_topology_diff_t lastdiff, tmpdiff;
|
||||
struct hwloc_internal_distances_s *dist1, *dist2;
|
||||
unsigned i;
|
||||
int err;
|
||||
|
||||
if (!topo1->is_loaded || !topo2->is_loaded) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (flags != 0) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
*diffp = NULL;
|
||||
err = hwloc_diff_trees(topo1, hwloc_get_root_obj(topo1),
|
||||
topo2, hwloc_get_root_obj(topo2),
|
||||
flags,
|
||||
diffp, &lastdiff);
|
||||
if (!err) {
|
||||
tmpdiff = *diffp;
|
||||
while (tmpdiff) {
|
||||
if (tmpdiff->generic.type == HWLOC_TOPOLOGY_DIFF_TOO_COMPLEX) {
|
||||
err = 1;
|
||||
break;
|
||||
}
|
||||
tmpdiff = tmpdiff->generic.next;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
if (SETS_DIFFERENT(allowed_cpuset, topo1, topo2)
|
||||
|| SETS_DIFFERENT(allowed_nodeset, topo1, topo2)) {
|
||||
hwloc_append_diff_too_complex(hwloc_get_root_obj(topo1), diffp, &lastdiff);
|
||||
err = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
/* distances */
|
||||
hwloc_internal_distances_refresh(topo1);
|
||||
hwloc_internal_distances_refresh(topo2);
|
||||
dist1 = topo1->first_dist;
|
||||
dist2 = topo2->first_dist;
|
||||
while (dist1 || dist2) {
|
||||
if (!!dist1 != !!dist2) {
|
||||
hwloc_append_diff_too_complex(hwloc_get_root_obj(topo1), diffp, &lastdiff);
|
||||
err = 1;
|
||||
break;
|
||||
}
|
||||
if (dist1->unique_type != dist2->unique_type
|
||||
|| dist1->different_types || dist2->different_types /* too lazy to support this case */
|
||||
|| dist1->nbobjs != dist2->nbobjs
|
||||
|| dist1->kind != dist2->kind
|
||||
|| memcmp(dist1->values, dist2->values, dist1->nbobjs * dist1->nbobjs * sizeof(*dist1->values))) {
|
||||
hwloc_append_diff_too_complex(hwloc_get_root_obj(topo1), diffp, &lastdiff);
|
||||
err = 1;
|
||||
break;
|
||||
}
|
||||
for(i=0; i<dist1->nbobjs; i++)
|
||||
/* gp_index isn't enforced above. so compare logical_index instead, which is enforced. requires distances refresh() above */
|
||||
if (dist1->objs[i]->logical_index != dist2->objs[i]->logical_index) {
|
||||
hwloc_append_diff_too_complex(hwloc_get_root_obj(topo1), diffp, &lastdiff);
|
||||
err = 1;
|
||||
break;
|
||||
}
|
||||
dist1 = dist1->next;
|
||||
dist2 = dist2->next;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/********************
|
||||
* Applying diffs
|
||||
*/
|
||||
|
||||
static int
|
||||
hwloc_apply_diff_one(hwloc_topology_t topology,
|
||||
hwloc_topology_diff_t diff,
|
||||
unsigned long flags)
|
||||
{
|
||||
int reverse = !!(flags & HWLOC_TOPOLOGY_DIFF_APPLY_REVERSE);
|
||||
|
||||
switch (diff->generic.type) {
|
||||
case HWLOC_TOPOLOGY_DIFF_OBJ_ATTR: {
|
||||
struct hwloc_topology_diff_obj_attr_s *obj_attr = &diff->obj_attr;
|
||||
hwloc_obj_t obj = hwloc_get_obj_by_depth(topology, obj_attr->obj_depth, obj_attr->obj_index);
|
||||
if (!obj)
|
||||
return -1;
|
||||
|
||||
switch (obj_attr->diff.generic.type) {
|
||||
case HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_SIZE: {
|
||||
hwloc_obj_t tmpobj;
|
||||
hwloc_uint64_t oldvalue = reverse ? obj_attr->diff.uint64.newvalue : obj_attr->diff.uint64.oldvalue;
|
||||
hwloc_uint64_t newvalue = reverse ? obj_attr->diff.uint64.oldvalue : obj_attr->diff.uint64.newvalue;
|
||||
hwloc_uint64_t valuediff = newvalue - oldvalue;
|
||||
if (obj->type != HWLOC_OBJ_NUMANODE)
|
||||
return -1;
|
||||
if (obj->attr->numanode.local_memory != oldvalue)
|
||||
return -1;
|
||||
obj->attr->numanode.local_memory = newvalue;
|
||||
tmpobj = obj;
|
||||
while (tmpobj) {
|
||||
tmpobj->total_memory += valuediff;
|
||||
tmpobj = tmpobj->parent;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_NAME: {
|
||||
const char *oldvalue = reverse ? obj_attr->diff.string.newvalue : obj_attr->diff.string.oldvalue;
|
||||
const char *newvalue = reverse ? obj_attr->diff.string.oldvalue : obj_attr->diff.string.newvalue;
|
||||
if (!obj->name || strcmp(obj->name, oldvalue))
|
||||
return -1;
|
||||
free(obj->name);
|
||||
obj->name = strdup(newvalue);
|
||||
break;
|
||||
}
|
||||
case HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_INFO: {
|
||||
const char *name = obj_attr->diff.string.name;
|
||||
const char *oldvalue = reverse ? obj_attr->diff.string.newvalue : obj_attr->diff.string.oldvalue;
|
||||
const char *newvalue = reverse ? obj_attr->diff.string.oldvalue : obj_attr->diff.string.newvalue;
|
||||
unsigned i;
|
||||
int found = 0;
|
||||
for(i=0; i<obj->infos_count; i++) {
|
||||
struct hwloc_info_s *info = &obj->infos[i];
|
||||
if (!strcmp(info->name, name)
|
||||
&& !strcmp(info->value, oldvalue)) {
|
||||
free(info->value);
|
||||
info->value = strdup(newvalue);
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hwloc_topology_diff_apply(hwloc_topology_t topology,
|
||||
hwloc_topology_diff_t diff,
|
||||
unsigned long flags)
|
||||
{
|
||||
hwloc_topology_diff_t tmpdiff, tmpdiff2;
|
||||
int err, nr;
|
||||
|
||||
if (!topology->is_loaded) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (topology->adopted_shmem_addr) {
|
||||
errno = EPERM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (flags & ~HWLOC_TOPOLOGY_DIFF_APPLY_REVERSE) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
tmpdiff = diff;
|
||||
nr = 0;
|
||||
while (tmpdiff) {
|
||||
nr++;
|
||||
err = hwloc_apply_diff_one(topology, tmpdiff, flags);
|
||||
if (err < 0)
|
||||
goto cancel;
|
||||
tmpdiff = tmpdiff->generic.next;
|
||||
}
|
||||
return 0;
|
||||
|
||||
cancel:
|
||||
tmpdiff2 = tmpdiff;
|
||||
tmpdiff = diff;
|
||||
while (tmpdiff != tmpdiff2) {
|
||||
hwloc_apply_diff_one(topology, tmpdiff, flags ^ HWLOC_TOPOLOGY_DIFF_APPLY_REVERSE);
|
||||
tmpdiff = tmpdiff->generic.next;
|
||||
}
|
||||
errno = EINVAL;
|
||||
return -nr; /* return the index (starting at 1) of the first element that couldn't be applied */
|
||||
}
|
||||
1139
src/3rdparty/hwloc/src/distances.c
vendored
1139
src/3rdparty/hwloc/src/distances.c
vendored
File diff suppressed because it is too large
Load Diff
153
src/3rdparty/hwloc/src/misc.c
vendored
153
src/3rdparty/hwloc/src/misc.c
vendored
@@ -1,153 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2018 Inria. All rights reserved.
|
||||
* Copyright © 2009-2010 Université Bordeaux
|
||||
* Copyright © 2009-2018 Cisco Systems, Inc. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
#include "private/autogen/config.h"
|
||||
#include "private/private.h"
|
||||
#include "private/misc.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#ifdef HAVE_SYS_UTSNAME_H
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_PROGRAM_INVOCATION_NAME
|
||||
#include <errno.h>
|
||||
extern char *program_invocation_name;
|
||||
#endif
|
||||
#ifdef HAVE___PROGNAME
|
||||
extern char *__progname;
|
||||
#endif
|
||||
|
||||
#ifndef HWLOC_HAVE_CORRECT_SNPRINTF
|
||||
int hwloc_snprintf(char *str, size_t size, const char *format, ...)
|
||||
{
|
||||
int ret;
|
||||
va_list ap;
|
||||
static char bin;
|
||||
size_t fakesize;
|
||||
char *fakestr;
|
||||
|
||||
/* Some systems crash on str == NULL */
|
||||
if (!size) {
|
||||
str = &bin;
|
||||
size = 1;
|
||||
}
|
||||
|
||||
va_start(ap, format);
|
||||
ret = vsnprintf(str, size, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (ret >= 0 && (size_t) ret != size-1)
|
||||
return ret;
|
||||
|
||||
/* vsnprintf returned size-1 or -1. That could be a system which reports the
|
||||
* written data and not the actually required room. Try increasing buffer
|
||||
* size to get the latter. */
|
||||
|
||||
fakesize = size;
|
||||
fakestr = NULL;
|
||||
do {
|
||||
fakesize *= 2;
|
||||
free(fakestr);
|
||||
fakestr = malloc(fakesize);
|
||||
if (NULL == fakestr)
|
||||
return -1;
|
||||
va_start(ap, format);
|
||||
errno = 0;
|
||||
ret = vsnprintf(fakestr, fakesize, format, ap);
|
||||
va_end(ap);
|
||||
} while ((size_t) ret == fakesize-1 || (ret < 0 && (!errno || errno == ERANGE)));
|
||||
|
||||
if (ret >= 0 && size) {
|
||||
if (size > (size_t) ret+1)
|
||||
size = ret+1;
|
||||
memcpy(str, fakestr, size-1);
|
||||
str[size-1] = 0;
|
||||
}
|
||||
free(fakestr);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
void hwloc_add_uname_info(struct hwloc_topology *topology __hwloc_attribute_unused,
|
||||
void *cached_uname __hwloc_attribute_unused)
|
||||
{
|
||||
#ifdef HAVE_UNAME
|
||||
struct utsname _utsname, *utsname;
|
||||
|
||||
if (hwloc_obj_get_info_by_name(topology->levels[0][0], "OSName"))
|
||||
/* don't annotate twice */
|
||||
return;
|
||||
|
||||
if (cached_uname)
|
||||
utsname = (struct utsname *) cached_uname;
|
||||
else {
|
||||
utsname = &_utsname;
|
||||
if (uname(utsname) < 0)
|
||||
return;
|
||||
}
|
||||
|
||||
if (*utsname->sysname)
|
||||
hwloc_obj_add_info(topology->levels[0][0], "OSName", utsname->sysname);
|
||||
if (*utsname->release)
|
||||
hwloc_obj_add_info(topology->levels[0][0], "OSRelease", utsname->release);
|
||||
if (*utsname->version)
|
||||
hwloc_obj_add_info(topology->levels[0][0], "OSVersion", utsname->version);
|
||||
if (*utsname->nodename)
|
||||
hwloc_obj_add_info(topology->levels[0][0], "HostName", utsname->nodename);
|
||||
if (*utsname->machine)
|
||||
hwloc_obj_add_info(topology->levels[0][0], "Architecture", utsname->machine);
|
||||
#endif /* HAVE_UNAME */
|
||||
}
|
||||
|
||||
char *
|
||||
hwloc_progname(struct hwloc_topology *topology __hwloc_attribute_unused)
|
||||
{
|
||||
#if HAVE_DECL_GETMODULEFILENAME
|
||||
char name[256], *local_basename;
|
||||
unsigned res = GetModuleFileName(NULL, name, sizeof(name));
|
||||
if (res == sizeof(name) || !res)
|
||||
return NULL;
|
||||
local_basename = strrchr(name, '\\');
|
||||
if (!local_basename)
|
||||
local_basename = name;
|
||||
else
|
||||
local_basename++;
|
||||
return strdup(local_basename);
|
||||
#else /* !HAVE_GETMODULEFILENAME */
|
||||
const char *name, *local_basename;
|
||||
#if HAVE_DECL_GETPROGNAME
|
||||
name = getprogname(); /* FreeBSD, NetBSD, some Solaris */
|
||||
#elif HAVE_DECL_GETEXECNAME
|
||||
name = getexecname(); /* Solaris */
|
||||
#elif defined HAVE_PROGRAM_INVOCATION_NAME
|
||||
name = program_invocation_name; /* Glibc. BGQ CNK. */
|
||||
/* could use program_invocation_short_name directly, but we have the code to remove the path below anyway */
|
||||
#elif defined HAVE___PROGNAME
|
||||
name = __progname; /* fallback for most unix, used for OpenBSD */
|
||||
#else
|
||||
/* TODO: _NSGetExecutablePath(path, &size) on Darwin */
|
||||
/* TODO: AIX, HPUX */
|
||||
name = NULL;
|
||||
#endif
|
||||
if (!name)
|
||||
return NULL;
|
||||
local_basename = strrchr(name, '/');
|
||||
if (!local_basename)
|
||||
local_basename = name;
|
||||
else
|
||||
local_basename++;
|
||||
return strdup(local_basename);
|
||||
#endif /* !HAVE_GETMODULEFILENAME */
|
||||
}
|
||||
1060
src/3rdparty/hwloc/src/pci-common.c
vendored
1060
src/3rdparty/hwloc/src/pci-common.c
vendored
File diff suppressed because it is too large
Load Diff
294
src/3rdparty/hwloc/src/shmem.c
vendored
294
src/3rdparty/hwloc/src/shmem.c
vendored
@@ -1,294 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2017-2019 Inria. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
#include "private/autogen/config.h"
|
||||
#include "hwloc.h"
|
||||
#include "hwloc/shmem.h"
|
||||
#include "private/private.h"
|
||||
|
||||
#ifndef HWLOC_WIN_SYS
|
||||
|
||||
#include <sys/mman.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#define HWLOC_SHMEM_HEADER_VERSION 1
|
||||
|
||||
struct hwloc_shmem_header {
|
||||
uint32_t header_version; /* sanity check */
|
||||
uint32_t header_length; /* where the actual topology starts in the file/mapping */
|
||||
uint64_t mmap_address; /* virtual address to pass to mmap */
|
||||
uint64_t mmap_length; /* length to pass to mmap (includes the header) */
|
||||
};
|
||||
|
||||
#define HWLOC_SHMEM_MALLOC_ALIGN 8UL
|
||||
|
||||
static void *
|
||||
tma_shmem_malloc(struct hwloc_tma * tma,
|
||||
size_t length)
|
||||
{
|
||||
void *current = tma->data;
|
||||
tma->data = (char*)tma->data + ((length + HWLOC_SHMEM_MALLOC_ALIGN - 1) & ~(HWLOC_SHMEM_MALLOC_ALIGN - 1));
|
||||
return current;
|
||||
|
||||
}
|
||||
|
||||
static void *
|
||||
tma_get_length_malloc(struct hwloc_tma * tma,
|
||||
size_t length)
|
||||
{
|
||||
size_t *tma_length = tma->data;
|
||||
*tma_length += (length + HWLOC_SHMEM_MALLOC_ALIGN - 1) & ~(HWLOC_SHMEM_MALLOC_ALIGN - 1);
|
||||
return malloc(length);
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_shmem_topology_get_length(hwloc_topology_t topology,
|
||||
size_t *lengthp,
|
||||
unsigned long flags)
|
||||
{
|
||||
hwloc_topology_t new;
|
||||
struct hwloc_tma tma;
|
||||
size_t length = 0;
|
||||
unsigned long pagesize = hwloc_getpagesize(); /* round-up to full page for mmap() */
|
||||
int err;
|
||||
|
||||
if (flags) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
tma.malloc = tma_get_length_malloc;
|
||||
tma.dontfree = 0;
|
||||
tma.data = &length;
|
||||
|
||||
err = hwloc__topology_dup(&new, topology, &tma);
|
||||
if (err < 0)
|
||||
return err;
|
||||
hwloc_topology_destroy(new);
|
||||
|
||||
*lengthp = (sizeof(struct hwloc_shmem_header) + length + pagesize - 1) & ~(pagesize - 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_shmem_topology_write(hwloc_topology_t topology,
|
||||
int fd, hwloc_uint64_t fileoffset,
|
||||
void *mmap_address, size_t length,
|
||||
unsigned long flags)
|
||||
{
|
||||
hwloc_topology_t new;
|
||||
struct hwloc_tma tma;
|
||||
struct hwloc_shmem_header header;
|
||||
void *mmap_res;
|
||||
int err;
|
||||
|
||||
if (flags) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* refresh old topology distances so that we don't uselessly duplicate invalid distances
|
||||
* without being able to free() them.
|
||||
*/
|
||||
hwloc_internal_distances_refresh(topology);
|
||||
|
||||
header.header_version = HWLOC_SHMEM_HEADER_VERSION;
|
||||
header.header_length = sizeof(header);
|
||||
header.mmap_address = (uintptr_t) mmap_address;
|
||||
header.mmap_length = length;
|
||||
|
||||
err = lseek(fd, fileoffset, SEEK_SET);
|
||||
if (err < 0)
|
||||
return -1;
|
||||
|
||||
err = write(fd, &header, sizeof(header));
|
||||
if (err != sizeof(header))
|
||||
return -1;
|
||||
|
||||
err = ftruncate(fd, fileoffset + length);
|
||||
if (err < 0)
|
||||
return -1;
|
||||
|
||||
mmap_res = mmap(mmap_address, length, PROT_READ|PROT_WRITE, MAP_SHARED, fd, fileoffset);
|
||||
if (mmap_res == MAP_FAILED)
|
||||
return -1;
|
||||
if (mmap_res != mmap_address) {
|
||||
munmap(mmap_res, length);
|
||||
errno = EBUSY;
|
||||
return -1;
|
||||
}
|
||||
|
||||
tma.malloc = tma_shmem_malloc;
|
||||
tma.dontfree = 1;
|
||||
tma.data = (char *)mmap_res + sizeof(header);
|
||||
err = hwloc__topology_dup(&new, topology, &tma);
|
||||
if (err < 0)
|
||||
return err;
|
||||
assert((char*)new == (char*)mmap_address + sizeof(header));
|
||||
|
||||
assert((char *)mmap_res <= (char *)mmap_address + length);
|
||||
|
||||
/* now refresh the new distances so that adopters can use them without refreshing the R/O shmem mapping */
|
||||
hwloc_internal_distances_refresh(new);
|
||||
|
||||
/* topology is saved, release resources now */
|
||||
munmap(mmap_address, length);
|
||||
hwloc_components_fini();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_shmem_topology_adopt(hwloc_topology_t *topologyp,
|
||||
int fd, hwloc_uint64_t fileoffset,
|
||||
void *mmap_address, size_t length,
|
||||
unsigned long flags)
|
||||
{
|
||||
hwloc_topology_t new, old;
|
||||
struct hwloc_shmem_header header;
|
||||
void *mmap_res;
|
||||
int err;
|
||||
|
||||
if (flags) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = lseek(fd, fileoffset, SEEK_SET);
|
||||
if (err < 0)
|
||||
return -1;
|
||||
|
||||
err = read(fd, &header, sizeof(header));
|
||||
if (err != sizeof(header))
|
||||
return -1;
|
||||
|
||||
if (header.header_version != HWLOC_SHMEM_HEADER_VERSION
|
||||
|| header.header_length != sizeof(header)
|
||||
|| header.mmap_address != (uintptr_t) mmap_address
|
||||
|| header.mmap_length != length) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
mmap_res = mmap(mmap_address, length, PROT_READ, MAP_SHARED, fd, fileoffset);
|
||||
if (mmap_res == MAP_FAILED)
|
||||
return -1;
|
||||
if (mmap_res != mmap_address) {
|
||||
errno = EBUSY;
|
||||
goto out_with_mmap;
|
||||
}
|
||||
|
||||
old = (hwloc_topology_t)((char*)mmap_address + sizeof(header));
|
||||
if (hwloc_topology_abi_check(old) < 0) {
|
||||
errno = EINVAL;
|
||||
goto out_with_mmap;
|
||||
}
|
||||
|
||||
/* enforced by dup() inside shmem_topology_write() */
|
||||
assert(old->is_loaded);
|
||||
assert(old->backends == NULL);
|
||||
assert(old->get_pci_busid_cpuset_backend == NULL);
|
||||
|
||||
hwloc_components_init();
|
||||
|
||||
/* duplicate the topology object so that we ca change use local binding_hooks
|
||||
* (those are likely not mapped at the same location in both processes).
|
||||
*/
|
||||
new = malloc(sizeof(struct hwloc_topology));
|
||||
if (!new)
|
||||
goto out_with_components;
|
||||
memcpy(new, old, sizeof(*old));
|
||||
new->tma = NULL;
|
||||
new->adopted_shmem_addr = mmap_address;
|
||||
new->adopted_shmem_length = length;
|
||||
new->topology_abi = HWLOC_TOPOLOGY_ABI;
|
||||
/* setting binding hooks will touch support arrays, so duplicate them too.
|
||||
* could avoid that by requesting a R/W mmap
|
||||
*/
|
||||
new->support.discovery = malloc(sizeof(*new->support.discovery));
|
||||
new->support.cpubind = malloc(sizeof(*new->support.cpubind));
|
||||
new->support.membind = malloc(sizeof(*new->support.membind));
|
||||
if (!new->support.discovery || !new->support.cpubind || !new->support.membind)
|
||||
goto out_with_support;
|
||||
memcpy(new->support.discovery, old->support.discovery, sizeof(*new->support.discovery));
|
||||
memcpy(new->support.cpubind, old->support.cpubind, sizeof(*new->support.cpubind));
|
||||
memcpy(new->support.membind, old->support.membind, sizeof(*new->support.membind));
|
||||
hwloc_set_binding_hooks(new);
|
||||
/* clear userdata callbacks pointing to the writer process' functions */
|
||||
new->userdata_export_cb = NULL;
|
||||
new->userdata_import_cb = NULL;
|
||||
|
||||
#ifndef HWLOC_DEBUG
|
||||
if (getenv("HWLOC_DEBUG_CHECK"))
|
||||
#endif
|
||||
hwloc_topology_check(new);
|
||||
|
||||
*topologyp = new;
|
||||
return 0;
|
||||
|
||||
out_with_support:
|
||||
free(new->support.discovery);
|
||||
free(new->support.cpubind);
|
||||
free(new->support.membind);
|
||||
free(new);
|
||||
out_with_components:
|
||||
hwloc_components_fini();
|
||||
out_with_mmap:
|
||||
munmap(mmap_res, length);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
hwloc__topology_disadopt(hwloc_topology_t topology)
|
||||
{
|
||||
hwloc_components_fini();
|
||||
munmap(topology->adopted_shmem_addr, topology->adopted_shmem_length);
|
||||
free(topology->support.discovery);
|
||||
free(topology->support.cpubind);
|
||||
free(topology->support.membind);
|
||||
free(topology);
|
||||
}
|
||||
|
||||
#else /* HWLOC_WIN_SYS */
|
||||
|
||||
int
|
||||
hwloc_shmem_topology_get_length(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||
size_t *lengthp __hwloc_attribute_unused,
|
||||
unsigned long flags __hwloc_attribute_unused)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_shmem_topology_write(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||
int fd __hwloc_attribute_unused, hwloc_uint64_t fileoffset __hwloc_attribute_unused,
|
||||
void *mmap_address __hwloc_attribute_unused, size_t length __hwloc_attribute_unused,
|
||||
unsigned long flags __hwloc_attribute_unused)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_shmem_topology_adopt(hwloc_topology_t *topologyp __hwloc_attribute_unused,
|
||||
int fd __hwloc_attribute_unused, hwloc_uint64_t fileoffset __hwloc_attribute_unused,
|
||||
void *mmap_address __hwloc_attribute_unused, size_t length __hwloc_attribute_unused,
|
||||
unsigned long flags __hwloc_attribute_unused)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
hwloc__topology_disadopt(hwloc_topology_t topology __hwloc_attribute_unused)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* HWLOC_WIN_SYS */
|
||||
15
src/3rdparty/hwloc/src/static-components.h
vendored
15
src/3rdparty/hwloc/src/static-components.h
vendored
@@ -1,15 +0,0 @@
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_noos_component;
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_xml_component;
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_synthetic_component;
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_xml_nolibxml_component;
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_windows_component;
|
||||
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_x86_component;
|
||||
static const struct hwloc_component * hwloc_static_components[] = {
|
||||
&hwloc_noos_component,
|
||||
&hwloc_xml_component,
|
||||
&hwloc_synthetic_component,
|
||||
&hwloc_xml_nolibxml_component,
|
||||
&hwloc_windows_component,
|
||||
&hwloc_x86_component,
|
||||
NULL
|
||||
};
|
||||
80
src/3rdparty/hwloc/src/topology-noos.c
vendored
80
src/3rdparty/hwloc/src/topology-noos.c
vendored
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2019 Inria. All rights reserved.
|
||||
* Copyright © 2009-2012, 2020 Université Bordeaux
|
||||
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
#include "private/autogen/config.h"
|
||||
#include "hwloc.h"
|
||||
#include "private/private.h"
|
||||
|
||||
static int
|
||||
hwloc_look_noos(struct hwloc_backend *backend, struct hwloc_disc_status *dstatus)
|
||||
{
|
||||
/*
|
||||
* This backend uses the underlying OS.
|
||||
* However we don't enforce topology->is_thissystem so that
|
||||
* we may still force use this backend when debugging with !thissystem.
|
||||
*/
|
||||
|
||||
struct hwloc_topology *topology = backend->topology;
|
||||
int64_t memsize;
|
||||
|
||||
assert(dstatus->phase == HWLOC_DISC_PHASE_CPU);
|
||||
|
||||
if (!topology->levels[0][0]->cpuset) {
|
||||
int nbprocs;
|
||||
/* Nobody (even the x86 backend) created objects yet, setup basic objects */
|
||||
|
||||
nbprocs = hwloc_fallback_nbprocessors(0);
|
||||
if (nbprocs >= 1)
|
||||
topology->support.discovery->pu = 1;
|
||||
else
|
||||
nbprocs = 1;
|
||||
hwloc_alloc_root_sets(topology->levels[0][0]);
|
||||
hwloc_setup_pu_level(topology, nbprocs);
|
||||
}
|
||||
|
||||
memsize = hwloc_fallback_memsize();
|
||||
if (memsize > 0)
|
||||
topology->machine_memory.local_memory = memsize;;
|
||||
|
||||
hwloc_add_uname_info(topology, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct hwloc_backend *
|
||||
hwloc_noos_component_instantiate(struct hwloc_topology *topology,
|
||||
struct hwloc_disc_component *component,
|
||||
unsigned excluded_phases __hwloc_attribute_unused,
|
||||
const void *_data1 __hwloc_attribute_unused,
|
||||
const void *_data2 __hwloc_attribute_unused,
|
||||
const void *_data3 __hwloc_attribute_unused)
|
||||
{
|
||||
struct hwloc_backend *backend;
|
||||
backend = hwloc_backend_alloc(topology, component);
|
||||
if (!backend)
|
||||
return NULL;
|
||||
backend->discover = hwloc_look_noos;
|
||||
return backend;
|
||||
}
|
||||
|
||||
static struct hwloc_disc_component hwloc_noos_disc_component = {
|
||||
"no_os",
|
||||
HWLOC_DISC_PHASE_CPU,
|
||||
HWLOC_DISC_PHASE_GLOBAL,
|
||||
hwloc_noos_component_instantiate,
|
||||
40, /* lower than native OS component, higher than globals */
|
||||
1,
|
||||
NULL
|
||||
};
|
||||
|
||||
const struct hwloc_component hwloc_noos_component = {
|
||||
HWLOC_COMPONENT_ABI,
|
||||
NULL, NULL,
|
||||
HWLOC_COMPONENT_TYPE_DISC,
|
||||
0,
|
||||
&hwloc_noos_disc_component
|
||||
};
|
||||
1564
src/3rdparty/hwloc/src/topology-synthetic.c
vendored
1564
src/3rdparty/hwloc/src/topology-synthetic.c
vendored
File diff suppressed because it is too large
Load Diff
1215
src/3rdparty/hwloc/src/topology-windows.c
vendored
1215
src/3rdparty/hwloc/src/topology-windows.c
vendored
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user