Merge branch 'evo' into beta
This commit is contained in:
commit
4f74675a19
545 changed files with 39156 additions and 16545 deletions
2342
src/3rdparty/adl/adl_defines.h
vendored
Normal file
2342
src/3rdparty/adl/adl_defines.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
44
src/3rdparty/adl/adl_sdk.h
vendored
Normal file
44
src/3rdparty/adl/adl_sdk.h
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
//
|
||||
// Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// MIT LICENSE:
|
||||
// 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.
|
||||
|
||||
/// \file adl_sdk.h
|
||||
/// \brief Contains the definition of the Memory Allocation Callback.\n <b>Included in ADL SDK</b>
|
||||
///
|
||||
/// \n\n
|
||||
/// This file contains the definition of the Memory Allocation Callback.\n
|
||||
/// It also includes definitions of the respective structures and constants.\n
|
||||
/// <b> This is the only header file to be included in a C/C++ project using ADL </b>
|
||||
|
||||
#ifndef ADL_SDK_H_
|
||||
#define ADL_SDK_H_
|
||||
|
||||
#include "adl_structures.h"
|
||||
|
||||
#if defined (LINUX)
|
||||
#define __stdcall
|
||||
#endif /* (LINUX) */
|
||||
|
||||
/// Memory Allocation Call back
|
||||
typedef void* ( __stdcall *ADL_MAIN_MALLOC_CALLBACK )( int );
|
||||
|
||||
|
||||
#endif /* ADL_SDK_H_ */
|
3440
src/3rdparty/adl/adl_structures.h
vendored
Normal file
3440
src/3rdparty/adl/adl_structures.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
2
src/3rdparty/argon2/CMakeLists.txt
vendored
2
src/3rdparty/argon2/CMakeLists.txt
vendored
|
@ -17,7 +17,7 @@ set(ARGON2_SOURCES
|
|||
|
||||
set(ARGON2_X86_64_ENABLED ON)
|
||||
set(ARGON2_X86_64_LIBS argon2-sse2 argon2-ssse3 argon2-xop argon2-avx2 argon2-avx512f)
|
||||
set(ARGON2_X86_64_SOURCES arch/x86_64/lib/argon2-arch.c arch/x86_64/lib/cpu-flags.c)
|
||||
set(ARGON2_X86_64_SOURCES arch/x86_64/lib/argon2-arch.c)
|
||||
|
||||
if (CMAKE_C_COMPILER_ID MATCHES MSVC)
|
||||
function(add_feature_impl FEATURE MSVC_FLAG DEF)
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#include "impl-select.h"
|
||||
|
||||
#include "cpu-flags.h"
|
||||
#include "argon2-sse2.h"
|
||||
#include "argon2-ssse3.h"
|
||||
#include "argon2-xop.h"
|
||||
|
@ -26,16 +25,14 @@ void fill_segment_default(const argon2_instance_t *instance,
|
|||
void argon2_get_impl_list(argon2_impl_list *list)
|
||||
{
|
||||
static const argon2_impl IMPLS[] = {
|
||||
{ "x86_64", NULL, fill_segment_default },
|
||||
{ "SSE2", check_sse2, fill_segment_sse2 },
|
||||
{ "SSSE3", check_ssse3, fill_segment_ssse3 },
|
||||
{ "XOP", check_xop, fill_segment_xop },
|
||||
{ "AVX2", check_avx2, fill_segment_avx2 },
|
||||
{ "AVX-512F", check_avx512f, fill_segment_avx512f },
|
||||
{ "x86_64", NULL, fill_segment_default },
|
||||
{ "SSE2", xmrig_ar2_check_sse2, xmrig_ar2_fill_segment_sse2 },
|
||||
{ "SSSE3", xmrig_ar2_check_ssse3, xmrig_ar2_fill_segment_ssse3 },
|
||||
{ "XOP", xmrig_ar2_check_xop, xmrig_ar2_fill_segment_xop },
|
||||
{ "AVX2", xmrig_ar2_check_avx2, xmrig_ar2_fill_segment_avx2 },
|
||||
{ "AVX-512F", xmrig_ar2_check_avx512f, xmrig_ar2_fill_segment_avx512f },
|
||||
};
|
||||
|
||||
cpu_flags_get();
|
||||
|
||||
list->count = sizeof(IMPLS) / sizeof(IMPLS[0]);
|
||||
list->entries = IMPLS;
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
# include <intrin.h>
|
||||
#endif
|
||||
|
||||
#include "cpu-flags.h"
|
||||
|
||||
#define r16 (_mm256_setr_epi8( \
|
||||
2, 3, 4, 5, 6, 7, 0, 1, \
|
||||
10, 11, 12, 13, 14, 15, 8, 9, \
|
||||
|
@ -225,8 +223,7 @@ static void next_addresses(block *address_block, block *input_block)
|
|||
fill_block(zero2_block, address_block, address_block, 0);
|
||||
}
|
||||
|
||||
void fill_segment_avx2(const argon2_instance_t *instance,
|
||||
argon2_position_t position)
|
||||
void xmrig_ar2_fill_segment_avx2(const argon2_instance_t *instance, argon2_position_t position)
|
||||
{
|
||||
block *ref_block = NULL, *curr_block = NULL;
|
||||
block address_block, input_block;
|
||||
|
@ -310,8 +307,7 @@ void fill_segment_avx2(const argon2_instance_t *instance,
|
|||
* lane.
|
||||
*/
|
||||
position.index = i;
|
||||
ref_index = index_alpha(instance, &position, pseudo_rand & 0xFFFFFFFF,
|
||||
ref_lane == position.lane);
|
||||
ref_index = xmrig_ar2_index_alpha(instance, &position, pseudo_rand & 0xFFFFFFFF, ref_lane == position.lane);
|
||||
|
||||
/* 2 Creating a new block */
|
||||
ref_block =
|
||||
|
@ -327,21 +323,13 @@ void fill_segment_avx2(const argon2_instance_t *instance,
|
|||
}
|
||||
}
|
||||
|
||||
int check_avx2(void)
|
||||
{
|
||||
return cpu_flags_have_avx2();
|
||||
}
|
||||
|
||||
extern int cpu_flags_has_avx2(void);
|
||||
int xmrig_ar2_check_avx2(void) { return cpu_flags_has_avx2(); }
|
||||
|
||||
#else
|
||||
|
||||
void fill_segment_avx2(const argon2_instance_t *instance,
|
||||
argon2_position_t position)
|
||||
{
|
||||
}
|
||||
|
||||
int check_avx2(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
void xmrig_ar2_fill_segment_avx2(const argon2_instance_t *instance, argon2_position_t position) {}
|
||||
int xmrig_ar2_check_avx2(void) { return 0; }
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
|
||||
#include "core.h"
|
||||
|
||||
void fill_segment_avx2(const argon2_instance_t *instance,
|
||||
argon2_position_t position);
|
||||
|
||||
int check_avx2(void);
|
||||
void xmrig_ar2_fill_segment_avx2(const argon2_instance_t *instance, argon2_position_t position);
|
||||
int xmrig_ar2_check_avx2(void);
|
||||
|
||||
#endif // ARGON2_AVX2_H
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
# include <intrin.h>
|
||||
#endif
|
||||
|
||||
#include "cpu-flags.h"
|
||||
|
||||
#define ror64(x, n) _mm512_ror_epi64((x), (n))
|
||||
|
||||
static __m512i f(__m512i x, __m512i y)
|
||||
|
@ -210,8 +208,7 @@ static void next_addresses(block *address_block, block *input_block)
|
|||
fill_block(zero2_block, address_block, address_block, 0);
|
||||
}
|
||||
|
||||
void fill_segment_avx512f(const argon2_instance_t *instance,
|
||||
argon2_position_t position)
|
||||
void xmrig_ar2_fill_segment_avx512f(const argon2_instance_t *instance, argon2_position_t position)
|
||||
{
|
||||
block *ref_block = NULL, *curr_block = NULL;
|
||||
block address_block, input_block;
|
||||
|
@ -295,8 +292,7 @@ void fill_segment_avx512f(const argon2_instance_t *instance,
|
|||
* lane.
|
||||
*/
|
||||
position.index = i;
|
||||
ref_index = index_alpha(instance, &position, pseudo_rand & 0xFFFFFFFF,
|
||||
ref_lane == position.lane);
|
||||
ref_index = xmrig_ar2_index_alpha(instance, &position, pseudo_rand & 0xFFFFFFFF, ref_lane == position.lane);
|
||||
|
||||
/* 2 Creating a new block */
|
||||
ref_block =
|
||||
|
@ -312,21 +308,12 @@ void fill_segment_avx512f(const argon2_instance_t *instance,
|
|||
}
|
||||
}
|
||||
|
||||
int check_avx512f(void)
|
||||
{
|
||||
return cpu_flags_have_avx512f();
|
||||
}
|
||||
extern int cpu_flags_has_avx512f(void);
|
||||
int xmrig_ar2_check_avx512f(void) { return cpu_flags_has_avx512f(); }
|
||||
|
||||
#else
|
||||
|
||||
void fill_segment_avx512f(const argon2_instance_t *instance,
|
||||
argon2_position_t position)
|
||||
{
|
||||
}
|
||||
|
||||
int check_avx512f(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
void xmrig_ar2_fill_segment_avx512f(const argon2_instance_t *instance, argon2_position_t position) {}
|
||||
int xmrig_ar2_check_avx512f(void) { return 0; }
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
|
||||
#include "core.h"
|
||||
|
||||
void fill_segment_avx512f(const argon2_instance_t *instance,
|
||||
argon2_position_t position);
|
||||
|
||||
int check_avx512f(void);
|
||||
void xmrig_ar2_fill_segment_avx512f(const argon2_instance_t *instance, argon2_position_t position);
|
||||
int xmrig_ar2_check_avx512f(void);
|
||||
|
||||
#endif // ARGON2_AVX512F_H
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
# include <intrin.h>
|
||||
#endif
|
||||
|
||||
#include "cpu-flags.h"
|
||||
|
||||
#define ror64_16(x) \
|
||||
_mm_shufflehi_epi16( \
|
||||
_mm_shufflelo_epi16((x), _MM_SHUFFLE(0, 3, 2, 1)), \
|
||||
|
@ -102,27 +100,17 @@ static __m128i f(__m128i x, __m128i y)
|
|||
|
||||
#include "argon2-template-128.h"
|
||||
|
||||
void fill_segment_sse2(const argon2_instance_t *instance,
|
||||
argon2_position_t position)
|
||||
void xmrig_ar2_fill_segment_sse2(const argon2_instance_t *instance, argon2_position_t position)
|
||||
{
|
||||
fill_segment_128(instance, position);
|
||||
}
|
||||
|
||||
int check_sse2(void)
|
||||
{
|
||||
return cpu_flags_have_sse2();
|
||||
}
|
||||
extern int cpu_flags_has_sse2(void);
|
||||
int xmrig_ar2_check_sse2(void) { return cpu_flags_has_sse2(); }
|
||||
|
||||
#else
|
||||
|
||||
void fill_segment_sse2(const argon2_instance_t *instance,
|
||||
argon2_position_t position)
|
||||
{
|
||||
}
|
||||
|
||||
int check_sse2(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
void xmrig_ar2_fill_segment_sse2(const argon2_instance_t *instance, argon2_position_t position) {}
|
||||
int xmrig_ar2_check_sse2(void) { return 0; }
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
|
||||
#include "core.h"
|
||||
|
||||
void fill_segment_sse2(const argon2_instance_t *instance,
|
||||
argon2_position_t position);
|
||||
|
||||
int check_sse2(void);
|
||||
void xmrig_ar2_fill_segment_sse2(const argon2_instance_t *instance, argon2_position_t position);
|
||||
int xmrig_ar2_check_sse2(void);
|
||||
|
||||
#endif // ARGON2_SSE2_H
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
# include <intrin.h>
|
||||
#endif
|
||||
|
||||
#include "cpu-flags.h"
|
||||
|
||||
#define r16 (_mm_setr_epi8( \
|
||||
2, 3, 4, 5, 6, 7, 0, 1, \
|
||||
10, 11, 12, 13, 14, 15, 8, 9))
|
||||
|
@ -114,27 +112,17 @@ static __m128i f(__m128i x, __m128i y)
|
|||
|
||||
#include "argon2-template-128.h"
|
||||
|
||||
void fill_segment_ssse3(const argon2_instance_t *instance,
|
||||
argon2_position_t position)
|
||||
void xmrig_ar2_fill_segment_ssse3(const argon2_instance_t *instance, argon2_position_t position)
|
||||
{
|
||||
fill_segment_128(instance, position);
|
||||
}
|
||||
|
||||
int check_ssse3(void)
|
||||
{
|
||||
return cpu_flags_have_ssse3();
|
||||
}
|
||||
extern int cpu_flags_has_ssse3(void);
|
||||
int xmrig_ar2_check_ssse3(void) { return cpu_flags_has_ssse3(); }
|
||||
|
||||
#else
|
||||
|
||||
void fill_segment_ssse3(const argon2_instance_t *instance,
|
||||
argon2_position_t position)
|
||||
{
|
||||
}
|
||||
|
||||
int check_ssse3(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
void xmrig_ar2_fill_segment_ssse3(const argon2_instance_t *instance, argon2_position_t position) {}
|
||||
int xmrig_ar2_check_ssse3(void) { return 0; }
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
|
||||
#include "core.h"
|
||||
|
||||
void fill_segment_ssse3(const argon2_instance_t *instance,
|
||||
argon2_position_t position);
|
||||
|
||||
int check_ssse3(void);
|
||||
void xmrig_ar2_fill_segment_ssse3(const argon2_instance_t *instance, argon2_position_t position);
|
||||
int xmrig_ar2_check_ssse3(void);
|
||||
|
||||
#endif // ARGON2_SSSE3_H
|
||||
|
|
|
@ -150,8 +150,7 @@ static void fill_segment_128(const argon2_instance_t *instance,
|
|||
* lane.
|
||||
*/
|
||||
position.index = i;
|
||||
ref_index = index_alpha(instance, &position, pseudo_rand & 0xFFFFFFFF,
|
||||
ref_lane == position.lane);
|
||||
ref_index = xmrig_ar2_index_alpha(instance, &position, pseudo_rand & 0xFFFFFFFF, ref_lane == position.lane);
|
||||
|
||||
/* 2 Creating a new block */
|
||||
ref_block =
|
||||
|
|
22
src/3rdparty/argon2/arch/x86_64/lib/argon2-xop.c
vendored
22
src/3rdparty/argon2/arch/x86_64/lib/argon2-xop.c
vendored
|
@ -9,8 +9,6 @@
|
|||
# include <intrin.h>
|
||||
#endif
|
||||
|
||||
#include "cpu-flags.h"
|
||||
|
||||
#define ror64(x, c) _mm_roti_epi64((x), -(c))
|
||||
|
||||
static __m128i f(__m128i x, __m128i y)
|
||||
|
@ -102,27 +100,17 @@ static __m128i f(__m128i x, __m128i y)
|
|||
|
||||
#include "argon2-template-128.h"
|
||||
|
||||
void fill_segment_xop(const argon2_instance_t *instance,
|
||||
argon2_position_t position)
|
||||
void xmrig_ar2_fill_segment_xop(const argon2_instance_t *instance, argon2_position_t position)
|
||||
{
|
||||
fill_segment_128(instance, position);
|
||||
}
|
||||
|
||||
int check_xop(void)
|
||||
{
|
||||
return cpu_flags_have_xop();
|
||||
}
|
||||
extern int cpu_flags_has_xop(void);
|
||||
int xmrig_ar2_check_xop(void) { return cpu_flags_has_xop(); }
|
||||
|
||||
#else
|
||||
|
||||
void fill_segment_xop(const argon2_instance_t *instance,
|
||||
argon2_position_t position)
|
||||
{
|
||||
}
|
||||
|
||||
int check_xop(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
void xmrig_ar2_fill_segment_xop(const argon2_instance_t *instance, argon2_position_t position) {}
|
||||
int xmrig_ar2_check_xop(void) { return 0; }
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
|
||||
#include "core.h"
|
||||
|
||||
void fill_segment_xop(const argon2_instance_t *instance,
|
||||
argon2_position_t position);
|
||||
|
||||
int check_xop(void);
|
||||
void xmrig_ar2_fill_segment_xop(const argon2_instance_t *instance, argon2_position_t position);
|
||||
int xmrig_ar2_check_xop(void);
|
||||
|
||||
#endif // ARGON2_XOP_H
|
||||
|
|
129
src/3rdparty/argon2/arch/x86_64/lib/cpu-flags.c
vendored
129
src/3rdparty/argon2/arch/x86_64/lib/cpu-flags.c
vendored
|
@ -1,129 +0,0 @@
|
|||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#include "cpu-flags.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# include <intrin.h>
|
||||
#else
|
||||
# include <cpuid.h>
|
||||
#endif
|
||||
|
||||
#ifndef bit_OSXSAVE
|
||||
# define bit_OSXSAVE (1 << 27)
|
||||
#endif
|
||||
|
||||
#ifndef bit_SSE2
|
||||
# define bit_SSE2 (1 << 26)
|
||||
#endif
|
||||
|
||||
#ifndef bit_SSSE3
|
||||
# define bit_SSSE3 (1 << 9)
|
||||
#endif
|
||||
|
||||
#ifndef bit_AVX2
|
||||
# define bit_AVX2 (1 << 5)
|
||||
#endif
|
||||
|
||||
#ifndef bit_AVX512F
|
||||
# define bit_AVX512F (1 << 16)
|
||||
#endif
|
||||
|
||||
#ifndef bit_XOP
|
||||
# define bit_XOP (1 << 11)
|
||||
#endif
|
||||
|
||||
#define PROCESSOR_INFO (1)
|
||||
#define EXTENDED_FEATURES (7)
|
||||
|
||||
#define EAX_Reg (0)
|
||||
#define EBX_Reg (1)
|
||||
#define ECX_Reg (2)
|
||||
#define EDX_Reg (3)
|
||||
|
||||
|
||||
enum {
|
||||
X86_64_FEATURE_SSE2 = (1 << 0),
|
||||
X86_64_FEATURE_SSSE3 = (1 << 1),
|
||||
X86_64_FEATURE_XOP = (1 << 2),
|
||||
X86_64_FEATURE_AVX2 = (1 << 3),
|
||||
X86_64_FEATURE_AVX512F = (1 << 4),
|
||||
};
|
||||
|
||||
static unsigned int cpu_flags;
|
||||
|
||||
|
||||
static inline void cpuid(uint32_t level, int32_t output[4])
|
||||
{
|
||||
# ifdef _MSC_VER
|
||||
__cpuid(output, (int) level);
|
||||
# else
|
||||
__cpuid_count(level, 0, output[0], output[1], output[2], output[3]);
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
static bool has_feature(uint32_t level, uint32_t reg, int32_t bit)
|
||||
{
|
||||
int32_t cpu_info[4] = { 0 };
|
||||
cpuid(level, cpu_info);
|
||||
|
||||
return (cpu_info[reg] & bit) != 0;
|
||||
}
|
||||
|
||||
|
||||
void cpu_flags_get(void)
|
||||
{
|
||||
if (has_feature(PROCESSOR_INFO, EDX_Reg, bit_SSE2)) {
|
||||
cpu_flags |= X86_64_FEATURE_SSE2;
|
||||
}
|
||||
|
||||
if (has_feature(PROCESSOR_INFO, ECX_Reg, bit_SSSE3)) {
|
||||
cpu_flags |= X86_64_FEATURE_SSSE3;
|
||||
}
|
||||
|
||||
if (!has_feature(PROCESSOR_INFO, ECX_Reg, bit_OSXSAVE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (has_feature(EXTENDED_FEATURES, EBX_Reg, bit_AVX2)) {
|
||||
cpu_flags |= X86_64_FEATURE_AVX2;
|
||||
}
|
||||
|
||||
if (has_feature(EXTENDED_FEATURES, EBX_Reg, bit_AVX512F)) {
|
||||
cpu_flags |= X86_64_FEATURE_AVX512F;
|
||||
}
|
||||
|
||||
if (has_feature(0x80000001, ECX_Reg, bit_XOP)) {
|
||||
cpu_flags |= X86_64_FEATURE_XOP;
|
||||
}
|
||||
}
|
||||
|
||||
int cpu_flags_have_sse2(void)
|
||||
{
|
||||
return cpu_flags & X86_64_FEATURE_SSE2;
|
||||
}
|
||||
|
||||
int cpu_flags_have_ssse3(void)
|
||||
{
|
||||
return cpu_flags & X86_64_FEATURE_SSSE3;
|
||||
}
|
||||
|
||||
int cpu_flags_have_xop(void)
|
||||
{
|
||||
return cpu_flags & X86_64_FEATURE_XOP;
|
||||
}
|
||||
|
||||
int cpu_flags_have_avx2(void)
|
||||
{
|
||||
return cpu_flags & X86_64_FEATURE_AVX2;
|
||||
}
|
||||
|
||||
int cpu_flags_have_avx512f(void)
|
||||
{
|
||||
return cpu_flags & X86_64_FEATURE_AVX512F;
|
||||
}
|
||||
|
12
src/3rdparty/argon2/arch/x86_64/lib/cpu-flags.h
vendored
12
src/3rdparty/argon2/arch/x86_64/lib/cpu-flags.h
vendored
|
@ -1,12 +0,0 @@
|
|||
#ifndef ARGON2_CPU_FLAGS_H
|
||||
#define ARGON2_CPU_FLAGS_H
|
||||
|
||||
void cpu_flags_get(void);
|
||||
|
||||
int cpu_flags_have_sse2(void);
|
||||
int cpu_flags_have_ssse3(void);
|
||||
int cpu_flags_have_xop(void);
|
||||
int cpu_flags_have_avx2(void);
|
||||
int cpu_flags_have_avx512f(void);
|
||||
|
||||
#endif // ARGON2_CPU_FLAGS_H
|
3
src/3rdparty/argon2/lib/argon2-template-64.h
vendored
3
src/3rdparty/argon2/lib/argon2-template-64.h
vendored
|
@ -174,8 +174,7 @@ static void fill_segment_64(const argon2_instance_t *instance,
|
|||
* lane.
|
||||
*/
|
||||
position.index = i;
|
||||
ref_index = index_alpha(instance, &position, pseudo_rand & 0xFFFFFFFF,
|
||||
ref_lane == position.lane);
|
||||
ref_index = xmrig_ar2_index_alpha(instance, &position, pseudo_rand & 0xFFFFFFFF, ref_lane == position.lane);
|
||||
|
||||
/* 2 Creating a new block */
|
||||
ref_block =
|
||||
|
|
16
src/3rdparty/argon2/lib/argon2.c
vendored
16
src/3rdparty/argon2/lib/argon2.c
vendored
|
@ -57,7 +57,7 @@ size_t argon2_memory_size(uint32_t m_cost, uint32_t parallelism) {
|
|||
int argon2_ctx_mem(argon2_context *context, argon2_type type, void *memory,
|
||||
size_t memory_size) {
|
||||
/* 1. Validate all inputs */
|
||||
int result = validate_inputs(context);
|
||||
int result = xmrig_ar2_validate_inputs(context);
|
||||
uint32_t memory_blocks, segment_length;
|
||||
argon2_instance_t instance;
|
||||
|
||||
|
@ -98,20 +98,20 @@ int argon2_ctx_mem(argon2_context *context, argon2_type type, void *memory,
|
|||
/* 3. Initialization: Hashing inputs, allocating memory, filling first
|
||||
* blocks
|
||||
*/
|
||||
result = initialize(&instance, context);
|
||||
result = xmrig_ar2_initialize(&instance, context);
|
||||
|
||||
if (ARGON2_OK != result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
/* 4. Filling memory */
|
||||
result = fill_memory_blocks(&instance);
|
||||
result = xmrig_ar2_fill_memory_blocks(&instance);
|
||||
|
||||
if (ARGON2_OK != result) {
|
||||
return result;
|
||||
}
|
||||
/* 5. Finalization */
|
||||
finalize(context, &instance);
|
||||
xmrig_ar2_finalize(context, &instance);
|
||||
|
||||
return ARGON2_OK;
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ int argon2_hash(const uint32_t t_cost, const uint32_t m_cost,
|
|||
result = argon2_ctx(&context, type);
|
||||
|
||||
if (result != ARGON2_OK) {
|
||||
clear_internal_memory(out, hashlen);
|
||||
xmrig_ar2_clear_internal_memory(out, hashlen);
|
||||
free(out);
|
||||
return result;
|
||||
}
|
||||
|
@ -187,13 +187,13 @@ int argon2_hash(const uint32_t t_cost, const uint32_t m_cost,
|
|||
/* if encoding requested, write it */
|
||||
if (encoded && encodedlen) {
|
||||
if (encode_string(encoded, encodedlen, &context, type) != ARGON2_OK) {
|
||||
clear_internal_memory(out, hashlen); /* wipe buffers if error */
|
||||
clear_internal_memory(encoded, encodedlen);
|
||||
xmrig_ar2_clear_internal_memory(out, hashlen); /* wipe buffers if error */
|
||||
xmrig_ar2_clear_internal_memory(encoded, encodedlen);
|
||||
free(out);
|
||||
return ARGON2_ENCODING_FAIL;
|
||||
}
|
||||
}
|
||||
clear_internal_memory(out, hashlen);
|
||||
xmrig_ar2_clear_internal_memory(out, hashlen);
|
||||
free(out);
|
||||
|
||||
return ARGON2_OK;
|
||||
|
|
44
src/3rdparty/argon2/lib/blake2/blake2.c
vendored
44
src/3rdparty/argon2/lib/blake2/blake2.c
vendored
|
@ -128,14 +128,14 @@ static void blake2b_init_state(blake2b_state *S)
|
|||
S->buflen = 0;
|
||||
}
|
||||
|
||||
void blake2b_init(blake2b_state *S, size_t outlen)
|
||||
void xmrig_ar2_blake2b_init(blake2b_state *S, size_t outlen)
|
||||
{
|
||||
blake2b_init_state(S);
|
||||
/* XOR initial state with param block: */
|
||||
S->h[0] ^= (uint64_t)outlen | (UINT64_C(1) << 16) | (UINT64_C(1) << 24);
|
||||
}
|
||||
|
||||
void blake2b_update(blake2b_state *S, const void *in, size_t inlen)
|
||||
void xmrig_ar2_blake2b_update(blake2b_state *S, const void *in, size_t inlen)
|
||||
{
|
||||
const uint8_t *pin = (const uint8_t *)in;
|
||||
|
||||
|
@ -160,7 +160,7 @@ void blake2b_update(blake2b_state *S, const void *in, size_t inlen)
|
|||
S->buflen += inlen;
|
||||
}
|
||||
|
||||
void blake2b_final(blake2b_state *S, void *out, size_t outlen)
|
||||
void xmrig_ar2_blake2b_final(blake2b_state *S, void *out, size_t outlen)
|
||||
{
|
||||
uint8_t buffer[BLAKE2B_OUTBYTES] = {0};
|
||||
unsigned int i;
|
||||
|
@ -174,12 +174,12 @@ void blake2b_final(blake2b_state *S, void *out, size_t outlen)
|
|||
}
|
||||
|
||||
memcpy(out, buffer, outlen);
|
||||
clear_internal_memory(buffer, sizeof(buffer));
|
||||
clear_internal_memory(S->buf, sizeof(S->buf));
|
||||
clear_internal_memory(S->h, sizeof(S->h));
|
||||
xmrig_ar2_clear_internal_memory(buffer, sizeof(buffer));
|
||||
xmrig_ar2_clear_internal_memory(S->buf, sizeof(S->buf));
|
||||
xmrig_ar2_clear_internal_memory(S->h, sizeof(S->h));
|
||||
}
|
||||
|
||||
void blake2b_long(void *out, size_t outlen, const void *in, size_t inlen)
|
||||
void xmrig_ar2_blake2b_long(void *out, size_t outlen, const void *in, size_t inlen)
|
||||
{
|
||||
uint8_t *pout = (uint8_t *)out;
|
||||
blake2b_state blake_state;
|
||||
|
@ -187,39 +187,39 @@ void blake2b_long(void *out, size_t outlen, const void *in, size_t inlen)
|
|||
|
||||
store32(outlen_bytes, (uint32_t)outlen);
|
||||
if (outlen <= BLAKE2B_OUTBYTES) {
|
||||
blake2b_init(&blake_state, outlen);
|
||||
blake2b_update(&blake_state, outlen_bytes, sizeof(outlen_bytes));
|
||||
blake2b_update(&blake_state, in, inlen);
|
||||
blake2b_final(&blake_state, pout, outlen);
|
||||
xmrig_ar2_blake2b_init(&blake_state, outlen);
|
||||
xmrig_ar2_blake2b_update(&blake_state, outlen_bytes, sizeof(outlen_bytes));
|
||||
xmrig_ar2_blake2b_update(&blake_state, in, inlen);
|
||||
xmrig_ar2_blake2b_final(&blake_state, pout, outlen);
|
||||
} else {
|
||||
uint32_t toproduce;
|
||||
uint8_t out_buffer[BLAKE2B_OUTBYTES];
|
||||
|
||||
blake2b_init(&blake_state, BLAKE2B_OUTBYTES);
|
||||
blake2b_update(&blake_state, outlen_bytes, sizeof(outlen_bytes));
|
||||
blake2b_update(&blake_state, in, inlen);
|
||||
blake2b_final(&blake_state, out_buffer, BLAKE2B_OUTBYTES);
|
||||
xmrig_ar2_blake2b_init(&blake_state, BLAKE2B_OUTBYTES);
|
||||
xmrig_ar2_blake2b_update(&blake_state, outlen_bytes, sizeof(outlen_bytes));
|
||||
xmrig_ar2_blake2b_update(&blake_state, in, inlen);
|
||||
xmrig_ar2_blake2b_final(&blake_state, out_buffer, BLAKE2B_OUTBYTES);
|
||||
|
||||
memcpy(pout, out_buffer, BLAKE2B_OUTBYTES / 2);
|
||||
pout += BLAKE2B_OUTBYTES / 2;
|
||||
toproduce = (uint32_t)outlen - BLAKE2B_OUTBYTES / 2;
|
||||
|
||||
while (toproduce > BLAKE2B_OUTBYTES) {
|
||||
blake2b_init(&blake_state, BLAKE2B_OUTBYTES);
|
||||
blake2b_update(&blake_state, out_buffer, BLAKE2B_OUTBYTES);
|
||||
blake2b_final(&blake_state, out_buffer, BLAKE2B_OUTBYTES);
|
||||
xmrig_ar2_blake2b_init(&blake_state, BLAKE2B_OUTBYTES);
|
||||
xmrig_ar2_blake2b_update(&blake_state, out_buffer, BLAKE2B_OUTBYTES);
|
||||
xmrig_ar2_blake2b_final(&blake_state, out_buffer, BLAKE2B_OUTBYTES);
|
||||
|
||||
memcpy(pout, out_buffer, BLAKE2B_OUTBYTES / 2);
|
||||
pout += BLAKE2B_OUTBYTES / 2;
|
||||
toproduce -= BLAKE2B_OUTBYTES / 2;
|
||||
}
|
||||
|
||||
blake2b_init(&blake_state, toproduce);
|
||||
blake2b_update(&blake_state, out_buffer, BLAKE2B_OUTBYTES);
|
||||
blake2b_final(&blake_state, out_buffer, toproduce);
|
||||
xmrig_ar2_blake2b_init(&blake_state, toproduce);
|
||||
xmrig_ar2_blake2b_update(&blake_state, out_buffer, BLAKE2B_OUTBYTES);
|
||||
xmrig_ar2_blake2b_final(&blake_state, out_buffer, toproduce);
|
||||
|
||||
memcpy(pout, out_buffer, toproduce);
|
||||
|
||||
clear_internal_memory(out_buffer, sizeof(out_buffer));
|
||||
xmrig_ar2_clear_internal_memory(out_buffer, sizeof(out_buffer));
|
||||
}
|
||||
}
|
||||
|
|
8
src/3rdparty/argon2/lib/blake2/blake2.h
vendored
8
src/3rdparty/argon2/lib/blake2/blake2.h
vendored
|
@ -20,11 +20,11 @@ typedef struct __blake2b_state {
|
|||
} blake2b_state;
|
||||
|
||||
/* Streaming API */
|
||||
void blake2b_init(blake2b_state *S, size_t outlen);
|
||||
void blake2b_update(blake2b_state *S, const void *in, size_t inlen);
|
||||
void blake2b_final(blake2b_state *S, void *out, size_t outlen);
|
||||
void xmrig_ar2_blake2b_init(blake2b_state *S, size_t outlen);
|
||||
void xmrig_ar2_blake2b_update(blake2b_state *S, const void *in, size_t inlen);
|
||||
void xmrig_ar2_blake2b_final(blake2b_state *S, void *out, size_t outlen);
|
||||
|
||||
void blake2b_long(void *out, size_t outlen, const void *in, size_t inlen);
|
||||
void xmrig_ar2_blake2b_long(void *out, size_t outlen, const void *in, size_t inlen);
|
||||
|
||||
#endif // ARGON2_BLAKE2_H
|
||||
|
||||
|
|
119
src/3rdparty/argon2/lib/core.c
vendored
119
src/3rdparty/argon2/lib/core.c
vendored
|
@ -77,8 +77,7 @@ static void store_block(void *output, const block *src) {
|
|||
|
||||
/***************Memory functions*****************/
|
||||
|
||||
int allocate_memory(const argon2_context *context,
|
||||
argon2_instance_t *instance) {
|
||||
int xmrig_ar2_allocate_memory(const argon2_context *context, argon2_instance_t *instance) {
|
||||
size_t blocks = instance->memory_blocks;
|
||||
size_t memory_size = blocks * ARGON2_BLOCK_SIZE;
|
||||
|
||||
|
@ -107,11 +106,10 @@ int allocate_memory(const argon2_context *context,
|
|||
return ARGON2_OK;
|
||||
}
|
||||
|
||||
void free_memory(const argon2_context *context,
|
||||
const argon2_instance_t *instance) {
|
||||
void xmrig_ar2_free_memory(const argon2_context *context, const argon2_instance_t *instance) {
|
||||
size_t memory_size = instance->memory_blocks * ARGON2_BLOCK_SIZE;
|
||||
|
||||
clear_internal_memory(instance->memory, memory_size);
|
||||
xmrig_ar2_clear_internal_memory(instance->memory, memory_size);
|
||||
|
||||
if (instance->keep_memory) {
|
||||
/* user-supplied memory -- do not free */
|
||||
|
@ -125,7 +123,7 @@ void free_memory(const argon2_context *context,
|
|||
}
|
||||
}
|
||||
|
||||
void NOT_OPTIMIZED secure_wipe_memory(void *v, size_t n) {
|
||||
void NOT_OPTIMIZED xmrig_ar2_secure_wipe_memory(void *v, size_t n) {
|
||||
#if defined(_MSC_VER) && VC_GE_2005(_MSC_VER)
|
||||
SecureZeroMemory(v, n);
|
||||
#elif defined memset_s
|
||||
|
@ -140,14 +138,14 @@ void NOT_OPTIMIZED secure_wipe_memory(void *v, size_t n) {
|
|||
|
||||
/* Memory clear flag defaults to true. */
|
||||
int FLAG_clear_internal_memory = 0;
|
||||
void clear_internal_memory(void *v, size_t n) {
|
||||
void xmrig_ar2_clear_internal_memory(void *v, size_t n) {
|
||||
if (FLAG_clear_internal_memory && v) {
|
||||
secure_wipe_memory(v, n);
|
||||
xmrig_ar2_secure_wipe_memory(v, n);
|
||||
}
|
||||
}
|
||||
|
||||
void finalize(const argon2_context *context, argon2_instance_t *instance) {
|
||||
if (context != NULL && instance != NULL) {
|
||||
void xmrig_ar2_finalize(const argon2_context *context, argon2_instance_t *instance) {
|
||||
if (context != NULL && instance != NULL && context->out != NULL) {
|
||||
block blockhash;
|
||||
uint32_t l;
|
||||
|
||||
|
@ -164,24 +162,21 @@ void finalize(const argon2_context *context, argon2_instance_t *instance) {
|
|||
{
|
||||
uint8_t blockhash_bytes[ARGON2_BLOCK_SIZE];
|
||||
store_block(blockhash_bytes, &blockhash);
|
||||
blake2b_long(context->out, context->outlen, blockhash_bytes,
|
||||
ARGON2_BLOCK_SIZE);
|
||||
xmrig_ar2_blake2b_long(context->out, context->outlen, blockhash_bytes, ARGON2_BLOCK_SIZE);
|
||||
/* clear blockhash and blockhash_bytes */
|
||||
clear_internal_memory(blockhash.v, ARGON2_BLOCK_SIZE);
|
||||
clear_internal_memory(blockhash_bytes, ARGON2_BLOCK_SIZE);
|
||||
xmrig_ar2_clear_internal_memory(blockhash.v, ARGON2_BLOCK_SIZE);
|
||||
xmrig_ar2_clear_internal_memory(blockhash_bytes, ARGON2_BLOCK_SIZE);
|
||||
}
|
||||
|
||||
if (instance->print_internals) {
|
||||
print_tag(context->out, context->outlen);
|
||||
}
|
||||
|
||||
free_memory(context, instance);
|
||||
xmrig_ar2_free_memory(context, instance);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t index_alpha(const argon2_instance_t *instance,
|
||||
const argon2_position_t *position, uint32_t pseudo_rand,
|
||||
int same_lane) {
|
||||
uint32_t xmrig_ar2_index_alpha(const argon2_instance_t *instance, const argon2_position_t *position, uint32_t pseudo_rand, int same_lane) {
|
||||
/*
|
||||
* Pass 0:
|
||||
* This lane : all already finished segments plus already constructed
|
||||
|
@ -257,7 +252,7 @@ static int fill_memory_blocks_st(argon2_instance_t *instance) {
|
|||
for (s = 0; s < ARGON2_SYNC_POINTS; ++s) {
|
||||
for (l = 0; l < instance->lanes; ++l) {
|
||||
argon2_position_t position = { r, l, (uint8_t)s, 0 };
|
||||
fill_segment(instance, position);
|
||||
xmrig_ar2_fill_segment(instance, position);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -268,7 +263,7 @@ static int fill_memory_blocks_st(argon2_instance_t *instance) {
|
|||
return ARGON2_OK;
|
||||
}
|
||||
|
||||
int fill_memory_blocks(argon2_instance_t *instance) {
|
||||
int xmrig_ar2_fill_memory_blocks(argon2_instance_t *instance) {
|
||||
if (instance == NULL || instance->lanes == 0) {
|
||||
return ARGON2_INCORRECT_PARAMETER;
|
||||
}
|
||||
|
@ -276,19 +271,19 @@ int fill_memory_blocks(argon2_instance_t *instance) {
|
|||
return fill_memory_blocks_st(instance);
|
||||
}
|
||||
|
||||
int validate_inputs(const argon2_context *context) {
|
||||
int xmrig_ar2_validate_inputs(const argon2_context *context) {
|
||||
if (NULL == context) {
|
||||
return ARGON2_INCORRECT_PARAMETER;
|
||||
}
|
||||
|
||||
if (NULL == context->out) {
|
||||
return ARGON2_OUTPUT_PTR_NULL;
|
||||
}
|
||||
//if (NULL == context->out) {
|
||||
// return ARGON2_OUTPUT_PTR_NULL;
|
||||
//}
|
||||
|
||||
/* Validate output length */
|
||||
if (ARGON2_MIN_OUTLEN > context->outlen) {
|
||||
return ARGON2_OUTPUT_TOO_SHORT;
|
||||
}
|
||||
//if (ARGON2_MIN_OUTLEN > context->outlen) {
|
||||
// return ARGON2_OUTPUT_TOO_SHORT;
|
||||
//}
|
||||
|
||||
if (ARGON2_MAX_OUTLEN < context->outlen) {
|
||||
return ARGON2_OUTPUT_TOO_LONG;
|
||||
|
@ -403,7 +398,7 @@ int validate_inputs(const argon2_context *context) {
|
|||
return ARGON2_OK;
|
||||
}
|
||||
|
||||
void fill_first_blocks(uint8_t *blockhash, const argon2_instance_t *instance) {
|
||||
void xmrig_ar2_fill_first_blocks(uint8_t *blockhash, const argon2_instance_t *instance) {
|
||||
uint32_t l;
|
||||
/* Make the first and second block in each lane as G(H0||0||i) or
|
||||
G(H0||1||i) */
|
||||
|
@ -412,21 +407,17 @@ void fill_first_blocks(uint8_t *blockhash, const argon2_instance_t *instance) {
|
|||
|
||||
store32(blockhash + ARGON2_PREHASH_DIGEST_LENGTH, 0);
|
||||
store32(blockhash + ARGON2_PREHASH_DIGEST_LENGTH + 4, l);
|
||||
blake2b_long(blockhash_bytes, ARGON2_BLOCK_SIZE, blockhash,
|
||||
ARGON2_PREHASH_SEED_LENGTH);
|
||||
load_block(&instance->memory[l * instance->lane_length + 0],
|
||||
blockhash_bytes);
|
||||
xmrig_ar2_blake2b_long(blockhash_bytes, ARGON2_BLOCK_SIZE, blockhash, ARGON2_PREHASH_SEED_LENGTH);
|
||||
load_block(&instance->memory[l * instance->lane_length + 0], blockhash_bytes);
|
||||
|
||||
store32(blockhash + ARGON2_PREHASH_DIGEST_LENGTH, 1);
|
||||
blake2b_long(blockhash_bytes, ARGON2_BLOCK_SIZE, blockhash,
|
||||
ARGON2_PREHASH_SEED_LENGTH);
|
||||
load_block(&instance->memory[l * instance->lane_length + 1],
|
||||
blockhash_bytes);
|
||||
xmrig_ar2_blake2b_long(blockhash_bytes, ARGON2_BLOCK_SIZE, blockhash, ARGON2_PREHASH_SEED_LENGTH);
|
||||
load_block(&instance->memory[l * instance->lane_length + 1], blockhash_bytes);
|
||||
}
|
||||
clear_internal_memory(blockhash_bytes, ARGON2_BLOCK_SIZE);
|
||||
xmrig_ar2_clear_internal_memory(blockhash_bytes, ARGON2_BLOCK_SIZE);
|
||||
}
|
||||
|
||||
void initial_hash(uint8_t *blockhash, argon2_context *context,
|
||||
void xmrig_ar2_initial_hash(uint8_t *blockhash, argon2_context *context,
|
||||
argon2_type type) {
|
||||
blake2b_state BlakeHash;
|
||||
uint8_t value[sizeof(uint32_t)];
|
||||
|
@ -435,72 +426,70 @@ void initial_hash(uint8_t *blockhash, argon2_context *context,
|
|||
return;
|
||||
}
|
||||
|
||||
blake2b_init(&BlakeHash, ARGON2_PREHASH_DIGEST_LENGTH);
|
||||
xmrig_ar2_blake2b_init(&BlakeHash, ARGON2_PREHASH_DIGEST_LENGTH);
|
||||
|
||||
store32(&value, context->lanes);
|
||||
blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
|
||||
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
|
||||
|
||||
store32(&value, context->outlen);
|
||||
blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
|
||||
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
|
||||
|
||||
store32(&value, context->m_cost);
|
||||
blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
|
||||
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
|
||||
|
||||
store32(&value, context->t_cost);
|
||||
blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
|
||||
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
|
||||
|
||||
store32(&value, context->version);
|
||||
blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
|
||||
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
|
||||
|
||||
store32(&value, (uint32_t)type);
|
||||
blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
|
||||
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
|
||||
|
||||
store32(&value, context->pwdlen);
|
||||
blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
|
||||
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
|
||||
|
||||
if (context->pwd != NULL) {
|
||||
blake2b_update(&BlakeHash, (const uint8_t *)context->pwd,
|
||||
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)context->pwd,
|
||||
context->pwdlen);
|
||||
|
||||
if (context->flags & ARGON2_FLAG_CLEAR_PASSWORD) {
|
||||
secure_wipe_memory(context->pwd, context->pwdlen);
|
||||
xmrig_ar2_secure_wipe_memory(context->pwd, context->pwdlen);
|
||||
context->pwdlen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
store32(&value, context->saltlen);
|
||||
blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
|
||||
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
|
||||
|
||||
if (context->salt != NULL) {
|
||||
blake2b_update(&BlakeHash, (const uint8_t *)context->salt,
|
||||
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)context->salt,
|
||||
context->saltlen);
|
||||
}
|
||||
|
||||
store32(&value, context->secretlen);
|
||||
blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
|
||||
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
|
||||
|
||||
if (context->secret != NULL) {
|
||||
blake2b_update(&BlakeHash, (const uint8_t *)context->secret,
|
||||
context->secretlen);
|
||||
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)context->secret, context->secretlen);
|
||||
|
||||
if (context->flags & ARGON2_FLAG_CLEAR_SECRET) {
|
||||
secure_wipe_memory(context->secret, context->secretlen);
|
||||
xmrig_ar2_secure_wipe_memory(context->secret, context->secretlen);
|
||||
context->secretlen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
store32(&value, context->adlen);
|
||||
blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
|
||||
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
|
||||
|
||||
if (context->ad != NULL) {
|
||||
blake2b_update(&BlakeHash, (const uint8_t *)context->ad,
|
||||
context->adlen);
|
||||
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)context->ad, context->adlen);
|
||||
}
|
||||
|
||||
blake2b_final(&BlakeHash, blockhash, ARGON2_PREHASH_DIGEST_LENGTH);
|
||||
xmrig_ar2_blake2b_final(&BlakeHash, blockhash, ARGON2_PREHASH_DIGEST_LENGTH);
|
||||
}
|
||||
|
||||
int initialize(argon2_instance_t *instance, argon2_context *context) {
|
||||
int xmrig_ar2_initialize(argon2_instance_t *instance, argon2_context *context) {
|
||||
uint8_t blockhash[ARGON2_PREHASH_SEED_LENGTH];
|
||||
int result = ARGON2_OK;
|
||||
|
||||
|
@ -510,7 +499,7 @@ int initialize(argon2_instance_t *instance, argon2_context *context) {
|
|||
|
||||
/* 1. Memory allocation */
|
||||
|
||||
result = allocate_memory(context, instance);
|
||||
result = xmrig_ar2_allocate_memory(context, instance);
|
||||
if (result != ARGON2_OK) {
|
||||
return result;
|
||||
}
|
||||
|
@ -519,11 +508,9 @@ int initialize(argon2_instance_t *instance, argon2_context *context) {
|
|||
/* H_0 + 8 extra bytes to produce the first blocks */
|
||||
/* uint8_t blockhash[ARGON2_PREHASH_SEED_LENGTH]; */
|
||||
/* Hashing all inputs */
|
||||
initial_hash(blockhash, context, instance->type);
|
||||
xmrig_ar2_initial_hash(blockhash, context, instance->type);
|
||||
/* Zeroing 8 extra bytes */
|
||||
clear_internal_memory(blockhash + ARGON2_PREHASH_DIGEST_LENGTH,
|
||||
ARGON2_PREHASH_SEED_LENGTH -
|
||||
ARGON2_PREHASH_DIGEST_LENGTH);
|
||||
xmrig_ar2_clear_internal_memory(blockhash + ARGON2_PREHASH_DIGEST_LENGTH, ARGON2_PREHASH_SEED_LENGTH - ARGON2_PREHASH_DIGEST_LENGTH);
|
||||
|
||||
if (instance->print_internals) {
|
||||
initial_kat(blockhash, context, instance->type);
|
||||
|
@ -531,9 +518,9 @@ int initialize(argon2_instance_t *instance, argon2_context *context) {
|
|||
|
||||
/* 3. Creating first blocks, we always have at least two blocks in a slice
|
||||
*/
|
||||
fill_first_blocks(blockhash, instance);
|
||||
xmrig_ar2_fill_first_blocks(blockhash, instance);
|
||||
/* Clearing the hash */
|
||||
clear_internal_memory(blockhash, ARGON2_PREHASH_SEED_LENGTH);
|
||||
xmrig_ar2_clear_internal_memory(blockhash, ARGON2_PREHASH_SEED_LENGTH);
|
||||
|
||||
return ARGON2_OK;
|
||||
}
|
||||
|
|
30
src/3rdparty/argon2/lib/core.h
vendored
30
src/3rdparty/argon2/lib/core.h
vendored
|
@ -110,8 +110,7 @@ typedef struct Argon2_thread_data {
|
|||
* @param instance the Argon2 instance
|
||||
* @return ARGON2_OK if memory is allocated successfully
|
||||
*/
|
||||
int allocate_memory(const argon2_context *context,
|
||||
argon2_instance_t *instance);
|
||||
int xmrig_ar2_allocate_memory(const argon2_context *context, argon2_instance_t *instance);
|
||||
|
||||
/*
|
||||
* Frees memory at the given pointer, uses the appropriate deallocator as
|
||||
|
@ -119,22 +118,21 @@ int allocate_memory(const argon2_context *context,
|
|||
* @param context argon2_context which specifies the deallocator
|
||||
* @param instance the Argon2 instance
|
||||
*/
|
||||
void free_memory(const argon2_context *context,
|
||||
const argon2_instance_t *instance);
|
||||
void xmrig_ar2_free_memory(const argon2_context *context, const argon2_instance_t *instance);
|
||||
|
||||
/* Function that securely cleans the memory. This ignores any flags set
|
||||
* regarding clearing memory. Usually one just calls clear_internal_memory.
|
||||
* @param mem Pointer to the memory
|
||||
* @param s Memory size in bytes
|
||||
*/
|
||||
void secure_wipe_memory(void *v, size_t n);
|
||||
void xmrig_ar2_secure_wipe_memory(void *v, size_t n);
|
||||
|
||||
/* Function that securely clears the memory if FLAG_clear_internal_memory is
|
||||
* set. If the flag isn't set, this function does nothing.
|
||||
* @param mem Pointer to the memory
|
||||
* @param s Memory size in bytes
|
||||
*/
|
||||
ARGON2_PUBLIC void clear_internal_memory(void *v, size_t n);
|
||||
ARGON2_PUBLIC void xmrig_ar2_clear_internal_memory(void *v, size_t n);
|
||||
|
||||
/*
|
||||
* Computes absolute position of reference block in the lane following a skewed
|
||||
|
@ -146,9 +144,7 @@ ARGON2_PUBLIC void clear_internal_memory(void *v, size_t n);
|
|||
* If so we can reference the current segment
|
||||
* @pre All pointers must be valid
|
||||
*/
|
||||
uint32_t index_alpha(const argon2_instance_t *instance,
|
||||
const argon2_position_t *position, uint32_t pseudo_rand,
|
||||
int same_lane);
|
||||
uint32_t xmrig_ar2_index_alpha(const argon2_instance_t *instance, const argon2_position_t *position, uint32_t pseudo_rand, int same_lane);
|
||||
|
||||
/*
|
||||
* Function that validates all inputs against predefined restrictions and return
|
||||
|
@ -157,7 +153,7 @@ uint32_t index_alpha(const argon2_instance_t *instance,
|
|||
* @return ARGON2_OK if everything is all right, otherwise one of error codes
|
||||
* (all defined in <argon2.h>
|
||||
*/
|
||||
int validate_inputs(const argon2_context *context);
|
||||
int xmrig_ar2_validate_inputs(const argon2_context *context);
|
||||
|
||||
/*
|
||||
* Hashes all the inputs into @a blockhash[PREHASH_DIGEST_LENGTH], clears
|
||||
|
@ -169,8 +165,7 @@ int validate_inputs(const argon2_context *context);
|
|||
* @pre @a blockhash must have at least @a PREHASH_DIGEST_LENGTH bytes
|
||||
* allocated
|
||||
*/
|
||||
void initial_hash(uint8_t *blockhash, argon2_context *context,
|
||||
argon2_type type);
|
||||
void xmrig_ar2_initial_hash(uint8_t *blockhash, argon2_context *context, argon2_type type);
|
||||
|
||||
/*
|
||||
* Function creates first 2 blocks per lane
|
||||
|
@ -178,7 +173,7 @@ void initial_hash(uint8_t *blockhash, argon2_context *context,
|
|||
* @param blockhash Pointer to the pre-hashing digest
|
||||
* @pre blockhash must point to @a PREHASH_SEED_LENGTH allocated values
|
||||
*/
|
||||
void fill_first_blocks(uint8_t *blockhash, const argon2_instance_t *instance);
|
||||
void xmrig_ar2_fill_first_blocks(uint8_t *blockhash, const argon2_instance_t *instance);
|
||||
|
||||
/*
|
||||
* Function allocates memory, hashes the inputs with Blake, and creates first
|
||||
|
@ -190,7 +185,7 @@ void fill_first_blocks(uint8_t *blockhash, const argon2_instance_t *instance);
|
|||
* @return Zero if successful, -1 if memory failed to allocate. @context->state
|
||||
* will be modified if successful.
|
||||
*/
|
||||
int initialize(argon2_instance_t *instance, argon2_context *context);
|
||||
int xmrig_ar2_initialize(argon2_instance_t *instance, argon2_context *context);
|
||||
|
||||
/*
|
||||
* XORing the last block of each lane, hashing it, making the tag. Deallocates
|
||||
|
@ -203,7 +198,7 @@ int initialize(argon2_instance_t *instance, argon2_context *context);
|
|||
* @pre if context->free_cbk is not NULL, it should point to a function that
|
||||
* deallocates memory
|
||||
*/
|
||||
void finalize(const argon2_context *context, argon2_instance_t *instance);
|
||||
void xmrig_ar2_finalize(const argon2_context *context, argon2_instance_t *instance);
|
||||
|
||||
/*
|
||||
* Function that fills the segment using previous segments also from other
|
||||
|
@ -212,8 +207,7 @@ void finalize(const argon2_context *context, argon2_instance_t *instance);
|
|||
* @param position Current position
|
||||
* @pre all block pointers must be valid
|
||||
*/
|
||||
void fill_segment(const argon2_instance_t *instance,
|
||||
argon2_position_t position);
|
||||
void xmrig_ar2_fill_segment(const argon2_instance_t *instance, argon2_position_t position);
|
||||
|
||||
/*
|
||||
* Function that fills the entire memory t_cost times based on the first two
|
||||
|
@ -221,6 +215,6 @@ void fill_segment(const argon2_instance_t *instance,
|
|||
* @param instance Pointer to the current instance
|
||||
* @return ARGON2_OK if successful, @context->state
|
||||
*/
|
||||
int fill_memory_blocks(argon2_instance_t *instance);
|
||||
int xmrig_ar2_fill_memory_blocks(argon2_instance_t *instance);
|
||||
|
||||
#endif
|
||||
|
|
4
src/3rdparty/argon2/lib/encoding.c
vendored
4
src/3rdparty/argon2/lib/encoding.c
vendored
|
@ -323,7 +323,7 @@ int decode_string(argon2_context *ctx, const char *str, argon2_type type) {
|
|||
ctx->flags = ARGON2_DEFAULT_FLAGS;
|
||||
|
||||
/* On return, must have valid context */
|
||||
validation_result = validate_inputs(ctx);
|
||||
validation_result = xmrig_ar2_validate_inputs(ctx);
|
||||
if (validation_result != ARGON2_OK) {
|
||||
return validation_result;
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ int encode_string(char *dst, size_t dst_len, argon2_context *ctx,
|
|||
} while ((void)0, 0)
|
||||
|
||||
const char* type_string = argon2_type2string(type, 0);
|
||||
int validation_result = validate_inputs(ctx);
|
||||
int validation_result = xmrig_ar2_validate_inputs(ctx);
|
||||
|
||||
if (!type_string) {
|
||||
return ARGON2_ENCODING_FAIL;
|
||||
|
|
82
src/3rdparty/argon2/lib/impl-select.c
vendored
82
src/3rdparty/argon2/lib/impl-select.c
vendored
|
@ -2,79 +2,81 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "impl-select.h"
|
||||
|
||||
#include "3rdparty/argon2.h"
|
||||
|
||||
#define BENCH_SAMPLES 1024
|
||||
|
||||
extern uint64_t uv_hrtime(void);
|
||||
|
||||
|
||||
#define BENCH_SAMPLES 1024U
|
||||
#define BENCH_MEM_BLOCKS 512
|
||||
|
||||
static argon2_impl selected_argon_impl = {
|
||||
"default", NULL, fill_segment_default
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
|
||||
static argon2_impl selected_argon_impl = { "default", NULL, fill_segment_default };
|
||||
|
||||
|
||||
/* the benchmark routine is not thread-safe, so we can use a global var here: */
|
||||
static block memory[BENCH_MEM_BLOCKS];
|
||||
|
||||
static uint64_t benchmark_impl(const argon2_impl *impl) {
|
||||
clock_t time;
|
||||
unsigned int i;
|
||||
uint64_t bench;
|
||||
argon2_instance_t instance;
|
||||
argon2_position_t pos;
|
||||
|
||||
static uint64_t benchmark_impl(const argon2_impl *impl) {
|
||||
memset(memory, 0, sizeof(memory));
|
||||
|
||||
instance.version = ARGON2_VERSION_NUMBER;
|
||||
instance.memory = memory;
|
||||
instance.passes = 1;
|
||||
instance.memory_blocks = BENCH_MEM_BLOCKS;
|
||||
argon2_instance_t instance;
|
||||
instance.version = ARGON2_VERSION_NUMBER;
|
||||
instance.memory = memory;
|
||||
instance.passes = 1;
|
||||
instance.memory_blocks = BENCH_MEM_BLOCKS;
|
||||
instance.segment_length = BENCH_MEM_BLOCKS / ARGON2_SYNC_POINTS;
|
||||
instance.lane_length = instance.segment_length * ARGON2_SYNC_POINTS;
|
||||
instance.lanes = 1;
|
||||
instance.threads = 1;
|
||||
instance.type = Argon2_i;
|
||||
instance.lane_length = instance.segment_length * ARGON2_SYNC_POINTS;
|
||||
instance.lanes = 1;
|
||||
instance.threads = 1;
|
||||
instance.type = Argon2_id;
|
||||
|
||||
pos.lane = 0;
|
||||
pos.pass = 0;
|
||||
pos.slice = 0;
|
||||
pos.index = 0;
|
||||
argon2_position_t pos;
|
||||
pos.lane = 0;
|
||||
pos.pass = 0;
|
||||
pos.slice = 0;
|
||||
pos.index = 0;
|
||||
|
||||
/* warm-up cache: */
|
||||
impl->fill_segment(&instance, pos);
|
||||
|
||||
/* OK, now measure: */
|
||||
bench = 0;
|
||||
time = clock();
|
||||
for (i = 0; i < BENCH_SAMPLES; i++) {
|
||||
const uint64_t time = uv_hrtime();
|
||||
|
||||
for (uint32_t i = 0; i < BENCH_SAMPLES; i++) {
|
||||
impl->fill_segment(&instance, pos);
|
||||
}
|
||||
time = clock() - time;
|
||||
bench = (uint64_t)time;
|
||||
return bench;
|
||||
|
||||
return uv_hrtime() - time;
|
||||
}
|
||||
|
||||
|
||||
void argon2_select_impl()
|
||||
{
|
||||
argon2_impl_list impls;
|
||||
unsigned int i;
|
||||
const argon2_impl *best_impl = NULL;
|
||||
uint64_t best_bench = UINT_MAX;
|
||||
|
||||
argon2_get_impl_list(&impls);
|
||||
|
||||
for (i = 0; i < impls.count; i++) {
|
||||
for (uint32_t i = 0; i < impls.count; i++) {
|
||||
const argon2_impl *impl = &impls.entries[i];
|
||||
uint64_t bench;
|
||||
|
||||
if (impl->check != NULL && !impl->check()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
bench = benchmark_impl(impl);
|
||||
|
||||
const uint64_t bench = benchmark_impl(impl);
|
||||
if (bench < best_bench) {
|
||||
best_bench = bench;
|
||||
best_impl = impl;
|
||||
best_impl = impl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,11 +85,13 @@ void argon2_select_impl()
|
|||
}
|
||||
}
|
||||
|
||||
void fill_segment(const argon2_instance_t *instance, argon2_position_t position)
|
||||
|
||||
void xmrig_ar2_fill_segment(const argon2_instance_t *instance, argon2_position_t position)
|
||||
{
|
||||
selected_argon_impl.fill_segment(instance, position);
|
||||
}
|
||||
|
||||
|
||||
const char *argon2_get_impl_name()
|
||||
{
|
||||
return selected_argon_impl.name;
|
||||
|
@ -97,14 +101,12 @@ const char *argon2_get_impl_name()
|
|||
int argon2_select_impl_by_name(const char *name)
|
||||
{
|
||||
argon2_impl_list impls;
|
||||
unsigned int i;
|
||||
|
||||
argon2_get_impl_list(&impls);
|
||||
|
||||
for (i = 0; i < impls.count; i++) {
|
||||
for (uint32_t i = 0; i < impls.count; i++) {
|
||||
const argon2_impl *impl = &impls.entries[i];
|
||||
|
||||
if (strcmp(impl->name, name) == 0) {
|
||||
if (strcasecmp(impl->name, name) == 0) {
|
||||
selected_argon_impl = *impl;
|
||||
|
||||
return 1;
|
||||
|
|
128
src/3rdparty/http-parser/http_parser.c
vendored
128
src/3rdparty/http-parser/http_parser.c
vendored
|
@ -381,7 +381,10 @@ enum header_states
|
|||
, h_transfer_encoding
|
||||
, h_upgrade
|
||||
|
||||
, h_matching_transfer_encoding_token_start
|
||||
, h_matching_transfer_encoding_chunked
|
||||
, h_matching_transfer_encoding_token
|
||||
|
||||
, h_matching_connection_token_start
|
||||
, h_matching_connection_keep_alive
|
||||
, h_matching_connection_close
|
||||
|
@ -1257,9 +1260,9 @@ reexecute:
|
|||
|
||||
switch (parser->header_state) {
|
||||
case h_general: {
|
||||
size_t limit = data + len - p;
|
||||
limit = MIN(limit, max_header_size);
|
||||
while (p+1 < data + limit && TOKEN(p[1])) {
|
||||
size_t left = data + len - p;
|
||||
const char* pe = p + MIN(left, max_header_size);
|
||||
while (p+1 < pe && TOKEN(p[1])) {
|
||||
p++;
|
||||
}
|
||||
break;
|
||||
|
@ -1335,6 +1338,7 @@ reexecute:
|
|||
parser->header_state = h_general;
|
||||
} else if (parser->index == sizeof(TRANSFER_ENCODING)-2) {
|
||||
parser->header_state = h_transfer_encoding;
|
||||
parser->flags |= F_TRANSFER_ENCODING;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1416,10 +1420,14 @@ reexecute:
|
|||
if ('c' == c) {
|
||||
parser->header_state = h_matching_transfer_encoding_chunked;
|
||||
} else {
|
||||
parser->header_state = h_general;
|
||||
parser->header_state = h_matching_transfer_encoding_token;
|
||||
}
|
||||
break;
|
||||
|
||||
/* Multi-value `Transfer-Encoding` header */
|
||||
case h_matching_transfer_encoding_token_start:
|
||||
break;
|
||||
|
||||
case h_content_length:
|
||||
if (UNLIKELY(!IS_NUM(ch))) {
|
||||
SET_ERRNO(HPE_INVALID_CONTENT_LENGTH);
|
||||
|
@ -1496,28 +1504,25 @@ reexecute:
|
|||
|
||||
switch (h_state) {
|
||||
case h_general:
|
||||
{
|
||||
const char* p_cr;
|
||||
const char* p_lf;
|
||||
size_t limit = data + len - p;
|
||||
{
|
||||
size_t left = data + len - p;
|
||||
const char* pe = p + MIN(left, max_header_size);
|
||||
|
||||
limit = MIN(limit, max_header_size);
|
||||
|
||||
p_cr = (const char*) memchr(p, CR, limit);
|
||||
p_lf = (const char*) memchr(p, LF, limit);
|
||||
if (p_cr != NULL) {
|
||||
if (p_lf != NULL && p_cr >= p_lf)
|
||||
p = p_lf;
|
||||
else
|
||||
p = p_cr;
|
||||
} else if (UNLIKELY(p_lf != NULL)) {
|
||||
p = p_lf;
|
||||
} else {
|
||||
p = data + len;
|
||||
for (; p != pe; p++) {
|
||||
ch = *p;
|
||||
if (ch == CR || ch == LF) {
|
||||
--p;
|
||||
break;
|
||||
}
|
||||
if (!lenient && !IS_HEADER_CHAR(ch)) {
|
||||
SET_ERRNO(HPE_INVALID_HEADER_TOKEN);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
if (p == data + len)
|
||||
--p;
|
||||
break;
|
||||
}
|
||||
--p;
|
||||
break;
|
||||
}
|
||||
|
||||
case h_connection:
|
||||
case h_transfer_encoding:
|
||||
|
@ -1566,16 +1571,41 @@ reexecute:
|
|||
goto error;
|
||||
|
||||
/* Transfer-Encoding: chunked */
|
||||
case h_matching_transfer_encoding_token_start:
|
||||
/* looking for 'Transfer-Encoding: chunked' */
|
||||
if ('c' == c) {
|
||||
h_state = h_matching_transfer_encoding_chunked;
|
||||
} else if (STRICT_TOKEN(c)) {
|
||||
/* TODO(indutny): similar code below does this, but why?
|
||||
* At the very least it seems to be inconsistent given that
|
||||
* h_matching_transfer_encoding_token does not check for
|
||||
* `STRICT_TOKEN`
|
||||
*/
|
||||
h_state = h_matching_transfer_encoding_token;
|
||||
} else if (c == ' ' || c == '\t') {
|
||||
/* Skip lws */
|
||||
} else {
|
||||
h_state = h_general;
|
||||
}
|
||||
break;
|
||||
|
||||
case h_matching_transfer_encoding_chunked:
|
||||
parser->index++;
|
||||
if (parser->index > sizeof(CHUNKED)-1
|
||||
|| c != CHUNKED[parser->index]) {
|
||||
h_state = h_general;
|
||||
h_state = h_matching_transfer_encoding_token;
|
||||
} else if (parser->index == sizeof(CHUNKED)-2) {
|
||||
h_state = h_transfer_encoding_chunked;
|
||||
}
|
||||
break;
|
||||
|
||||
case h_matching_transfer_encoding_token:
|
||||
if (ch == ',') {
|
||||
h_state = h_matching_transfer_encoding_token_start;
|
||||
parser->index = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case h_matching_connection_token_start:
|
||||
/* looking for 'Connection: keep-alive' */
|
||||
if (c == 'k') {
|
||||
|
@ -1634,7 +1664,7 @@ reexecute:
|
|||
break;
|
||||
|
||||
case h_transfer_encoding_chunked:
|
||||
if (ch != ' ') h_state = h_general;
|
||||
if (ch != ' ') h_state = h_matching_transfer_encoding_token;
|
||||
break;
|
||||
|
||||
case h_connection_keep_alive:
|
||||
|
@ -1768,12 +1798,17 @@ reexecute:
|
|||
REEXECUTE();
|
||||
}
|
||||
|
||||
/* Cannot use chunked encoding and a content-length header together
|
||||
per the HTTP specification. */
|
||||
if ((parser->flags & F_CHUNKED) &&
|
||||
/* Cannot us transfer-encoding and a content-length header together
|
||||
per the HTTP specification. (RFC 7230 Section 3.3.3) */
|
||||
if ((parser->flags & F_TRANSFER_ENCODING) &&
|
||||
(parser->flags & F_CONTENTLENGTH)) {
|
||||
SET_ERRNO(HPE_UNEXPECTED_CONTENT_LENGTH);
|
||||
goto error;
|
||||
/* Allow it for lenient parsing as long as `Transfer-Encoding` is
|
||||
* not `chunked`
|
||||
*/
|
||||
if (!lenient || (parser->flags & F_CHUNKED)) {
|
||||
SET_ERRNO(HPE_UNEXPECTED_CONTENT_LENGTH);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
UPDATE_STATE(s_headers_done);
|
||||
|
@ -1848,8 +1883,31 @@ reexecute:
|
|||
UPDATE_STATE(NEW_MESSAGE());
|
||||
CALLBACK_NOTIFY(message_complete);
|
||||
} else if (parser->flags & F_CHUNKED) {
|
||||
/* chunked encoding - ignore Content-Length header */
|
||||
/* chunked encoding - ignore Content-Length header,
|
||||
* prepare for a chunk */
|
||||
UPDATE_STATE(s_chunk_size_start);
|
||||
} else if (parser->flags & F_TRANSFER_ENCODING) {
|
||||
if (parser->type == HTTP_REQUEST && !lenient) {
|
||||
/* RFC 7230 3.3.3 */
|
||||
|
||||
/* If a Transfer-Encoding header field
|
||||
* is present in a request and the chunked transfer coding is not
|
||||
* the final encoding, the message body length cannot be determined
|
||||
* reliably; the server MUST respond with the 400 (Bad Request)
|
||||
* status code and then close the connection.
|
||||
*/
|
||||
SET_ERRNO(HPE_INVALID_TRANSFER_ENCODING);
|
||||
RETURN(p - data); /* Error */
|
||||
} else {
|
||||
/* RFC 7230 3.3.3 */
|
||||
|
||||
/* If a Transfer-Encoding header field is present in a response and
|
||||
* the chunked transfer coding is not the final encoding, the
|
||||
* message body length is determined by reading the connection until
|
||||
* it is closed by the server.
|
||||
*/
|
||||
UPDATE_STATE(s_body_identity_eof);
|
||||
}
|
||||
} else {
|
||||
if (parser->content_length == 0) {
|
||||
/* Content-Length header given but zero: Content-Length: 0\r\n */
|
||||
|
@ -2103,6 +2161,12 @@ http_message_needs_eof (const http_parser *parser)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* RFC 7230 3.3.3, see `s_headers_almost_done` */
|
||||
if ((parser->flags & F_TRANSFER_ENCODING) &&
|
||||
(parser->flags & F_CHUNKED) == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((parser->flags & F_CHUNKED) || parser->content_length != ULLONG_MAX) {
|
||||
return 0;
|
||||
}
|
||||
|
|
7
src/3rdparty/http-parser/http_parser.h
vendored
7
src/3rdparty/http-parser/http_parser.h
vendored
|
@ -27,7 +27,7 @@ extern "C" {
|
|||
/* 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 0
|
||||
#define HTTP_PARSER_VERSION_PATCH 3
|
||||
|
||||
#include <stddef.h>
|
||||
#if defined(_WIN32) && !defined(__MINGW32__) && \
|
||||
|
@ -225,6 +225,7 @@ enum flags
|
|||
, F_UPGRADE = 1 << 5
|
||||
, F_SKIPBODY = 1 << 6
|
||||
, F_CONTENTLENGTH = 1 << 7
|
||||
, F_TRANSFER_ENCODING = 1 << 8
|
||||
};
|
||||
|
||||
|
||||
|
@ -271,6 +272,8 @@ enum flags
|
|||
"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") \
|
||||
|
@ -293,11 +296,11 @@ enum http_errno {
|
|||
struct http_parser {
|
||||
/** PRIVATE **/
|
||||
unsigned int type : 2; /* enum http_parser_type */
|
||||
unsigned int flags : 8; /* F_* values from 'flags' enum; semi-public */
|
||||
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) */
|
||||
|
|
1
src/3rdparty/hwloc/AUTHORS
vendored
1
src/3rdparty/hwloc/AUTHORS
vendored
|
@ -21,6 +21,7 @@ Nathalie Furmento CNRS
|
|||
Bryon Gloden
|
||||
Brice Goglin Inria
|
||||
Gilles Gouaillardet RIST
|
||||
Valentin Hoyet Inria
|
||||
Joshua Hursey UWL
|
||||
Alexey Kardashevskiy IBM
|
||||
Rob Latham ANL
|
||||
|
|
2
src/3rdparty/hwloc/CMakeLists.txt
vendored
2
src/3rdparty/hwloc/CMakeLists.txt
vendored
|
@ -5,7 +5,7 @@ include_directories(include)
|
|||
include_directories(src)
|
||||
|
||||
add_definitions(/D_CRT_SECURE_NO_WARNINGS)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
|
||||
set(CMAKE_C_FLAGS_RELEASE "/MT /O2 /Ob2 /DNDEBUG")
|
||||
|
||||
set(HEADERS
|
||||
include/hwloc.h
|
||||
|
|
176
src/3rdparty/hwloc/NEWS
vendored
176
src/3rdparty/hwloc/NEWS
vendored
|
@ -1,5 +1,5 @@
|
|||
Copyright © 2009 CNRS
|
||||
Copyright © 2009-2019 Inria. All rights reserved.
|
||||
Copyright © 2009-2020 Inria. All rights reserved.
|
||||
Copyright © 2009-2013 Université Bordeaux
|
||||
Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
|
||||
|
||||
|
@ -13,8 +13,117 @@ $HEADER$
|
|||
|
||||
This file contains the main features as well as overviews of specific
|
||||
bug fixes (and other actions) for each version of hwloc since version
|
||||
0.9 (as initially released as "libtopology", then re-branded to "hwloc"
|
||||
in v0.9.1).
|
||||
0.9.
|
||||
|
||||
|
||||
Version 2.2.0
|
||||
-------------
|
||||
* API
|
||||
+ Add hwloc_bitmap_singlify_by_core() to remove SMT from a given cpuset,
|
||||
thanks to Florian Reynier for the suggestion.
|
||||
+ Add --enable-32bits-pci-domain to stop ignoring PCI devices with domain
|
||||
>16bits (e.g. 10000:02:03.4). Enabling this option breaks the library ABI.
|
||||
Thanks to Dylan Simon for the help.
|
||||
* Backends
|
||||
+ Add support for Linux cgroups v2.
|
||||
+ Add NUMA support for FreeBSD.
|
||||
+ Add get_last_cpu_location support for FreeBSD.
|
||||
+ Remove support for Intel Xeon Phi (MIC, Knights Corner) co-processors.
|
||||
* Tools
|
||||
+ Add --uid to filter the hwloc-ps output by uid on Linux.
|
||||
+ Add a GRAPHICAL OUTPUT section in the manpage of lstopo.
|
||||
* Misc
|
||||
+ Use the native dlopen instead of libltdl,
|
||||
unless --disable-plugin-dlopen is passed at configure time.
|
||||
|
||||
|
||||
Version 2.1.0
|
||||
-------------
|
||||
* API
|
||||
+ Add a new "Die" object (HWLOC_OBJ_DIE) for upcoming x86 processors
|
||||
with multiple dies per package, in the x86 and Linux backends.
|
||||
+ Add the new HWLOC_OBJ_MEMCACHE object type for memory-side caches.
|
||||
- They are filtered-out by default, except in command-line tools.
|
||||
- They are only available on very recent platforms running Linux 5.2+
|
||||
and uptodate ACPI tables.
|
||||
- The KNL MCDRAM in cache mode is still exposed as a L3 unless
|
||||
HWLOC_KNL_MSCACHE_L3=0 in the environment.
|
||||
+ Add HWLOC_RESTRICT_FLAG_BYNODESET and _REMOVE_MEMLESS for restricting
|
||||
topologies based on some memory nodes.
|
||||
+ Add hwloc_topology_set_components() for blacklisting some components
|
||||
from being enabled in a topology.
|
||||
+ Add hwloc_bitmap_nr_ulongs() and hwloc_bitmap_from/to_ulongs(),
|
||||
thanks to Junchao Zhang for the suggestion.
|
||||
+ Improve the API for dealing with disallowed resources
|
||||
- HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM is replaced with FLAG_INCLUDE_DISALLOWED
|
||||
and --whole-system command-line options with --disallowed.
|
||||
. Former names are still accepted for backward compatibility.
|
||||
- Add hwloc_topology_allow() for changing allowed sets after load().
|
||||
- Add the HWLOC_ALLOW=all environment variable to totally ignore
|
||||
administrative restrictions such as Linux Cgroups.
|
||||
- Add disallowed_pu and disallowed_numa bits to the discovery support
|
||||
structure.
|
||||
+ Group objects have a new "dont_merge" attribute to prevent them from
|
||||
being automatically merged with identical parent or children.
|
||||
+ Add more distances-related features:
|
||||
- Add hwloc_distances_get_name() to retrieve a string describing
|
||||
what a distances structure contain.
|
||||
- Add hwloc_distances_get_by_name() to retrieve distances structures
|
||||
based on their name.
|
||||
- Add hwloc_distances_release_remove()
|
||||
- Distances may now cover objects of different types with new kind
|
||||
HWLOC_DISTANCES_KIND_HETEROGENEOUS_TYPES.
|
||||
* Backends
|
||||
+ Add support for Linux 5.3 new sysfs cpu topology files with Die information.
|
||||
+ Add support for Intel v2 Extended Topology Enumeration in the x86 backend.
|
||||
+ Improve memory locality on Linux by using HMAT initiators (exposed
|
||||
since Linux 5.2+), and NUMA distances for CPU-less NUMA nodes.
|
||||
+ The x86 backend now properly handles offline CPUs.
|
||||
+ Detect the locality of NVIDIA GPU OpenCL devices.
|
||||
+ Ignore NUMA nodes that correspond to NVIDIA GPU by default.
|
||||
- They may be unignored if HWLOC_KEEP_NVIDIA_GPU_NUMA_NODES=1 in the environment.
|
||||
- Fix their CPU locality and add info attributes to identify them.
|
||||
Thanks to Max Katz and Edgar Leon for the help.
|
||||
+ Add support for IBM S/390 drawers.
|
||||
+ Rework the heuristics for discovering KNL Cluster and Memory modes
|
||||
to stop assuming all CPUs are online (required for mOS support).
|
||||
Thanks to Sharath K Bhat for testing patches.
|
||||
+ Ignore NUMA node information from AMD topoext in the x86 backend,
|
||||
unless HWLOC_X86_TOPOEXT_NUMANODES=1 is set in the environment.
|
||||
+ Expose Linux DAX devices as hwloc Block OS devices.
|
||||
+ Remove support for /proc/cpuinfo-only topology discovery in Linux
|
||||
kernel prior to 2.6.16.
|
||||
+ Disable POWER device-tree-based topology on Linux by default.
|
||||
- It may be reenabled by setting HWLOC_USE_DT=1 in the environment.
|
||||
+ Discovery components are now divided in phases that may be individually
|
||||
blacklisted.
|
||||
- The linuxio component has been merged back into the linux component.
|
||||
* Tools
|
||||
+ lstopo
|
||||
- lstopo factorizes objects by default in the graphical output when
|
||||
there are more than 4 identical children.
|
||||
. New options --no-factorize and --factorize may be used to configure this.
|
||||
. Hit the 'f' key to disable factorizing in interactive outputs.
|
||||
- Both logical and OS/physical indexes are now displayed by default
|
||||
for PU and NUMA nodes.
|
||||
- The X11 and Windows interactive outputs support many keyboard
|
||||
shortcuts to dynamically customize the attributes, legend, etc.
|
||||
- Add --linespacing and change default margins and linespacing.
|
||||
- Add --allow for changing allowed sets.
|
||||
- Add a native SVG backend. Its graphical output may be slightly less
|
||||
pretty than Cairo (still used by default if available) but the SVG
|
||||
code provides attributes to manipulate objects from HTML/JS.
|
||||
See dynamic_SVG_example.html for an example.
|
||||
+ Add --nodeset options to hwloc-calc for converting between cpusets and
|
||||
nodesets.
|
||||
+ Add --no-smt to lstopo, hwloc-bind and hwloc-calc to ignore multiple
|
||||
PU in SMT cores.
|
||||
+ hwloc-annotate may annotate multiple locations at once.
|
||||
+ Add a HTML/JS version of hwloc-ps. See contrib/hwloc-ps.www/README.
|
||||
+ Add bash completions.
|
||||
* Misc
|
||||
+ Add several FAQ entries in "Compatibility between hwloc versions"
|
||||
about API version, ABI, XML, Synthetic strings, and shmem topologies.
|
||||
|
||||
|
||||
Version 2.0.4 (also included in 1.11.13 when appropriate)
|
||||
|
@ -214,6 +323,54 @@ Version 2.0.0
|
|||
+ hwloc now requires a C99 compliant compiler.
|
||||
|
||||
|
||||
Version 1.11.13 (also included in 2.0.4)
|
||||
---------------
|
||||
* Add support for Linux 5.3 new sysfs cpu topology files with Die information.
|
||||
* Add support for Intel v2 Extended Topology Enumeration in the x86 backend.
|
||||
* Tiles, Modules and Dies are exposed as Groups for now.
|
||||
+ HWLOC_DONT_MERGE_DIE_GROUPS=1 may be set in the environment to prevent
|
||||
Die groups from being automatically merged with identical parent or children.
|
||||
* Ignore NUMA node information from AMD topoext in the x86 backend,
|
||||
unless HWLOC_X86_TOPOEXT_NUMANODES=1 is set in the environment.
|
||||
* Group objects have a new "dont_merge" attribute to prevent them from
|
||||
being automatically merged with identical parent or children.
|
||||
|
||||
|
||||
Version 1.11.12 (also included in 2.0.3)
|
||||
---------------
|
||||
* Fix a corner case of hwloc_topology_restrict() where children would
|
||||
become out-of-order.
|
||||
* Fix the return length of export_xmlbuffer() functions to always
|
||||
include the ending \0.
|
||||
|
||||
|
||||
Version 1.11.11 (also included in 2.0.2)
|
||||
---------------
|
||||
* Add support for Hygon Dhyana processors in the x86 backend,
|
||||
thanks to Pu Wen for the patch.
|
||||
* Fix symbol renaming to also rename internal components,
|
||||
thanks to Evan Ramos for the patch.
|
||||
* Fix build on HP-UX, thanks to Richard Lloyd for reporting the issues.
|
||||
* Detect PCI link speed without being root on Linux >= 4.13.
|
||||
|
||||
|
||||
Version 1.11.10 (also included in 2.0.1)
|
||||
---------------
|
||||
* Fix detection of cores and hyperthreads on Mac OS X.
|
||||
* Serialize pciaccess discovery to fix concurrent topology loads in
|
||||
multiple threads.
|
||||
* Fix first touch area memory binding on Linux when thread memory
|
||||
binding is different.
|
||||
* Some minor fixes to memory binding.
|
||||
* Fix hwloc-dump-hwdata to only process SMBIOS information that correspond
|
||||
to the KNL and KNM configuration.
|
||||
* Add a heuristic for guessing KNL/KNM memory and cluster modes when
|
||||
hwloc-dump-hwdata could not run as root earlier.
|
||||
* Fix discovery of NVMe OS devices on Linux >= 4.0.
|
||||
* Add get_area_memlocation() on Windows.
|
||||
* Add CPUVendor, Model, ... attributes on Mac OS X.
|
||||
|
||||
|
||||
Version 1.11.9
|
||||
--------------
|
||||
* Add support for Zhaoxin ZX-C and ZX-D processors in the x86 backend,
|
||||
|
@ -941,7 +1098,7 @@ Version 1.6.0
|
|||
+ Add a section about Synthetic topologies in the documentation.
|
||||
|
||||
|
||||
Version 1.5.2 (some of these changes are in v1.6.2 but not in v1.6)
|
||||
Version 1.5.2 (some of these changes are in 1.6.2 but not in 1.6)
|
||||
-------------
|
||||
* Use libpciaccess instead of pciutils/libpci by default for I/O discovery.
|
||||
pciutils/libpci is only used if --enable-libpci is given to configure
|
||||
|
@ -1076,9 +1233,8 @@ Version 1.4.2
|
|||
for most of them.
|
||||
|
||||
|
||||
Version 1.4.1
|
||||
Version 1.4.1 (contains all 1.3.2 changes)
|
||||
-------------
|
||||
* This release contains all changes from v1.3.2.
|
||||
* Fix hwloc_alloc_membind, thanks Karl Napf for reporting the issue.
|
||||
* Fix memory leaks in some get_membind() functions.
|
||||
* Fix helpers converting from Linux libnuma to hwloc (hwloc/linux-libnuma.h)
|
||||
|
@ -1091,7 +1247,7 @@ Version 1.4.1
|
|||
issues.
|
||||
|
||||
|
||||
Version 1.4.0 (does not contain all v1.3.2 changes)
|
||||
Version 1.4.0 (does not contain all 1.3.2 changes)
|
||||
-------------
|
||||
* Major features
|
||||
+ Add "custom" interface and "assembler" tools to build multi-node
|
||||
|
@ -1536,7 +1692,7 @@ Version 1.0.0
|
|||
|
||||
|
||||
Version 0.9.4 (unreleased)
|
||||
--------------------------
|
||||
-------------
|
||||
|
||||
* Fix reseting colors to normal in lstopo -.txt output.
|
||||
* Fix Linux pthread_t binding error report.
|
||||
|
@ -1593,7 +1749,7 @@ Version 0.9.1
|
|||
the physical location of IB devices.
|
||||
|
||||
|
||||
Version 0.9 (libtopology)
|
||||
-------------------------
|
||||
Version 0.9 (formerly named "libtopology")
|
||||
-----------
|
||||
|
||||
* First release.
|
||||
|
|
8
src/3rdparty/hwloc/VERSION
vendored
8
src/3rdparty/hwloc/VERSION
vendored
|
@ -8,8 +8,8 @@
|
|||
# Please update HWLOC_VERSION* in contrib/windows/hwloc_config.h too.
|
||||
|
||||
major=2
|
||||
minor=0
|
||||
release=4
|
||||
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
|
||||
|
@ -22,7 +22,7 @@ greek=
|
|||
|
||||
# The date when this release was created
|
||||
|
||||
date="Jun 03, 2019"
|
||||
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
|
||||
|
@ -41,7 +41,7 @@ snapshot_version=${major}.${minor}.${release}${greek}-git
|
|||
# 2. Version numbers are described in the Libtool current:revision:age
|
||||
# format.
|
||||
|
||||
libhwloc_so_version=15:3:0
|
||||
libhwloc_so_version=17:0:2
|
||||
libnetloc_so_version=0:0:0
|
||||
|
||||
# Please also update the <TargetName> lines in contrib/windows/libhwloc.vcxproj
|
||||
|
|
221
src/3rdparty/hwloc/include/hwloc.h
vendored
221
src/3rdparty/hwloc/include/hwloc.h
vendored
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2019 Inria. All rights reserved.
|
||||
* Copyright © 2009-2020 Inria. All rights reserved.
|
||||
* Copyright © 2009-2012 Université Bordeaux
|
||||
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
|
@ -53,7 +53,8 @@
|
|||
#ifndef HWLOC_H
|
||||
#define HWLOC_H
|
||||
|
||||
#include <hwloc/autogen/config.h>
|
||||
#include "hwloc/autogen/config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -62,13 +63,13 @@
|
|||
/*
|
||||
* Symbol transforms
|
||||
*/
|
||||
#include <hwloc/rename.h>
|
||||
#include "hwloc/rename.h"
|
||||
|
||||
/*
|
||||
* Bitmap definitions
|
||||
*/
|
||||
|
||||
#include <hwloc/bitmap.h>
|
||||
#include "hwloc/bitmap.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -86,13 +87,13 @@ extern "C" {
|
|||
* actually modifies the API.
|
||||
*
|
||||
* Users may check for available features at build time using this number
|
||||
* (see \ref faq_upgrade).
|
||||
* (see \ref faq_version_api).
|
||||
*
|
||||
* \note This should not be confused with HWLOC_VERSION, the library version.
|
||||
* Two stable releases of the same series usually have the same ::HWLOC_API_VERSION
|
||||
* even if their HWLOC_VERSION are different.
|
||||
*/
|
||||
#define HWLOC_API_VERSION 0x00020000
|
||||
#define HWLOC_API_VERSION 0x00020100
|
||||
|
||||
/** \brief Indicate at runtime which hwloc API version was used at build time.
|
||||
*
|
||||
|
@ -101,7 +102,7 @@ extern "C" {
|
|||
HWLOC_DECLSPEC unsigned hwloc_get_api_version(void);
|
||||
|
||||
/** \brief Current component and plugin ABI version (see hwloc/plugins.h) */
|
||||
#define HWLOC_COMPONENT_ABI 5
|
||||
#define HWLOC_COMPONENT_ABI 6
|
||||
|
||||
/** @} */
|
||||
|
||||
|
@ -172,8 +173,12 @@ typedef hwloc_const_bitmap_t hwloc_const_nodeset_t;
|
|||
* may be defined in the future! If you need to compare types, use
|
||||
* hwloc_compare_types() instead.
|
||||
*/
|
||||
#define HWLOC_OBJ_TYPE_MIN HWLOC_OBJ_MACHINE /**< \private Sentinel value */
|
||||
typedef enum {
|
||||
|
||||
/** \cond */
|
||||
#define HWLOC_OBJ_TYPE_MIN HWLOC_OBJ_MACHINE /* Sentinel value */
|
||||
/** \endcond */
|
||||
|
||||
HWLOC_OBJ_MACHINE, /**< \brief Machine.
|
||||
* A set of processors and memory with cache
|
||||
* coherency.
|
||||
|
@ -186,7 +191,8 @@ typedef enum {
|
|||
HWLOC_OBJ_PACKAGE, /**< \brief Physical package.
|
||||
* The physical package that usually gets inserted
|
||||
* into a socket on the motherboard.
|
||||
* A processor package usually contains multiple cores.
|
||||
* A processor package usually contains multiple cores,
|
||||
* and possibly some dies.
|
||||
*/
|
||||
HWLOC_OBJ_CORE, /**< \brief Core.
|
||||
* A computation unit (may be shared by several
|
||||
|
@ -233,6 +239,10 @@ typedef enum {
|
|||
* It is usually close to some cores (the corresponding objects
|
||||
* are descendants of the NUMA node object in the hwloc tree).
|
||||
*
|
||||
* This is the smallest object representing Memory resources,
|
||||
* it cannot have any child except Misc objects.
|
||||
* However it may have Memory-side cache parents.
|
||||
*
|
||||
* There is always at least one such object in the topology
|
||||
* even if the machine is not NUMA.
|
||||
*
|
||||
|
@ -245,7 +255,7 @@ typedef enum {
|
|||
*/
|
||||
|
||||
HWLOC_OBJ_BRIDGE, /**< \brief Bridge (filtered out by default).
|
||||
* Any bridge that connects the host or an I/O bus,
|
||||
* Any bridge (or PCI switch) that connects the host or an I/O bus,
|
||||
* to another I/O bus.
|
||||
* They are not added to the topology unless I/O discovery
|
||||
* is enabled with hwloc_topology_set_flags().
|
||||
|
@ -279,6 +289,24 @@ typedef enum {
|
|||
* Misc objects have NULL CPU and node sets.
|
||||
*/
|
||||
|
||||
HWLOC_OBJ_MEMCACHE, /**< \brief Memory-side cache (filtered out by default).
|
||||
* A cache in front of a specific NUMA node.
|
||||
*
|
||||
* This object always has at least one NUMA node as a memory child.
|
||||
*
|
||||
* Memory objects are not listed in the main children list,
|
||||
* but rather in the dedicated Memory children list.
|
||||
*
|
||||
* Memory-side cache have a special depth ::HWLOC_TYPE_DEPTH_MEMCACHE
|
||||
* instead of a normal depth just like other objects in the
|
||||
* main tree.
|
||||
*/
|
||||
|
||||
HWLOC_OBJ_DIE, /**< \brief Die within a physical package.
|
||||
* A subpart of the physical package, that contains multiple cores.
|
||||
* \hideinitializer
|
||||
*/
|
||||
|
||||
HWLOC_OBJ_TYPE_MAX /**< \private Sentinel value */
|
||||
} hwloc_obj_type_t;
|
||||
|
||||
|
@ -297,8 +325,8 @@ typedef enum hwloc_obj_bridge_type_e {
|
|||
|
||||
/** \brief Type of a OS device. */
|
||||
typedef enum hwloc_obj_osdev_type_e {
|
||||
HWLOC_OBJ_OSDEV_BLOCK, /**< \brief Operating system block device.
|
||||
* For instance "sda" on Linux. */
|
||||
HWLOC_OBJ_OSDEV_BLOCK, /**< \brief Operating system block device, or non-volatile memory device.
|
||||
* For instance "sda" or "dax2.0" on Linux. */
|
||||
HWLOC_OBJ_OSDEV_GPU, /**< \brief Operating system GPU device.
|
||||
* For instance ":0.0" for a GL display,
|
||||
* "card0" for a Linux DRM device. */
|
||||
|
@ -336,9 +364,8 @@ typedef enum hwloc_obj_osdev_type_e {
|
|||
*/
|
||||
HWLOC_DECLSPEC int hwloc_compare_types (hwloc_obj_type_t type1, hwloc_obj_type_t type2) __hwloc_attribute_const;
|
||||
|
||||
enum hwloc_compare_types_e {
|
||||
HWLOC_TYPE_UNORDERED = INT_MAX /**< \brief Value returned by hwloc_compare_types() when types can not be compared. \hideinitializer */
|
||||
};
|
||||
/** \brief Value returned by hwloc_compare_types() when types can not be compared. \hideinitializer */
|
||||
#define HWLOC_TYPE_UNORDERED INT_MAX
|
||||
|
||||
/** @} */
|
||||
|
||||
|
@ -434,9 +461,15 @@ struct hwloc_obj {
|
|||
* These children are listed in \p memory_first_child.
|
||||
*/
|
||||
struct hwloc_obj *memory_first_child; /**< \brief First Memory child.
|
||||
* NUMA nodes are listed here (\p memory_arity and \p memory_first_child)
|
||||
* NUMA nodes and Memory-side caches are listed here
|
||||
* (\p memory_arity and \p memory_first_child)
|
||||
* instead of in the normal children list.
|
||||
* See also hwloc_obj_type_is_memory().
|
||||
*
|
||||
* A memory hierarchy starts from a normal CPU-side object
|
||||
* (e.g. Package) and ends with NUMA nodes as leaves.
|
||||
* There might exist some memory-side caches between them
|
||||
* in the middle of the memory subtree.
|
||||
*/
|
||||
/**@}*/
|
||||
|
||||
|
@ -471,7 +504,7 @@ struct hwloc_obj {
|
|||
* object and known how (the children path between this object and the PU
|
||||
* objects).
|
||||
*
|
||||
* If the ::HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM configuration flag is set,
|
||||
* If the ::HWLOC_TOPOLOGY_FLAG_INCLUDE_DISALLOWED configuration flag is set,
|
||||
* some of these CPUs may not be allowed for binding,
|
||||
* see hwloc_topology_get_allowed_cpuset().
|
||||
*
|
||||
|
@ -483,7 +516,7 @@ struct hwloc_obj {
|
|||
*
|
||||
* This may include not only the same as the cpuset field, but also some CPUs for
|
||||
* which topology information is unknown or incomplete, some offlines CPUs, and
|
||||
* the CPUs that are ignored when the ::HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM flag
|
||||
* the CPUs that are ignored when the ::HWLOC_TOPOLOGY_FLAG_INCLUDE_DISALLOWED flag
|
||||
* is not set.
|
||||
* Thus no corresponding PU object may be found in the topology, because the
|
||||
* precise position is undefined. It is however known that it would be somewhere
|
||||
|
@ -501,7 +534,7 @@ struct hwloc_obj {
|
|||
*
|
||||
* In the end, these nodes are those that are close to the current object.
|
||||
*
|
||||
* If the ::HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM configuration flag is set,
|
||||
* If the ::HWLOC_TOPOLOGY_FLAG_INCLUDE_DISALLOWED configuration flag is set,
|
||||
* some of these nodes may not be allowed for allocation,
|
||||
* see hwloc_topology_get_allowed_nodeset().
|
||||
*
|
||||
|
@ -516,7 +549,7 @@ struct hwloc_obj {
|
|||
*
|
||||
* This may include not only the same as the nodeset field, but also some NUMA
|
||||
* nodes for which topology information is unknown or incomplete, some offlines
|
||||
* nodes, and the nodes that are ignored when the ::HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM
|
||||
* nodes, and the nodes that are ignored when the ::HWLOC_TOPOLOGY_FLAG_INCLUDE_DISALLOWED
|
||||
* flag is not set.
|
||||
* Thus no corresponding NUMA node object may be found in the topology, because the
|
||||
* precise position is undefined. It is however known that it would be
|
||||
|
@ -584,7 +617,11 @@ union hwloc_obj_attr_u {
|
|||
} group;
|
||||
/** \brief PCI Device specific Object Attributes */
|
||||
struct hwloc_pcidev_attr_s {
|
||||
unsigned short domain;
|
||||
#ifndef HWLOC_HAVE_32BITS_PCI_DOMAIN
|
||||
unsigned short domain; /* Only 16bits PCI domains are supported by default */
|
||||
#else
|
||||
unsigned int domain; /* 32bits PCI domain support break the library ABI, hence it's disabled by default */
|
||||
#endif
|
||||
unsigned char bus, dev, func;
|
||||
unsigned short class_id;
|
||||
unsigned short vendor_id, device_id, subvendor_id, subdevice_id;
|
||||
|
@ -599,7 +636,11 @@ union hwloc_obj_attr_u {
|
|||
hwloc_obj_bridge_type_t upstream_type;
|
||||
union {
|
||||
struct {
|
||||
unsigned short domain;
|
||||
#ifndef HWLOC_HAVE_32BITS_PCI_DOMAIN
|
||||
unsigned short domain; /* Only 16bits PCI domains are supported by default */
|
||||
#else
|
||||
unsigned int domain; /* 32bits PCI domain support break the library ABI, hence it's disabled by default */
|
||||
#endif
|
||||
unsigned char secondary_bus, subordinate_bus;
|
||||
} pci;
|
||||
} downstream;
|
||||
|
@ -770,7 +811,8 @@ enum hwloc_get_type_depth_e {
|
|||
HWLOC_TYPE_DEPTH_BRIDGE = -4, /**< \brief Virtual depth for bridge object level. \hideinitializer */
|
||||
HWLOC_TYPE_DEPTH_PCI_DEVICE = -5, /**< \brief Virtual depth for PCI device object level. \hideinitializer */
|
||||
HWLOC_TYPE_DEPTH_OS_DEVICE = -6, /**< \brief Virtual depth for software device object level. \hideinitializer */
|
||||
HWLOC_TYPE_DEPTH_MISC = -7 /**< \brief Virtual depth for Misc object. \hideinitializer */
|
||||
HWLOC_TYPE_DEPTH_MISC = -7, /**< \brief Virtual depth for Misc object. \hideinitializer */
|
||||
HWLOC_TYPE_DEPTH_MEMCACHE = -8 /**< \brief Virtual depth for MemCache object. \hideinitializer */
|
||||
};
|
||||
|
||||
/** \brief Return the depth of parents where memory objects are attached.
|
||||
|
@ -828,7 +870,8 @@ hwloc_get_type_or_above_depth (hwloc_topology_t topology, hwloc_obj_type_t type)
|
|||
|
||||
/** \brief Returns the type of objects at depth \p depth.
|
||||
*
|
||||
* \p depth should between 0 and hwloc_topology_get_depth()-1.
|
||||
* \p depth should between 0 and hwloc_topology_get_depth()-1,
|
||||
* or a virtual depth such as ::HWLOC_TYPE_DEPTH_NUMANODE.
|
||||
*
|
||||
* \return (hwloc_obj_type_t)-1 if depth \p depth does not exist.
|
||||
*/
|
||||
|
@ -1324,7 +1367,7 @@ HWLOC_DECLSPEC int hwloc_get_proc_last_cpu_location(hwloc_topology_t topology, h
|
|||
typedef enum {
|
||||
/** \brief Reset the memory allocation policy to the system default.
|
||||
* Depending on the operating system, this may correspond to
|
||||
* ::HWLOC_MEMBIND_FIRSTTOUCH (Linux),
|
||||
* ::HWLOC_MEMBIND_FIRSTTOUCH (Linux, FreeBSD),
|
||||
* or ::HWLOC_MEMBIND_BIND (AIX, HP-UX, Solaris, Windows).
|
||||
* This policy is never returned by get membind functions.
|
||||
* The nodeset argument is ignored.
|
||||
|
@ -1781,6 +1824,31 @@ HWLOC_DECLSPEC int hwloc_topology_set_xml(hwloc_topology_t __hwloc_restrict topo
|
|||
*/
|
||||
HWLOC_DECLSPEC int hwloc_topology_set_xmlbuffer(hwloc_topology_t __hwloc_restrict topology, const char * __hwloc_restrict buffer, int size);
|
||||
|
||||
/** \brief Flags to be passed to hwloc_topology_set_components()
|
||||
*/
|
||||
enum hwloc_topology_components_flag_e {
|
||||
/** \brief Blacklist the target component from being used.
|
||||
* \hideinitializer
|
||||
*/
|
||||
HWLOC_TOPOLOGY_COMPONENTS_FLAG_BLACKLIST = (1UL<<0)
|
||||
};
|
||||
|
||||
/** \brief Prevent a discovery component from being used for a topology.
|
||||
*
|
||||
* \p name is the name of the discovery component that should not be used
|
||||
* when loading topology \p topology. The name is a string such as "cuda".
|
||||
*
|
||||
* For components with multiple phases, it may also be suffixed with the name
|
||||
* of a phase, for instance "linux:io".
|
||||
*
|
||||
* \p flags should be ::HWLOC_TOPOLOGY_COMPONENTS_FLAG_BLACKLIST.
|
||||
*
|
||||
* This may be used to avoid expensive parts of the discovery process.
|
||||
* For instance, CUDA-specific discovery may be expensive and unneeded
|
||||
* while generic I/O discovery could still be useful.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_topology_set_components(hwloc_topology_t __hwloc_restrict topology, unsigned long flags, const char * __hwloc_restrict name);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
|
@ -1800,28 +1868,27 @@ HWLOC_DECLSPEC int hwloc_topology_set_xmlbuffer(hwloc_topology_t __hwloc_restric
|
|||
* They may also be returned by hwloc_topology_get_flags().
|
||||
*/
|
||||
enum hwloc_topology_flags_e {
|
||||
/** \brief Detect the whole system, ignore reservations.
|
||||
/** \brief Detect the whole system, ignore reservations, include disallowed objects.
|
||||
*
|
||||
* Gather all resources, even if some were disabled by the administrator.
|
||||
* For instance, ignore Linux Cgroup/Cpusets and gather all processors and memory nodes.
|
||||
*
|
||||
* When this flag is not set, PUs and NUMA nodes that are disallowed are not added to the topology.
|
||||
* Parent objects (package, core, cache, etc.) are added only if some of their children are allowed.
|
||||
* All existing PUs and NUMA nodes in the topology are allowed.
|
||||
* hwloc_topology_get_allowed_cpuset() and hwloc_topology_get_allowed_nodeset()
|
||||
* are equal to the root object cpuset and nodeset.
|
||||
*
|
||||
* When this flag is set, the actual sets of allowed PUs and NUMA nodes are given
|
||||
* by hwloc_topology_get_allowed_cpuset() and hwloc_topology_get_allowed_nodeset().
|
||||
* They may be smaller than the root object cpuset and nodeset.
|
||||
*
|
||||
* When this flag is not set, all existing PUs and NUMA nodes in the topology
|
||||
* are allowed. hwloc_topology_get_allowed_cpuset() and hwloc_topology_get_allowed_nodeset()
|
||||
* are equal to the root object cpuset and nodeset.
|
||||
*
|
||||
* If the current topology is exported to XML and reimported later, this flag
|
||||
* should be set again in the reimported topology so that disallowed resources
|
||||
* are reimported as well.
|
||||
* \hideinitializer
|
||||
*/
|
||||
HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM = (1UL<<0),
|
||||
HWLOC_TOPOLOGY_FLAG_INCLUDE_DISALLOWED = (1UL<<0),
|
||||
|
||||
/** \brief Assume that the selected backend provides the topology for the
|
||||
* system on which we are running.
|
||||
|
@ -1901,6 +1968,10 @@ struct hwloc_topology_discovery_support {
|
|||
unsigned char numa;
|
||||
/** \brief Detecting the amount of memory in NUMA nodes is supported. */
|
||||
unsigned char numa_memory;
|
||||
/** \brief Detecting and identifying PU objects that are not available to the current process is supported. */
|
||||
unsigned char disallowed_pu;
|
||||
/** \brief Detecting and identifying NUMA nodes that are not available to the current process is supported. */
|
||||
unsigned char disallowed_numa;
|
||||
};
|
||||
|
||||
/** \brief Flags describing actual PU binding support for this topology.
|
||||
|
@ -1998,7 +2069,7 @@ HWLOC_DECLSPEC const struct hwloc_topology_support *hwloc_topology_get_support(h
|
|||
*
|
||||
* By default, most objects are kept (::HWLOC_TYPE_FILTER_KEEP_ALL).
|
||||
* Instruction caches, I/O and Misc objects are ignored by default (::HWLOC_TYPE_FILTER_KEEP_NONE).
|
||||
* Group levels are ignored unless they bring structure (::HWLOC_TYPE_FILTER_KEEP_STRUCTURE).
|
||||
* Die and Group levels are ignored unless they bring structure (::HWLOC_TYPE_FILTER_KEEP_STRUCTURE).
|
||||
*
|
||||
* Note that group objects are also ignored individually (without the entire level)
|
||||
* when they do not bring structure.
|
||||
|
@ -2063,11 +2134,15 @@ HWLOC_DECLSPEC int hwloc_topology_get_type_filter(hwloc_topology_t topology, hwl
|
|||
*/
|
||||
HWLOC_DECLSPEC int hwloc_topology_set_all_types_filter(hwloc_topology_t topology, enum hwloc_type_filter_e filter);
|
||||
|
||||
/** \brief Set the filtering for all cache object types.
|
||||
/** \brief Set the filtering for all CPU cache object types.
|
||||
*
|
||||
* Memory-side caches are not involved since they are not CPU caches.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_topology_set_cache_types_filter(hwloc_topology_t topology, enum hwloc_type_filter_e filter);
|
||||
|
||||
/** \brief Set the filtering for all instruction cache object types.
|
||||
/** \brief Set the filtering for all CPU instruction cache object types.
|
||||
*
|
||||
* Memory-side caches are not involved since they are not CPU caches.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_topology_set_icache_types_filter(hwloc_topology_t topology, enum hwloc_type_filter_e filter);
|
||||
|
||||
|
@ -2106,10 +2181,24 @@ HWLOC_DECLSPEC void * hwloc_topology_get_userdata(hwloc_topology_t topology);
|
|||
enum hwloc_restrict_flags_e {
|
||||
/** \brief Remove all objects that became CPU-less.
|
||||
* By default, only objects that contain no PU and no memory are removed.
|
||||
* This flag may not be used with ::HWLOC_RESTRICT_FLAG_BYNODESET.
|
||||
* \hideinitializer
|
||||
*/
|
||||
HWLOC_RESTRICT_FLAG_REMOVE_CPULESS = (1UL<<0),
|
||||
|
||||
/** \brief Restrict by nodeset instead of CPU set.
|
||||
* Only keep objects whose nodeset is included or partially included in the given set.
|
||||
* This flag may not be used with ::HWLOC_RESTRICT_FLAG_REMOVE_CPULESS.
|
||||
*/
|
||||
HWLOC_RESTRICT_FLAG_BYNODESET = (1UL<<3),
|
||||
|
||||
/** \brief Remove all objects that became Memory-less.
|
||||
* By default, only objects that contain no PU and no memory are removed.
|
||||
* This flag may only be used with ::HWLOC_RESTRICT_FLAG_BYNODESET.
|
||||
* \hideinitializer
|
||||
*/
|
||||
HWLOC_RESTRICT_FLAG_REMOVE_MEMLESS = (1UL<<4),
|
||||
|
||||
/** \brief Move Misc objects to ancestors if their parents are removed during restriction.
|
||||
* If this flag is not set, Misc objects are removed when their parents are removed.
|
||||
* \hideinitializer
|
||||
|
@ -2123,28 +2212,70 @@ enum hwloc_restrict_flags_e {
|
|||
HWLOC_RESTRICT_FLAG_ADAPT_IO = (1UL<<2)
|
||||
};
|
||||
|
||||
/** \brief Restrict the topology to the given CPU set.
|
||||
/** \brief Restrict the topology to the given CPU set or nodeset.
|
||||
*
|
||||
* Topology \p topology is modified so as to remove all objects that
|
||||
* are not included (or partially included) in the CPU set \p cpuset.
|
||||
* are not included (or partially included) in the CPU set \p set.
|
||||
* All objects CPU and node sets are restricted accordingly.
|
||||
*
|
||||
* If ::HWLOC_RESTRICT_FLAG_BYNODESET is passed in \p flags,
|
||||
* \p set is considered a nodeset instead of a CPU set.
|
||||
*
|
||||
* \p flags is a OR'ed set of ::hwloc_restrict_flags_e.
|
||||
*
|
||||
* \note This call may not be reverted by restricting back to a larger
|
||||
* cpuset. Once dropped during restriction, objects may not be brought
|
||||
* set. Once dropped during restriction, objects may not be brought
|
||||
* back, except by loading another topology with hwloc_topology_load().
|
||||
*
|
||||
* \return 0 on success.
|
||||
*
|
||||
* \return -1 with errno set to EINVAL if the input cpuset is invalid.
|
||||
* \return -1 with errno set to EINVAL if the input set is invalid.
|
||||
* The topology is not modified in this case.
|
||||
*
|
||||
* \return -1 with errno set to ENOMEM on failure to allocate internal data.
|
||||
* The topology is reinitialized in this case. It should be either
|
||||
* destroyed with hwloc_topology_destroy() or configured and loaded again.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_topology_restrict(hwloc_topology_t __hwloc_restrict topology, hwloc_const_cpuset_t cpuset, unsigned long flags);
|
||||
HWLOC_DECLSPEC int hwloc_topology_restrict(hwloc_topology_t __hwloc_restrict topology, hwloc_const_bitmap_t set, unsigned long flags);
|
||||
|
||||
/** \brief Flags to be given to hwloc_topology_allow(). */
|
||||
enum hwloc_allow_flags_e {
|
||||
/** \brief Mark all objects as allowed in the topology.
|
||||
*
|
||||
* \p cpuset and \p nođeset given to hwloc_topology_allow() must be \c NULL.
|
||||
* \hideinitializer */
|
||||
HWLOC_ALLOW_FLAG_ALL = (1UL<<0),
|
||||
|
||||
/** \brief Only allow objects that are available to the current process.
|
||||
*
|
||||
* The topology must have ::HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM so that the set
|
||||
* of available resources can actually be retrieved from the operating system.
|
||||
*
|
||||
* \p cpuset and \p nođeset given to hwloc_topology_allow() must be \c NULL.
|
||||
* \hideinitializer */
|
||||
HWLOC_ALLOW_FLAG_LOCAL_RESTRICTIONS = (1UL<<1),
|
||||
|
||||
/** \brief Allow a custom set of objects, given to hwloc_topology_allow() as \p cpuset and/or \p nodeset parameters.
|
||||
* \hideinitializer */
|
||||
HWLOC_ALLOW_FLAG_CUSTOM = (1UL<<2)
|
||||
};
|
||||
|
||||
/** \brief Change the sets of allowed PUs and NUMA nodes in the topology.
|
||||
*
|
||||
* This function only works if the ::HWLOC_TOPOLOGY_FLAG_INCLUDE_DISALLOWED
|
||||
* was set on the topology. It does not modify any object, it only changes
|
||||
* the sets returned by hwloc_topology_get_allowed_cpuset() and
|
||||
* hwloc_topology_get_allowed_nodeset().
|
||||
*
|
||||
* It is notably useful when importing a topology from another process
|
||||
* running in a different Linux Cgroup.
|
||||
*
|
||||
* \p flags must be set to one flag among ::hwloc_allow_flags_e.
|
||||
*
|
||||
* \note Removing objects from a topology should rather be performed with
|
||||
* hwloc_topology_restrict().
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_topology_allow(hwloc_topology_t __hwloc_restrict topology, hwloc_const_cpuset_t cpuset, hwloc_const_nodeset_t nodeset, unsigned long flags);
|
||||
|
||||
/** \brief Add a MISC object as a leaf of the topology
|
||||
*
|
||||
|
@ -2250,21 +2381,21 @@ HWLOC_DECLSPEC int hwloc_obj_add_other_obj_sets(hwloc_obj_t dst, hwloc_obj_t src
|
|||
|
||||
|
||||
/* high-level helpers */
|
||||
#include <hwloc/helper.h>
|
||||
#include "hwloc/helper.h"
|
||||
|
||||
/* inline code of some functions above */
|
||||
#include <hwloc/inlines.h>
|
||||
#include "hwloc/inlines.h"
|
||||
|
||||
/* exporting to XML or synthetic */
|
||||
#include <hwloc/export.h>
|
||||
#include "hwloc/export.h"
|
||||
|
||||
/* distances */
|
||||
#include <hwloc/distances.h>
|
||||
#include "hwloc/distances.h"
|
||||
|
||||
/* topology diffs */
|
||||
#include <hwloc/diff.h>
|
||||
#include "hwloc/diff.h"
|
||||
|
||||
/* deprecated headers */
|
||||
#include <hwloc/deprecated.h>
|
||||
#include "hwloc/deprecated.h"
|
||||
|
||||
#endif /* HWLOC_H */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2018 Inria. All rights reserved.
|
||||
* 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.
|
||||
|
@ -11,10 +11,10 @@
|
|||
#ifndef HWLOC_CONFIG_H
|
||||
#define HWLOC_CONFIG_H
|
||||
|
||||
#define HWLOC_VERSION "2.0.4"
|
||||
#define HWLOC_VERSION "2.2.0"
|
||||
#define HWLOC_VERSION_MAJOR 2
|
||||
#define HWLOC_VERSION_MINOR 0
|
||||
#define HWLOC_VERSION_RELEASE 4
|
||||
#define HWLOC_VERSION_MINOR 2
|
||||
#define HWLOC_VERSION_RELEASE 0
|
||||
#define HWLOC_VERSION_GREEK ""
|
||||
|
||||
#define __hwloc_restrict
|
||||
|
|
29
src/3rdparty/hwloc/include/hwloc/bitmap.h
vendored
29
src/3rdparty/hwloc/include/hwloc/bitmap.h
vendored
|
@ -13,7 +13,8 @@
|
|||
#ifndef HWLOC_BITMAP_H
|
||||
#define HWLOC_BITMAP_H
|
||||
|
||||
#include <hwloc/autogen/config.h>
|
||||
#include "hwloc/autogen/config.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
|
@ -198,6 +199,9 @@ HWLOC_DECLSPEC int hwloc_bitmap_from_ulong(hwloc_bitmap_t bitmap, unsigned long
|
|||
/** \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.
|
||||
|
@ -256,6 +260,29 @@ HWLOC_DECLSPEC unsigned long hwloc_bitmap_to_ulong(hwloc_const_bitmap_t bitmap)
|
|||
/** \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.
|
||||
|
|
8
src/3rdparty/hwloc/include/hwloc/cuda.h
vendored
8
src/3rdparty/hwloc/include/hwloc/cuda.h
vendored
|
@ -16,11 +16,11 @@
|
|||
#ifndef HWLOC_CUDA_H
|
||||
#define HWLOC_CUDA_H
|
||||
|
||||
#include <hwloc.h>
|
||||
#include <hwloc/autogen/config.h>
|
||||
#include <hwloc/helper.h>
|
||||
#include "hwloc.h"
|
||||
#include "hwloc/autogen/config.h"
|
||||
#include "hwloc/helper.h"
|
||||
#ifdef HWLOC_LINUX_SYS
|
||||
#include <hwloc/linux.h>
|
||||
#include "hwloc/linux.h"
|
||||
#endif
|
||||
|
||||
#include <cuda.h>
|
||||
|
|
8
src/3rdparty/hwloc/include/hwloc/cudart.h
vendored
8
src/3rdparty/hwloc/include/hwloc/cudart.h
vendored
|
@ -16,11 +16,11 @@
|
|||
#ifndef HWLOC_CUDART_H
|
||||
#define HWLOC_CUDART_H
|
||||
|
||||
#include <hwloc.h>
|
||||
#include <hwloc/autogen/config.h>
|
||||
#include <hwloc/helper.h>
|
||||
#include "hwloc.h"
|
||||
#include "hwloc/autogen/config.h"
|
||||
#include "hwloc/helper.h"
|
||||
#ifdef HWLOC_LINUX_SYS
|
||||
#include <hwloc/linux.h>
|
||||
#include "hwloc/linux.h"
|
||||
#endif
|
||||
|
||||
#include <cuda.h> /* for CUDA_VERSION */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2017 Inria. All rights reserved.
|
||||
* 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.
|
||||
|
@ -21,6 +21,8 @@
|
|||
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 */
|
||||
|
|
53
src/3rdparty/hwloc/include/hwloc/distances.h
vendored
53
src/3rdparty/hwloc/include/hwloc/distances.h
vendored
|
@ -87,7 +87,12 @@ enum hwloc_distances_kind_e {
|
|||
* Such values are currently ignored for distance-based grouping.
|
||||
* \hideinitializer
|
||||
*/
|
||||
HWLOC_DISTANCES_KIND_MEANS_BANDWIDTH = (1UL<<3)
|
||||
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.
|
||||
|
@ -131,20 +136,32 @@ hwloc_distances_get_by_depth(hwloc_topology_t topology, int depth,
|
|||
*
|
||||
* Identical to hwloc_distances_get() with the additional \p type filter.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
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)
|
||||
{
|
||||
int depth = hwloc_get_type_depth(topology, type);
|
||||
if (depth == HWLOC_TYPE_DEPTH_UNKNOWN || depth == HWLOC_TYPE_DEPTH_MULTIPLE) {
|
||||
*nr = 0;
|
||||
return 0;
|
||||
}
|
||||
return hwloc_distances_get_by_depth(topology, depth, nr, distances, kind, flags);
|
||||
}
|
||||
unsigned long kind, unsigned long flags);
|
||||
|
||||
/** \brief Release a distance matrix structure previously returned by hwloc_distances_get(). */
|
||||
/** \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);
|
||||
|
||||
|
@ -221,11 +238,11 @@ enum hwloc_distances_add_flag_e {
|
|||
* 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.
|
||||
*
|
||||
* Objects must be of the same type. They cannot be of type Group.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_distances_add(hwloc_topology_t topology,
|
||||
unsigned nbobjs, hwloc_obj_t *objs, hwloc_uint64_t *values,
|
||||
|
@ -237,7 +254,7 @@ HWLOC_DECLSPEC int hwloc_distances_add(hwloc_topology_t topology,
|
|||
* gathered through the OS.
|
||||
*
|
||||
* If these distances were used to group objects, these additional
|
||||
*Group objects are not removed from the topology.
|
||||
* Group objects are not removed from the topology.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_distances_remove(hwloc_topology_t topology);
|
||||
|
||||
|
@ -260,6 +277,12 @@ hwloc_distances_remove_by_type(hwloc_topology_t topology, hwloc_obj_type_t type)
|
|||
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);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
|
|
2
src/3rdparty/hwloc/include/hwloc/gl.h
vendored
2
src/3rdparty/hwloc/include/hwloc/gl.h
vendored
|
@ -14,7 +14,7 @@
|
|||
#ifndef HWLOC_GL_H
|
||||
#define HWLOC_GL_H
|
||||
|
||||
#include <hwloc.h>
|
||||
#include "hwloc.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -17,8 +17,9 @@
|
|||
#ifndef HWLOC_GLIBC_SCHED_H
|
||||
#define HWLOC_GLIBC_SCHED_H
|
||||
|
||||
#include <hwloc.h>
|
||||
#include <hwloc/helper.h>
|
||||
#include "hwloc.h"
|
||||
#include "hwloc/helper.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#if !defined _GNU_SOURCE || !defined _SCHED_H || (!defined CPU_SETSIZE && !defined sched_priority)
|
||||
|
|
78
src/3rdparty/hwloc/include/hwloc/helper.h
vendored
78
src/3rdparty/hwloc/include/hwloc/helper.h
vendored
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2019 Inria. All rights reserved.
|
||||
* Copyright © 2009-2020 Inria. All rights reserved.
|
||||
* Copyright © 2009-2012 Université Bordeaux
|
||||
* Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
|
@ -527,30 +527,36 @@ hwloc_obj_type_is_io(hwloc_obj_type_t type);
|
|||
*
|
||||
* Memory objects are objects attached to their parents
|
||||
* in the Memory children list.
|
||||
* This current only includes NUMA nodes.
|
||||
* This current includes NUMA nodes and Memory-side caches.
|
||||
*
|
||||
* \return 1 if an object of type \p type is a Memory object, 0 otherwise.
|
||||
*/
|
||||
HWLOC_DECLSPEC int
|
||||
hwloc_obj_type_is_memory(hwloc_obj_type_t type);
|
||||
|
||||
/** \brief Check whether an object type is a Cache (Data, Unified or Instruction).
|
||||
/** \brief Check whether an object type is a CPU Cache (Data, Unified or Instruction).
|
||||
*
|
||||
* Memory-side caches are not CPU caches.
|
||||
*
|
||||
* \return 1 if an object of type \p type is a Cache, 0 otherwise.
|
||||
*/
|
||||
HWLOC_DECLSPEC int
|
||||
hwloc_obj_type_is_cache(hwloc_obj_type_t type);
|
||||
|
||||
/** \brief Check whether an object type is a Data or Unified Cache.
|
||||
/** \brief Check whether an object type is a CPU Data or Unified Cache.
|
||||
*
|
||||
* \return 1 if an object of type \p type is a Data or Unified Cache, 0 otherwise.
|
||||
* Memory-side caches are not CPU caches.
|
||||
*
|
||||
* \return 1 if an object of type \p type is a CPU Data or Unified Cache, 0 otherwise.
|
||||
*/
|
||||
HWLOC_DECLSPEC int
|
||||
hwloc_obj_type_is_dcache(hwloc_obj_type_t type);
|
||||
|
||||
/** \brief Check whether an object type is a Instruction Cache,
|
||||
/** \brief Check whether an object type is a CPU Instruction Cache,
|
||||
*
|
||||
* \return 1 if an object of type \p type is a Instruction Cache, 0 otherwise.
|
||||
* Memory-side caches are not CPU caches.
|
||||
*
|
||||
* \return 1 if an object of type \p type is a CPU Instruction Cache, 0 otherwise.
|
||||
*/
|
||||
HWLOC_DECLSPEC int
|
||||
hwloc_obj_type_is_icache(hwloc_obj_type_t type);
|
||||
|
@ -666,6 +672,24 @@ hwloc_get_shared_cache_covering_obj (hwloc_topology_t topology __hwloc_attribute
|
|||
* package has fewer caches than its peers.
|
||||
*/
|
||||
|
||||
/** \brief Remove simultaneous multithreading PUs from a CPU set.
|
||||
*
|
||||
* For each core in \p topology, if \p cpuset contains some PUs of that core,
|
||||
* modify \p cpuset to only keep a single PU for that core.
|
||||
*
|
||||
* \p which specifies which PU will be kept.
|
||||
* PU are considered in physical index order.
|
||||
* If 0, for each core, the function keeps the first PU that was originally set in \p cpuset.
|
||||
*
|
||||
* If \p which is larger than the number of PUs in a core there were originally set in \p cpuset,
|
||||
* no PU is kept for that core.
|
||||
*
|
||||
* \note PUs that are not below a Core object are ignored
|
||||
* (for instance if the topology does not contain any Core object).
|
||||
* None of them is removed from \p cpuset.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_bitmap_singlify_per_core(hwloc_topology_t topology, hwloc_bitmap_t cpuset, unsigned which);
|
||||
|
||||
/** \brief Returns the object of type ::HWLOC_OBJ_PU with \p os_index.
|
||||
*
|
||||
* This function is useful for converting a CPU set into the PU
|
||||
|
@ -914,7 +938,7 @@ hwloc_topology_get_complete_cpuset(hwloc_topology_t topology) __hwloc_attribute_
|
|||
* \note The returned cpuset is not newly allocated and should thus not be
|
||||
* changed or freed; hwloc_bitmap_dup() must be used to obtain a local copy.
|
||||
*
|
||||
* \note This is equivalent to retrieving the root object complete CPU-set.
|
||||
* \note This is equivalent to retrieving the root object CPU-set.
|
||||
*/
|
||||
HWLOC_DECLSPEC hwloc_const_cpuset_t
|
||||
hwloc_topology_get_topology_cpuset(hwloc_topology_t topology) __hwloc_attribute_pure;
|
||||
|
@ -923,11 +947,11 @@ hwloc_topology_get_topology_cpuset(hwloc_topology_t topology) __hwloc_attribute_
|
|||
*
|
||||
* \return the CPU set of allowed logical processors of the system.
|
||||
*
|
||||
* \note If the topology flag ::HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM was not set,
|
||||
* \note If the topology flag ::HWLOC_TOPOLOGY_FLAG_INCLUDE_DISALLOWED was not set,
|
||||
* this is identical to hwloc_topology_get_topology_cpuset(), which means
|
||||
* all PUs are allowed.
|
||||
*
|
||||
* \note If ::HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM was set, applying
|
||||
* \note If ::HWLOC_TOPOLOGY_FLAG_INCLUDE_DISALLOWED was set, applying
|
||||
* hwloc_bitmap_intersects() on the result of this function and on an object
|
||||
* cpuset checks whether there are allowed PUs inside that object.
|
||||
* Applying hwloc_bitmap_and() returns the list of these allowed PUs.
|
||||
|
@ -945,7 +969,7 @@ hwloc_topology_get_allowed_cpuset(hwloc_topology_t topology) __hwloc_attribute_p
|
|||
* \note The returned nodeset is not newly allocated and should thus not be
|
||||
* changed or freed; hwloc_bitmap_dup() must be used to obtain a local copy.
|
||||
*
|
||||
* \note This is equivalent to retrieving the root object complete CPU-set.
|
||||
* \note This is equivalent to retrieving the root object complete nodeset.
|
||||
*/
|
||||
HWLOC_DECLSPEC hwloc_const_nodeset_t
|
||||
hwloc_topology_get_complete_nodeset(hwloc_topology_t topology) __hwloc_attribute_pure;
|
||||
|
@ -959,7 +983,7 @@ hwloc_topology_get_complete_nodeset(hwloc_topology_t topology) __hwloc_attribute
|
|||
* \note The returned nodeset is not newly allocated and should thus not be
|
||||
* changed or freed; hwloc_bitmap_dup() must be used to obtain a local copy.
|
||||
*
|
||||
* \note This is equivalent to retrieving the root object complete CPU-set.
|
||||
* \note This is equivalent to retrieving the root object nodeset.
|
||||
*/
|
||||
HWLOC_DECLSPEC hwloc_const_nodeset_t
|
||||
hwloc_topology_get_topology_nodeset(hwloc_topology_t topology) __hwloc_attribute_pure;
|
||||
|
@ -968,11 +992,11 @@ hwloc_topology_get_topology_nodeset(hwloc_topology_t topology) __hwloc_attribute
|
|||
*
|
||||
* \return the node set of allowed memory of the system.
|
||||
*
|
||||
* \note If the topology flag ::HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM was not set,
|
||||
* \note If the topology flag ::HWLOC_TOPOLOGY_FLAG_INCLUDE_DISALLOWED was not set,
|
||||
* this is identical to hwloc_topology_get_topology_nodeset(), which means
|
||||
* all NUMA nodes are allowed.
|
||||
*
|
||||
* \note If ::HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM was set, applying
|
||||
* \note If ::HWLOC_TOPOLOGY_FLAG_INCLUDE_DISALLOWED was set, applying
|
||||
* hwloc_bitmap_intersects() on the result of this function and on an object
|
||||
* nodeset checks whether there are allowed NUMA nodes inside that object.
|
||||
* Applying hwloc_bitmap_and() returns the list of these allowed NUMA nodes.
|
||||
|
@ -992,15 +1016,16 @@ hwloc_topology_get_allowed_nodeset(hwloc_topology_t topology) __hwloc_attribute_
|
|||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Convert a CPU set into a NUMA node set and handle non-NUMA cases
|
||||
/** \brief Convert a CPU set into a NUMA node set
|
||||
*
|
||||
* For each PU included in the input \p _cpuset, set the corresponding
|
||||
* local NUMA node(s) in the output \p nodeset.
|
||||
*
|
||||
* If some NUMA nodes have no CPUs at all, this function never sets their
|
||||
* indexes in the output node set, even if a full CPU set is given in input.
|
||||
*
|
||||
* If the topology contains no NUMA nodes, the machine is considered
|
||||
* as a single memory node, and the following behavior is used:
|
||||
* If \p cpuset is empty, \p nodeset will be emptied as well.
|
||||
* Otherwise \p nodeset will be entirely filled.
|
||||
* Hence the entire topology CPU set is converted into the set of all nodes
|
||||
* that have some local CPUs.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_cpuset_to_nodeset(hwloc_topology_t topology, hwloc_const_cpuset_t _cpuset, hwloc_nodeset_t nodeset)
|
||||
|
@ -1015,13 +1040,16 @@ hwloc_cpuset_to_nodeset(hwloc_topology_t topology, hwloc_const_cpuset_t _cpuset,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/** \brief Convert a NUMA node set into a CPU set and handle non-NUMA cases
|
||||
/** \brief Convert a NUMA node set into a CPU set
|
||||
*
|
||||
* If the topology contains no NUMA nodes, the machine is considered
|
||||
* as a single memory node, and the following behavior is used:
|
||||
* If \p nodeset is empty, \p cpuset will be emptied as well.
|
||||
* Otherwise \p cpuset will be entirely filled.
|
||||
* This is useful for manipulating memory binding sets.
|
||||
* For each NUMA node included in the input \p nodeset, set the corresponding
|
||||
* local PUs in the output \p _cpuset.
|
||||
*
|
||||
* If some CPUs have no local NUMA nodes, this function never sets their
|
||||
* indexes in the output CPU set, even if a full node set is given in input.
|
||||
*
|
||||
* Hence the entire topology node set is converted into the set of all CPUs
|
||||
* that have some local NUMA nodes.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
hwloc_cpuset_from_nodeset(hwloc_topology_t topology, hwloc_cpuset_t _cpuset, hwloc_const_nodeset_t nodeset)
|
||||
|
|
10
src/3rdparty/hwloc/include/hwloc/intel-mic.h
vendored
10
src/3rdparty/hwloc/include/hwloc/intel-mic.h
vendored
|
@ -13,11 +13,13 @@
|
|||
#ifndef HWLOC_INTEL_MIC_H
|
||||
#define HWLOC_INTEL_MIC_H
|
||||
|
||||
#include <hwloc.h>
|
||||
#include <hwloc/autogen/config.h>
|
||||
#include <hwloc/helper.h>
|
||||
#include "hwloc.h"
|
||||
#include "hwloc/autogen/config.h"
|
||||
#include "hwloc/helper.h"
|
||||
|
||||
#ifdef HWLOC_LINUX_SYS
|
||||
#include <hwloc/linux.h>
|
||||
#include "hwloc/linux.h"
|
||||
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
#ifndef HWLOC_LINUX_LIBNUMA_H
|
||||
#define HWLOC_LINUX_LIBNUMA_H
|
||||
|
||||
#include <hwloc.h>
|
||||
#include "hwloc.h"
|
||||
|
||||
#include <numa.h>
|
||||
|
||||
|
||||
|
|
3
src/3rdparty/hwloc/include/hwloc/linux.h
vendored
3
src/3rdparty/hwloc/include/hwloc/linux.h
vendored
|
@ -15,7 +15,8 @@
|
|||
#ifndef HWLOC_LINUX_H
|
||||
#define HWLOC_LINUX_H
|
||||
|
||||
#include <hwloc.h>
|
||||
#include "hwloc.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
|
8
src/3rdparty/hwloc/include/hwloc/nvml.h
vendored
8
src/3rdparty/hwloc/include/hwloc/nvml.h
vendored
|
@ -13,11 +13,11 @@
|
|||
#ifndef HWLOC_NVML_H
|
||||
#define HWLOC_NVML_H
|
||||
|
||||
#include <hwloc.h>
|
||||
#include <hwloc/autogen/config.h>
|
||||
#include <hwloc/helper.h>
|
||||
#include "hwloc.h"
|
||||
#include "hwloc/autogen/config.h"
|
||||
#include "hwloc/helper.h"
|
||||
#ifdef HWLOC_LINUX_SYS
|
||||
#include <hwloc/linux.h>
|
||||
#include "hwloc/linux.h"
|
||||
#endif
|
||||
|
||||
#include <nvml.h>
|
||||
|
|
126
src/3rdparty/hwloc/include/hwloc/opencl.h
vendored
126
src/3rdparty/hwloc/include/hwloc/opencl.h
vendored
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright © 2012-2018 Inria. All rights reserved.
|
||||
* Copyright © 2012-2019 Inria. All rights reserved.
|
||||
* Copyright © 2013, 2018 Université Bordeaux. All right reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
@ -14,19 +14,17 @@
|
|||
#ifndef HWLOC_OPENCL_H
|
||||
#define HWLOC_OPENCL_H
|
||||
|
||||
#include <hwloc.h>
|
||||
#include <hwloc/autogen/config.h>
|
||||
#include <hwloc/helper.h>
|
||||
#include "hwloc.h"
|
||||
#include "hwloc/autogen/config.h"
|
||||
#include "hwloc/helper.h"
|
||||
#ifdef HWLOC_LINUX_SYS
|
||||
#include <hwloc/linux.h>
|
||||
#include "hwloc/linux.h"
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl.h>
|
||||
#include <OpenCL/cl_ext.h>
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#include <CL/cl_ext.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -37,17 +35,80 @@ 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 the AMD OpenCL interface currently offers useful locality information
|
||||
* about its 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.
|
||||
*
|
||||
|
@ -62,7 +123,7 @@ extern "C" {
|
|||
* and hwloc_opencl_get_device_osdev_by_index().
|
||||
*
|
||||
* This function is currently only implemented in a meaningful way for
|
||||
* Linux with the AMD OpenCL implementation; other systems will simply
|
||||
* Linux with the AMD or NVIDIA OpenCL implementation; other systems will simply
|
||||
* get a full cpuset.
|
||||
*/
|
||||
static __hwloc_inline int
|
||||
|
@ -70,35 +131,28 @@ hwloc_opencl_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unuse
|
|||
cl_device_id device __hwloc_attribute_unused,
|
||||
hwloc_cpuset_t set)
|
||||
{
|
||||
#if (defined HWLOC_LINUX_SYS) && (defined CL_DEVICE_TOPOLOGY_AMD)
|
||||
/* If we're on Linux + AMD OpenCL, use the AMD extension + the sysfs mechanism to get the local cpus */
|
||||
#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];
|
||||
cl_device_topology_amd amdtopo;
|
||||
cl_int clret;
|
||||
unsigned pcidomain, pcibus, pcidev, pcifunc;
|
||||
|
||||
if (!hwloc_topology_is_thissystem(topology)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
clret = clGetDeviceInfo(device, CL_DEVICE_TOPOLOGY_AMD, sizeof(amdtopo), &amdtopo, NULL);
|
||||
if (CL_SUCCESS != clret) {
|
||||
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||
return 0;
|
||||
}
|
||||
if (CL_DEVICE_TOPOLOGY_TYPE_PCIE_AMD != amdtopo.raw.type) {
|
||||
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/0000:%02x:%02x.%01x/local_cpus",
|
||||
(unsigned) amdtopo.pcie.bus, (unsigned) amdtopo.pcie.device, (unsigned) amdtopo.pcie.function);
|
||||
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 + AMD OpenCL systems simply get a full cpuset */
|
||||
/* Non-Linux systems simply get a full cpuset */
|
||||
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
|
||||
#endif
|
||||
return 0;
|
||||
|
@ -140,8 +194,8 @@ hwloc_opencl_get_device_osdev_by_index(hwloc_topology_t topology,
|
|||
* 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 OpenCL devices that support
|
||||
* the CL_DEVICE_TOPOLOGY_AMD extension. hwloc_opencl_get_device_osdev_by_index()
|
||||
* 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.
|
||||
*
|
||||
|
@ -159,17 +213,10 @@ 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)
|
||||
{
|
||||
#ifdef CL_DEVICE_TOPOLOGY_AMD
|
||||
hwloc_obj_t osdev;
|
||||
cl_device_topology_amd amdtopo;
|
||||
cl_int clret;
|
||||
unsigned pcidomain, pcibus, pcidevice, pcifunc;
|
||||
|
||||
clret = clGetDeviceInfo(device, CL_DEVICE_TOPOLOGY_AMD, sizeof(amdtopo), &amdtopo, NULL);
|
||||
if (CL_SUCCESS != clret) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
if (CL_DEVICE_TOPOLOGY_TYPE_PCIE_AMD != amdtopo.raw.type) {
|
||||
if (hwloc_opencl_get_device_pci_busid(device, &pcidomain, &pcibus, &pcidevice, &pcifunc) < 0) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -181,18 +228,15 @@ hwloc_opencl_get_device_osdev(hwloc_topology_t topology __hwloc_attribute_unused
|
|||
continue;
|
||||
if (pcidev
|
||||
&& pcidev->type == HWLOC_OBJ_PCI_DEVICE
|
||||
&& pcidev->attr->pcidev.domain == 0
|
||||
&& pcidev->attr->pcidev.bus == amdtopo.pcie.bus
|
||||
&& pcidev->attr->pcidev.dev == amdtopo.pcie.device
|
||||
&& pcidev->attr->pcidev.func == amdtopo.pcie.function)
|
||||
&& 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;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
#ifndef HWLOC_OPENFABRICS_VERBS_H
|
||||
#define HWLOC_OPENFABRICS_VERBS_H
|
||||
|
||||
#include <hwloc.h>
|
||||
#include <hwloc/autogen/config.h>
|
||||
#include "hwloc.h"
|
||||
#include "hwloc/autogen/config.h"
|
||||
#ifdef HWLOC_LINUX_SYS
|
||||
#include <hwloc/linux.h>
|
||||
#include "hwloc/linux.h"
|
||||
#endif
|
||||
|
||||
#include <infiniband/verbs.h>
|
||||
|
|
186
src/3rdparty/hwloc/include/hwloc/plugins.h
vendored
186
src/3rdparty/hwloc/include/hwloc/plugins.h
vendored
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright © 2013-2017 Inria. All rights reserved.
|
||||
* Copyright © 2013-2020 Inria. All rights reserved.
|
||||
* Copyright © 2016 Cisco Systems, Inc. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
@ -13,10 +13,15 @@
|
|||
|
||||
struct hwloc_backend;
|
||||
|
||||
#include <hwloc.h>
|
||||
#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
|
||||
|
||||
|
||||
|
@ -25,52 +30,36 @@ struct hwloc_backend;
|
|||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Discovery component type */
|
||||
typedef enum hwloc_disc_component_type_e {
|
||||
/** \brief CPU-only discovery through the OS, or generic no-OS support.
|
||||
* \hideinitializer */
|
||||
HWLOC_DISC_COMPONENT_TYPE_CPU = (1<<0),
|
||||
|
||||
/** \brief xml or synthetic,
|
||||
* platform-specific components such as bgq.
|
||||
* Anything the discovers CPU and everything else.
|
||||
* No misc backend is expected to complement a global component.
|
||||
* \hideinitializer */
|
||||
HWLOC_DISC_COMPONENT_TYPE_GLOBAL = (1<<1),
|
||||
|
||||
/** \brief OpenCL, Cuda, etc.
|
||||
* \hideinitializer */
|
||||
HWLOC_DISC_COMPONENT_TYPE_MISC = (1<<2)
|
||||
} hwloc_disc_component_type_t;
|
||||
|
||||
/** \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 Discovery component type */
|
||||
hwloc_disc_component_type_t type;
|
||||
|
||||
/** \brief Name.
|
||||
* If this component is built as a plugin, this name does not have to match the plugin filename.
|
||||
*/
|
||||
const char *name;
|
||||
|
||||
/** \brief Component types to exclude, as an OR'ed set of ::hwloc_disc_component_type_e.
|
||||
/** \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 types (~0).
|
||||
* 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 excludes;
|
||||
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_disc_component *component, const void *data1, const void *data2, const void *data3);
|
||||
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.
|
||||
|
@ -107,6 +96,72 @@ struct hwloc_disc_component {
|
|||
* @{
|
||||
*/
|
||||
|
||||
/** \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.
|
||||
|
@ -116,6 +171,14 @@ struct hwloc_disc_component {
|
|||
* 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() */
|
||||
|
@ -127,12 +190,20 @@ struct hwloc_backend {
|
|||
/** \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 or 1 if the backend should enforce the thissystem flag when it gets enabled.
|
||||
* Set to -1 if the backend doesn't care (default). */
|
||||
* 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. */
|
||||
|
@ -147,20 +218,22 @@ struct hwloc_backend {
|
|||
* or because of an actual discovery/gathering failure.
|
||||
* May be NULL.
|
||||
*/
|
||||
int (*discover)(struct hwloc_backend *backend);
|
||||
int (*discover)(struct hwloc_backend *backend, struct hwloc_disc_status *status);
|
||||
|
||||
/** \brief Callback used by the PCI backend to retrieve the locality of a PCI object from the OS/cpu backend.
|
||||
* May be NULL. */
|
||||
/** \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_disc_component *component);
|
||||
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_topology *topology, struct hwloc_backend *backend);
|
||||
HWLOC_DECLSPEC int hwloc_backend_enable(struct hwloc_backend *backend);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
@ -349,14 +422,22 @@ static __hwloc_inline int
|
|||
hwloc_plugin_check_namespace(const char *pluginname __hwloc_attribute_unused, const char *symbol __hwloc_attribute_unused)
|
||||
{
|
||||
#ifdef HWLOC_INSIDE_PLUGIN
|
||||
lt_dlhandle handle;
|
||||
void *sym;
|
||||
handle = lt_dlopen(NULL);
|
||||
#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;
|
||||
|
@ -480,7 +561,9 @@ HWLOC_DECLSPEC hwloc_obj_type_t hwloc_pcidisc_check_bridge_type(unsigned device_
|
|||
*
|
||||
* Returns -1 and destroys /p obj if bridge fields are invalid.
|
||||
*/
|
||||
HWLOC_DECLSPEC int hwloc_pcidisc_setup_bridge_attr(hwloc_obj_t obj, const unsigned char *config);
|
||||
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.
|
||||
*
|
||||
|
@ -490,10 +573,7 @@ HWLOC_DECLSPEC void hwloc_pcidisc_tree_insert_by_busid(struct hwloc_obj **treep,
|
|||
|
||||
/** \brief Add some hostbridges on top of the given tree of PCI objects and attach them to the topology.
|
||||
*
|
||||
* For now, they will be attached to the root object. The core will move them to their actual PCI
|
||||
* locality using hwloc_pci_belowroot_apply_locality() at the end of the discovery.
|
||||
*
|
||||
* In the meantime, other backends lookup PCI objects or localities (for instance to attach OS devices)
|
||||
* 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);
|
||||
|
@ -507,32 +587,14 @@ HWLOC_DECLSPEC int hwloc_pcidisc_tree_attach(struct hwloc_topology *topology, st
|
|||
* @{
|
||||
*/
|
||||
|
||||
/** \brief Find the PCI object that matches the bus ID.
|
||||
*
|
||||
* To be used after a PCI backend added PCI devices with hwloc_pcidisc_tree_attach()
|
||||
* and before the core moves them to their actual location with hwloc_pci_belowroot_apply_locality().
|
||||
*
|
||||
* If no exactly matching object is found, return the container bridge if any, or NULL.
|
||||
*
|
||||
* On failure, it may be possible to find the PCI locality (instead of the PCI device)
|
||||
* by calling hwloc_pcidisc_find_busid_parent().
|
||||
*
|
||||
* \note This is semantically identical to hwloc_get_pcidev_by_busid() which only works
|
||||
* after the topology is fully loaded.
|
||||
*/
|
||||
HWLOC_DECLSPEC struct hwloc_obj * hwloc_pcidisc_find_by_busid(struct hwloc_topology *topology, unsigned domain, unsigned bus, unsigned dev, unsigned func);
|
||||
|
||||
/** \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 directly under a normal
|
||||
* (non-I/O) object, instead of below a PCI object.
|
||||
* It is usually used by backends when hwloc_pcidisc_find_by_busid() failed
|
||||
* to find the hwloc object corresponding to this bus ID, for instance because
|
||||
* PCI discovery is not supported on this platform.
|
||||
* 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_pcidisc_find_busid_parent(struct hwloc_topology *topology, unsigned domain, unsigned bus, unsigned dev, unsigned func);
|
||||
HWLOC_DECLSPEC struct hwloc_obj * hwloc_pci_find_parent_by_busid(struct hwloc_topology *topology, unsigned domain, unsigned bus, unsigned dev, unsigned func);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
77
src/3rdparty/hwloc/include/hwloc/rename.h
vendored
77
src/3rdparty/hwloc/include/hwloc/rename.h
vendored
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright © 2010-2018 Inria. 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>
|
||||
#include "hwloc/autogen/config.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -28,6 +28,7 @@ extern "C" {
|
|||
#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
|
||||
|
@ -49,7 +50,9 @@ extern "C" {
|
|||
|
||||
#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)
|
||||
|
@ -90,9 +93,6 @@ extern "C" {
|
|||
|
||||
#define hwloc_compare_types HWLOC_NAME(compare_types)
|
||||
|
||||
#define hwloc_compare_types_e HWLOC_NAME(compare_types_e)
|
||||
#define HWLOC_TYPE_UNORDERED HWLOC_NAME_CAPS(TYPE_UNORDERED)
|
||||
|
||||
#define hwloc_obj HWLOC_NAME(obj)
|
||||
#define hwloc_obj_t HWLOC_NAME(obj_t)
|
||||
|
||||
|
@ -116,7 +116,7 @@ extern "C" {
|
|||
|
||||
#define hwloc_topology_flags_e HWLOC_NAME(topology_flags_e)
|
||||
|
||||
#define HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM HWLOC_NAME_CAPS(TOPOLOGY_FLAG_WHOLE_SYSTEM)
|
||||
#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)
|
||||
|
||||
|
@ -124,6 +124,9 @@ extern "C" {
|
|||
#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)
|
||||
|
@ -151,10 +154,18 @@ extern "C" {
|
|||
|
||||
#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)
|
||||
|
@ -172,6 +183,7 @@ extern "C" {
|
|||
#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)
|
||||
|
@ -266,10 +278,12 @@ extern "C" {
|
|||
#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)
|
||||
|
@ -308,6 +322,7 @@ extern "C" {
|
|||
#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)
|
||||
|
@ -380,10 +395,13 @@ extern "C" {
|
|||
#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)
|
||||
|
@ -396,6 +414,7 @@ extern "C" {
|
|||
#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 */
|
||||
|
||||
|
@ -462,13 +481,10 @@ extern "C" {
|
|||
#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)
|
||||
|
||||
/* intel-mic.h */
|
||||
|
||||
#define hwloc_intel_mic_get_device_cpuset HWLOC_NAME(intel_mic_get_device_cpuset)
|
||||
#define hwloc_intel_mic_get_device_osdev_by_index HWLOC_NAME(intel_mic_get_device_osdev_by_index)
|
||||
|
||||
/* 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)
|
||||
|
@ -502,13 +518,22 @@ extern "C" {
|
|||
|
||||
/* hwloc/plugins.h */
|
||||
|
||||
#define hwloc_disc_component_type_e HWLOC_NAME(disc_component_type_e)
|
||||
#define HWLOC_DISC_COMPONENT_TYPE_CPU HWLOC_NAME_CAPS(DISC_COMPONENT_TYPE_CPU)
|
||||
#define HWLOC_DISC_COMPONENT_TYPE_GLOBAL HWLOC_NAME_CAPS(DISC_COMPONENT_TYPE_GLOBAL)
|
||||
#define HWLOC_DISC_COMPONENT_TYPE_MISC HWLOC_NAME_CAPS(DISC_COMPONENT_TYPE_MISC)
|
||||
#define hwloc_disc_component_type_t HWLOC_NAME(disc_component_type_t)
|
||||
#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)
|
||||
|
@ -540,12 +565,11 @@ extern "C" {
|
|||
#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_setup_bridge_attr HWLOC_NAME(pcidisc_setup_bridge_attr)
|
||||
#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_pcidisc_find_by_busid HWLOC_NAME(pcidisc_find_by_busid)
|
||||
#define hwloc_pcidisc_find_busid_parent HWLOC_NAME(pcidisc_find_busid_parent)
|
||||
#define hwloc_pci_find_parent_by_busid HWLOC_NAME(pcidisc_find_busid_parent)
|
||||
|
||||
/* hwloc/deprecated.h */
|
||||
|
||||
|
@ -571,8 +595,9 @@ extern "C" {
|
|||
|
||||
/* private/misc.h */
|
||||
|
||||
#ifndef HWLOC_HAVE_CORRECT_SNPRINTF
|
||||
#define hwloc_snprintf HWLOC_NAME(snprintf)
|
||||
#define hwloc_namecoloncmp HWLOC_NAME(namecoloncmp)
|
||||
#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)
|
||||
|
@ -631,8 +656,9 @@ extern "C" {
|
|||
#define hwloc_backends_is_thissystem HWLOC_NAME(backends_is_thissystem)
|
||||
#define hwloc_backends_find_callbacks HWLOC_NAME(backends_find_callbacks)
|
||||
|
||||
#define hwloc_backends_init HWLOC_NAME(backends_init)
|
||||
#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)
|
||||
|
@ -656,7 +682,6 @@ extern "C" {
|
|||
|
||||
#define hwloc_cuda_component HWLOC_NAME(cuda_component)
|
||||
#define hwloc_gl_component HWLOC_NAME(gl_component)
|
||||
#define hwloc_linuxio_component HWLOC_NAME(linuxio_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)
|
||||
|
@ -669,12 +694,16 @@ extern "C" {
|
|||
#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)
|
||||
|
@ -687,8 +716,8 @@ extern "C" {
|
|||
#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_pci_belowroot_apply_locality HWLOC_NAME(pci_belowroot_apply_locality)
|
||||
|
||||
#define hwloc__add_info HWLOC_NAME(_add_info)
|
||||
#define hwloc__add_info_nodup HWLOC_NAME(_add_info_nodup)
|
||||
|
|
2
src/3rdparty/hwloc/include/hwloc/shmem.h
vendored
2
src/3rdparty/hwloc/include/hwloc/shmem.h
vendored
|
@ -10,7 +10,7 @@
|
|||
#ifndef HWLOC_SHMEM_H
|
||||
#define HWLOC_SHMEM_H
|
||||
|
||||
#include <hwloc.h>
|
||||
#include "hwloc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
12
src/3rdparty/hwloc/include/private/components.h
vendored
12
src/3rdparty/hwloc/include/private/components.h
vendored
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright © 2012-2015 Inria. All rights reserved.
|
||||
* Copyright © 2012-2019 Inria. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
|
@ -16,13 +16,13 @@
|
|||
#ifndef PRIVATE_COMPONENTS_H
|
||||
#define PRIVATE_COMPONENTS_H 1
|
||||
|
||||
#include <hwloc/plugins.h>
|
||||
#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 */
|
||||
int type, const char *name,
|
||||
const char *name,
|
||||
const void *data1, const void *data2, const void *data3);
|
||||
extern void hwloc_disc_components_enable_others(struct hwloc_topology *topology);
|
||||
|
||||
|
@ -30,10 +30,12 @@ extern void hwloc_disc_components_enable_others(struct hwloc_topology *topology)
|
|||
extern void hwloc_backends_is_thissystem(struct hwloc_topology *topology);
|
||||
extern void hwloc_backends_find_callbacks(struct hwloc_topology *topology);
|
||||
|
||||
/* Initialize the list of backends used by a topology */
|
||||
extern void hwloc_backends_init(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) */
|
||||
|
|
4
src/3rdparty/hwloc/include/private/debug.h
vendored
4
src/3rdparty/hwloc/include/private/debug.h
vendored
|
@ -11,8 +11,8 @@
|
|||
#ifndef HWLOC_DEBUG_H
|
||||
#define HWLOC_DEBUG_H
|
||||
|
||||
#include <private/autogen/config.h>
|
||||
#include <private/misc.h>
|
||||
#include "private/autogen/config.h"
|
||||
#include "private/misc.h"
|
||||
|
||||
#ifdef HWLOC_DEBUG
|
||||
#include <stdarg.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright © 2018 Inria. All rights reserved.
|
||||
* Copyright © 2018-2019 Inria. All rights reserved.
|
||||
*
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
@ -29,7 +29,6 @@ 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_linuxio_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;
|
||||
|
|
23
src/3rdparty/hwloc/include/private/misc.h
vendored
23
src/3rdparty/hwloc/include/private/misc.h
vendored
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2018 Inria. All rights reserved.
|
||||
* 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.
|
||||
|
@ -11,9 +11,9 @@
|
|||
#ifndef HWLOC_PRIVATE_MISC_H
|
||||
#define HWLOC_PRIVATE_MISC_H
|
||||
|
||||
#include <hwloc/autogen/config.h>
|
||||
#include <private/autogen/config.h>
|
||||
#include <hwloc.h>
|
||||
#include "hwloc/autogen/config.h"
|
||||
#include "private/autogen/config.h"
|
||||
#include "hwloc.h"
|
||||
|
||||
#ifdef HWLOC_HAVE_DECL_STRNCASECMP
|
||||
#ifdef HAVE_STRINGS_H
|
||||
|
@ -439,14 +439,14 @@ hwloc_linux_pci_link_speed_from_string(const char *string)
|
|||
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;
|
||||
return type <= HWLOC_OBJ_GROUP || type == HWLOC_OBJ_DIE;
|
||||
}
|
||||
|
||||
/* Any object attached to memory children, currently only NUMA nodes */
|
||||
/* 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;
|
||||
return type == HWLOC_OBJ_NUMANODE || type == HWLOC_OBJ_MEMCACHE;
|
||||
}
|
||||
|
||||
/* I/O or Misc object, without cpusets or nodesets. */
|
||||
|
@ -463,6 +463,7 @@ static __hwloc_inline int hwloc__obj_type_is_io (hwloc_obj_type_t type)
|
|||
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)
|
||||
{
|
||||
|
@ -572,12 +573,4 @@ typedef SSIZE_T ssize_t;
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#if defined HWLOC_WIN_SYS && !defined __MINGW32__ && !defined(__CYGWIN__)
|
||||
/* MSVC doesn't support C99 variable-length array */
|
||||
#include <malloc.h>
|
||||
#define HWLOC_VLA(_type, _name, _nb) _type *_name = (_type*) _alloca((_nb)*sizeof(_type))
|
||||
#else
|
||||
#define HWLOC_VLA(_type, _name, _nb) _type _name[_nb]
|
||||
#endif
|
||||
|
||||
#endif /* HWLOC_PRIVATE_MISC_H */
|
||||
|
|
107
src/3rdparty/hwloc/include/private/private.h
vendored
107
src/3rdparty/hwloc/include/private/private.h
vendored
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2019 Inria. All rights reserved.
|
||||
* Copyright © 2009-2012 Université Bordeaux
|
||||
* Copyright © 2009-2012, 2020 Université Bordeaux
|
||||
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
|
||||
*
|
||||
* See COPYING in top-level directory.
|
||||
|
@ -22,11 +22,12 @@
|
|||
#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 "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>
|
||||
|
@ -39,7 +40,7 @@
|
|||
#endif
|
||||
#include <string.h>
|
||||
|
||||
#define HWLOC_TOPOLOGY_ABI 0x20000 /* version of the layout of struct topology */
|
||||
#define HWLOC_TOPOLOGY_ABI 0x20100 /* version of the layout of struct topology */
|
||||
|
||||
/*****************************************************
|
||||
* WARNING:
|
||||
|
@ -67,12 +68,13 @@ struct hwloc_topology {
|
|||
void *adopted_shmem_addr;
|
||||
size_t adopted_shmem_length;
|
||||
|
||||
#define HWLOC_NR_SLEVELS 5
|
||||
#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))
|
||||
|
@ -86,6 +88,7 @@ struct hwloc_topology {
|
|||
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);
|
||||
|
@ -127,20 +130,35 @@ struct hwloc_topology {
|
|||
int userdata_not_decoded;
|
||||
|
||||
struct hwloc_internal_distances_s {
|
||||
hwloc_obj_type_t type;
|
||||
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. */
|
||||
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 */
|
||||
int objs_are_valid; /* set to 1 if the array objs is still valid, 0 if needs refresh */
|
||||
|
||||
unsigned id; /* to match the container id field of public distances structure */
|
||||
struct hwloc_internal_distances_s *prev, *next;
|
||||
} *first_dist, *last_dist;
|
||||
unsigned next_dist_id;
|
||||
|
@ -153,8 +171,9 @@ struct hwloc_topology {
|
|||
|
||||
/* list of enabled backends. */
|
||||
struct hwloc_backend * backends;
|
||||
struct hwloc_backend * get_pci_busid_cpuset_backend;
|
||||
unsigned backend_excludes;
|
||||
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;
|
||||
|
@ -176,7 +195,6 @@ struct hwloc_topology {
|
|||
struct hwloc_numanode_attr_s machine_memory;
|
||||
|
||||
/* pci stuff */
|
||||
int need_pci_belowroot_apply_locality;
|
||||
int pci_has_forced_locality;
|
||||
unsigned pci_forced_locality_nr;
|
||||
struct hwloc_pci_forced_locality_s {
|
||||
|
@ -185,13 +203,34 @@ struct hwloc_topology {
|
|||
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, int *n);
|
||||
extern int hwloc_fallback_nbprocessors(struct hwloc_topology *topology);
|
||||
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);
|
||||
|
@ -208,19 +247,17 @@ 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);
|
||||
|
||||
/* Move PCI objects currently attached to the root object ot their actual location.
|
||||
* Called by the core at the end of hwloc_topology_load().
|
||||
* Prior to this call, all PCI objects may be found below the root object.
|
||||
* After this call and a reconnect of levels, all PCI objects are available through levels.
|
||||
*/
|
||||
extern int hwloc_pci_belowroot_apply_locality(struct hwloc_topology *topology);
|
||||
|
||||
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);
|
||||
|
@ -313,8 +350,8 @@ 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, 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, hwloc_obj_type_t type, unsigned nbobjs, uint64_t *indexes, uint64_t *values, unsigned long kind, unsigned long flags);
|
||||
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.
|
||||
|
@ -330,13 +367,19 @@ extern int hwloc_encode_to_base64(const char *src, size_t srclength, char *targe
|
|||
*/
|
||||
extern int hwloc_decode_from_base64(char const *src, char *target, size_t targsize);
|
||||
|
||||
/* Check whether needle matches the beginning of haystack, at least n, and up
|
||||
* to a colon or \0 */
|
||||
extern int hwloc_namecoloncmp(const char *haystack, const char *needle, size_t n);
|
||||
|
||||
/* On some systems, snprintf returns the size of written data, not the actually
|
||||
* required size. hwloc_snprintf always report the actually required size. */
|
||||
* 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.
|
||||
|
@ -356,7 +399,7 @@ extern char * hwloc_progname(struct hwloc_topology *topology);
|
|||
#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 /* 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 */
|
||||
|
|
5
src/3rdparty/hwloc/include/private/xml.h
vendored
5
src/3rdparty/hwloc/include/private/xml.h
vendored
|
@ -1,12 +1,12 @@
|
|||
/*
|
||||
* Copyright © 2009-2019 Inria. All rights reserved.
|
||||
* 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 "hwloc.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
@ -54,7 +54,6 @@ struct hwloc_xml_backend_data_s {
|
|||
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;
|
||||
int dont_merge_die_groups;
|
||||
};
|
||||
|
||||
/**************
|
||||
|
|
2
src/3rdparty/hwloc/src/base64.c
vendored
2
src/3rdparty/hwloc/src/base64.c
vendored
|
@ -11,7 +11,7 @@
|
|||
/* include hwloc's config before anything else
|
||||
* so that extensions and features are properly enabled
|
||||
*/
|
||||
#include <private/private.h>
|
||||
#include "private/private.h"
|
||||
|
||||
/* $OpenBSD: base64.c,v 1.5 2006/10/21 09:55:03 otto Exp $ */
|
||||
|
||||
|
|
13
src/3rdparty/hwloc/src/bind.c
vendored
13
src/3rdparty/hwloc/src/bind.c
vendored
|
@ -1,15 +1,16 @@
|
|||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2018 Inria. All rights reserved.
|
||||
* 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>
|
||||
#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
|
||||
|
@ -885,6 +886,8 @@ hwloc_set_binding_hooks(struct hwloc_topology *topology)
|
|||
} 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
|
||||
|
|
61
src/3rdparty/hwloc/src/bitmap.c
vendored
61
src/3rdparty/hwloc/src/bitmap.c
vendored
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2017 Inria. All rights reserved.
|
||||
* Copyright © 2009-2018 Inria. All rights reserved.
|
||||
* Copyright © 2009-2011 Université Bordeaux
|
||||
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
#include <private/autogen/config.h>
|
||||
#include <hwloc/autogen/config.h>
|
||||
#include <hwloc.h>
|
||||
#include <private/misc.h>
|
||||
#include <private/private.h>
|
||||
#include <private/debug.h>
|
||||
#include <hwloc/bitmap.h>
|
||||
#include "private/autogen/config.h"
|
||||
#include "hwloc/autogen/config.h"
|
||||
#include "hwloc.h"
|
||||
#include "private/misc.h"
|
||||
#include "private/private.h"
|
||||
#include "private/debug.h"
|
||||
#include "hwloc/bitmap.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
@ -505,14 +505,16 @@ int hwloc_bitmap_list_sscanf(struct hwloc_bitmap_s *set, const char * __hwloc_re
|
|||
|
||||
if (begin != -1) {
|
||||
/* finishing a range */
|
||||
hwloc_bitmap_set_range(set, begin, val);
|
||||
if (hwloc_bitmap_set_range(set, begin, val) < 0)
|
||||
goto failed;
|
||||
begin = -1;
|
||||
|
||||
} else if (*next == '-') {
|
||||
/* starting a new range */
|
||||
if (*(next+1) == '\0') {
|
||||
/* infinite range */
|
||||
hwloc_bitmap_set_range(set, val, -1);
|
||||
if (hwloc_bitmap_set_range(set, val, -1) < 0)
|
||||
goto failed;
|
||||
break;
|
||||
} else {
|
||||
/* normal range */
|
||||
|
@ -766,6 +768,21 @@ int hwloc_bitmap_from_ith_ulong(struct hwloc_bitmap_s *set, unsigned i, unsigned
|
|||
return 0;
|
||||
}
|
||||
|
||||
int hwloc_bitmap_from_ulongs(struct hwloc_bitmap_s *set, unsigned nr, const unsigned long *masks)
|
||||
{
|
||||
unsigned j;
|
||||
|
||||
HWLOC__BITMAP_CHECK(set);
|
||||
|
||||
if (hwloc_bitmap_reset_by_ulongs(set, nr) < 0)
|
||||
return -1;
|
||||
|
||||
for(j=0; j<nr; j++)
|
||||
set->ulongs[j] = masks[j];
|
||||
set->infinite = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long hwloc_bitmap_to_ulong(const struct hwloc_bitmap_s *set)
|
||||
{
|
||||
HWLOC__BITMAP_CHECK(set);
|
||||
|
@ -780,6 +797,30 @@ unsigned long hwloc_bitmap_to_ith_ulong(const struct hwloc_bitmap_s *set, unsign
|
|||
return HWLOC_SUBBITMAP_READULONG(set, i);
|
||||
}
|
||||
|
||||
int hwloc_bitmap_to_ulongs(const struct hwloc_bitmap_s *set, unsigned nr, unsigned long *masks)
|
||||
{
|
||||
unsigned j;
|
||||
|
||||
HWLOC__BITMAP_CHECK(set);
|
||||
|
||||
for(j=0; j<nr; j++)
|
||||
masks[j] = HWLOC_SUBBITMAP_READULONG(set, j);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hwloc_bitmap_nr_ulongs(const struct hwloc_bitmap_s *set)
|
||||
{
|
||||
unsigned last;
|
||||
|
||||
HWLOC__BITMAP_CHECK(set);
|
||||
|
||||
if (set->infinite)
|
||||
return -1;
|
||||
|
||||
last = hwloc_bitmap_last(set);
|
||||
return (last + HWLOC_BITS_PER_LONG-1)/HWLOC_BITS_PER_LONG;
|
||||
}
|
||||
|
||||
int hwloc_bitmap_only(struct hwloc_bitmap_s * set, unsigned cpu)
|
||||
{
|
||||
unsigned index_ = HWLOC_SUBBITMAP_INDEX(cpu);
|
||||
|
|
523
src/3rdparty/hwloc/src/components.c
vendored
523
src/3rdparty/hwloc/src/components.c
vendored
|
@ -1,18 +1,19 @@
|
|||
/*
|
||||
* Copyright © 2009-2017 Inria. All rights reserved.
|
||||
* Copyright © 2009-2020 Inria. All rights reserved.
|
||||
* Copyright © 2012 Université Bordeaux
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
#include <private/autogen/config.h>
|
||||
#include <hwloc.h>
|
||||
#include <private/private.h>
|
||||
#include <private/xml.h>
|
||||
#include <private/misc.h>
|
||||
#include "private/autogen/config.h"
|
||||
#include "hwloc.h"
|
||||
#include "private/private.h"
|
||||
#include "private/xml.h"
|
||||
#include "private/misc.h"
|
||||
|
||||
#define HWLOC_COMPONENT_STOP_NAME "stop"
|
||||
#define HWLOC_COMPONENT_EXCLUDE_CHAR '-'
|
||||
#define HWLOC_COMPONENT_SEPS ","
|
||||
#define HWLOC_COMPONENT_PHASESEP_CHAR ':'
|
||||
|
||||
/* list of all registered discovery components, sorted by priority, higher priority first.
|
||||
* noos is last because its priority is 0.
|
||||
|
@ -62,14 +63,128 @@ static pthread_mutex_t hwloc_components_mutex = PTHREAD_MUTEX_INITIALIZER;
|
|||
|
||||
#ifdef HWLOC_HAVE_PLUGINS
|
||||
|
||||
#ifdef HWLOC_HAVE_LTDL
|
||||
/* ltdl-based plugin load */
|
||||
#include <ltdl.h>
|
||||
typedef lt_dlhandle hwloc_dlhandle;
|
||||
#define hwloc_dlinit lt_dlinit
|
||||
#define hwloc_dlexit lt_dlexit
|
||||
#define hwloc_dlopenext lt_dlopenext
|
||||
#define hwloc_dlclose lt_dlclose
|
||||
#define hwloc_dlerror lt_dlerror
|
||||
#define hwloc_dlsym lt_dlsym
|
||||
#define hwloc_dlforeachfile lt_dlforeachfile
|
||||
|
||||
#else /* !HWLOC_HAVE_LTDL */
|
||||
/* no-ltdl plugin load relies on less portable libdl */
|
||||
#include <dlfcn.h>
|
||||
typedef void * hwloc_dlhandle;
|
||||
static __hwloc_inline int hwloc_dlinit(void) { return 0; }
|
||||
static __hwloc_inline int hwloc_dlexit(void) { return 0; }
|
||||
#define hwloc_dlclose dlclose
|
||||
#define hwloc_dlerror dlerror
|
||||
#define hwloc_dlsym dlsym
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static hwloc_dlhandle hwloc_dlopenext(const char *_filename)
|
||||
{
|
||||
hwloc_dlhandle handle;
|
||||
char *filename = NULL;
|
||||
(void) asprintf(&filename, "%s.so", _filename);
|
||||
if (!filename)
|
||||
return NULL;
|
||||
handle = dlopen(filename, RTLD_NOW|RTLD_LOCAL);
|
||||
free(filename);
|
||||
return handle;
|
||||
}
|
||||
|
||||
static int
|
||||
hwloc_dlforeachfile(const char *_paths,
|
||||
int (*func)(const char *filename, void *data),
|
||||
void *data)
|
||||
{
|
||||
char *paths = NULL, *path;
|
||||
|
||||
paths = strdup(_paths);
|
||||
if (!paths)
|
||||
return -1;
|
||||
|
||||
path = paths;
|
||||
while (*path) {
|
||||
char *colon;
|
||||
DIR *dir;
|
||||
struct dirent *dirent;
|
||||
|
||||
colon = strchr(path, ':');
|
||||
if (colon)
|
||||
*colon = '\0';
|
||||
|
||||
if (hwloc_plugins_verbose)
|
||||
fprintf(stderr, " Looking under %s\n", path);
|
||||
|
||||
dir = opendir(path);
|
||||
if (!dir)
|
||||
goto next;
|
||||
|
||||
while ((dirent = readdir(dir)) != NULL) {
|
||||
char *abs_name, *suffix;
|
||||
struct stat stbuf;
|
||||
int err;
|
||||
|
||||
err = asprintf(&abs_name, "%s/%s", path, dirent->d_name);
|
||||
if (err < 0)
|
||||
continue;
|
||||
|
||||
err = stat(abs_name, &stbuf);
|
||||
if (err < 0) {
|
||||
free(abs_name);
|
||||
continue;
|
||||
}
|
||||
if (!S_ISREG(stbuf.st_mode)) {
|
||||
free(abs_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Only keep .so files, and remove that suffix to get the component basename */
|
||||
suffix = strrchr(abs_name, '.');
|
||||
if (!suffix || strcmp(suffix, ".so")) {
|
||||
free(abs_name);
|
||||
continue;
|
||||
}
|
||||
*suffix = '\0';
|
||||
|
||||
err = func(abs_name, data);
|
||||
if (err) {
|
||||
free(abs_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
free(abs_name);
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
|
||||
next:
|
||||
if (!colon)
|
||||
break;
|
||||
path = colon+1;
|
||||
}
|
||||
|
||||
free(paths);
|
||||
return 0;
|
||||
}
|
||||
#endif /* !HWLOC_HAVE_LTDL */
|
||||
|
||||
/* array of pointers to dynamically loaded plugins */
|
||||
static struct hwloc__plugin_desc {
|
||||
char *name;
|
||||
struct hwloc_component *component;
|
||||
char *filename;
|
||||
lt_dlhandle handle;
|
||||
hwloc_dlhandle handle;
|
||||
struct hwloc__plugin_desc *next;
|
||||
} *hwloc_plugins = NULL;
|
||||
|
||||
|
@ -77,9 +192,10 @@ static int
|
|||
hwloc__dlforeach_cb(const char *filename, void *_data __hwloc_attribute_unused)
|
||||
{
|
||||
const char *basename;
|
||||
lt_dlhandle handle;
|
||||
hwloc_dlhandle handle;
|
||||
struct hwloc_component *component;
|
||||
struct hwloc__plugin_desc *desc, **prevdesc;
|
||||
char *componentsymbolname;
|
||||
|
||||
if (hwloc_plugins_verbose)
|
||||
fprintf(stderr, "Plugin dlforeach found `%s'\n", filename);
|
||||
|
@ -97,33 +213,40 @@ hwloc__dlforeach_cb(const char *filename, void *_data __hwloc_attribute_unused)
|
|||
}
|
||||
|
||||
/* dlopen and get the component structure */
|
||||
handle = lt_dlopenext(filename);
|
||||
handle = hwloc_dlopenext(filename);
|
||||
if (!handle) {
|
||||
if (hwloc_plugins_verbose)
|
||||
fprintf(stderr, "Failed to load plugin: %s\n", lt_dlerror());
|
||||
fprintf(stderr, "Failed to load plugin: %s\n", hwloc_dlerror());
|
||||
goto out;
|
||||
}
|
||||
|
||||
{
|
||||
char componentsymbolname[strlen(basename)+10+1];
|
||||
componentsymbolname = malloc(strlen(basename)+10+1);
|
||||
if (!componentsymbolname) {
|
||||
if (hwloc_plugins_verbose)
|
||||
fprintf(stderr, "Failed to allocation component `%s' symbol\n",
|
||||
basename);
|
||||
goto out_with_handle;
|
||||
}
|
||||
sprintf(componentsymbolname, "%s_component", basename);
|
||||
component = lt_dlsym(handle, componentsymbolname);
|
||||
component = hwloc_dlsym(handle, componentsymbolname);
|
||||
if (!component) {
|
||||
if (hwloc_plugins_verbose)
|
||||
fprintf(stderr, "Failed to find component symbol `%s'\n",
|
||||
componentsymbolname);
|
||||
free(componentsymbolname);
|
||||
goto out_with_handle;
|
||||
}
|
||||
if (component->abi != HWLOC_COMPONENT_ABI) {
|
||||
if (hwloc_plugins_verbose)
|
||||
fprintf(stderr, "Plugin symbol ABI %u instead of %d\n",
|
||||
component->abi, HWLOC_COMPONENT_ABI);
|
||||
free(componentsymbolname);
|
||||
goto out_with_handle;
|
||||
}
|
||||
if (hwloc_plugins_verbose)
|
||||
fprintf(stderr, "Plugin contains expected symbol `%s'\n",
|
||||
componentsymbolname);
|
||||
}
|
||||
free(componentsymbolname);
|
||||
|
||||
if (HWLOC_COMPONENT_TYPE_DISC == component->type) {
|
||||
if (strncmp(basename, "hwloc_", 6)) {
|
||||
|
@ -166,7 +289,7 @@ hwloc__dlforeach_cb(const char *filename, void *_data __hwloc_attribute_unused)
|
|||
return 0;
|
||||
|
||||
out_with_handle:
|
||||
lt_dlclose(handle);
|
||||
hwloc_dlclose(handle);
|
||||
out:
|
||||
return 0;
|
||||
}
|
||||
|
@ -182,7 +305,7 @@ hwloc_plugins_exit(void)
|
|||
desc = hwloc_plugins;
|
||||
while (desc) {
|
||||
next = desc->next;
|
||||
lt_dlclose(desc->handle);
|
||||
hwloc_dlclose(desc->handle);
|
||||
free(desc->name);
|
||||
free(desc->filename);
|
||||
free(desc);
|
||||
|
@ -190,7 +313,7 @@ hwloc_plugins_exit(void)
|
|||
}
|
||||
hwloc_plugins = NULL;
|
||||
|
||||
lt_dlexit();
|
||||
hwloc_dlexit();
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -206,7 +329,7 @@ hwloc_plugins_init(void)
|
|||
|
||||
hwloc_plugins_blacklist = getenv("HWLOC_PLUGINS_BLACKLIST");
|
||||
|
||||
err = lt_dlinit();
|
||||
err = hwloc_dlinit();
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
|
@ -218,7 +341,7 @@ hwloc_plugins_init(void)
|
|||
|
||||
if (hwloc_plugins_verbose)
|
||||
fprintf(stderr, "Starting plugin dlforeach in %s\n", path);
|
||||
err = lt_dlforeachfile(path, hwloc__dlforeach_cb, NULL);
|
||||
err = hwloc_dlforeachfile(path, hwloc__dlforeach_cb, NULL);
|
||||
if (err)
|
||||
goto out_with_init;
|
||||
|
||||
|
@ -232,17 +355,6 @@ hwloc_plugins_init(void)
|
|||
|
||||
#endif /* HWLOC_HAVE_PLUGINS */
|
||||
|
||||
static const char *
|
||||
hwloc_disc_component_type_string(hwloc_disc_component_type_t type)
|
||||
{
|
||||
switch (type) {
|
||||
case HWLOC_DISC_COMPONENT_TYPE_CPU: return "cpu";
|
||||
case HWLOC_DISC_COMPONENT_TYPE_GLOBAL: return "global";
|
||||
case HWLOC_DISC_COMPONENT_TYPE_MISC: return "misc";
|
||||
default: return "**unknown**";
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
hwloc_disc_component_register(struct hwloc_disc_component *component,
|
||||
const char *filename)
|
||||
|
@ -256,21 +368,26 @@ hwloc_disc_component_register(struct hwloc_disc_component *component,
|
|||
return -1;
|
||||
}
|
||||
if (strchr(component->name, HWLOC_COMPONENT_EXCLUDE_CHAR)
|
||||
|| strchr(component->name, HWLOC_COMPONENT_PHASESEP_CHAR)
|
||||
|| strcspn(component->name, HWLOC_COMPONENT_SEPS) != strlen(component->name)) {
|
||||
if (hwloc_components_verbose)
|
||||
fprintf(stderr, "Cannot register discovery component with name `%s' containing reserved characters `%c" HWLOC_COMPONENT_SEPS "'\n",
|
||||
component->name, HWLOC_COMPONENT_EXCLUDE_CHAR);
|
||||
return -1;
|
||||
}
|
||||
/* check that the component type is valid */
|
||||
switch ((unsigned) component->type) {
|
||||
case HWLOC_DISC_COMPONENT_TYPE_CPU:
|
||||
case HWLOC_DISC_COMPONENT_TYPE_GLOBAL:
|
||||
case HWLOC_DISC_COMPONENT_TYPE_MISC:
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Cannot register discovery component `%s' with unknown type %u\n",
|
||||
component->name, (unsigned) component->type);
|
||||
|
||||
/* check that the component phases are valid */
|
||||
if (!component->phases
|
||||
|| (component->phases != HWLOC_DISC_PHASE_GLOBAL
|
||||
&& component->phases & ~(HWLOC_DISC_PHASE_CPU
|
||||
|HWLOC_DISC_PHASE_MEMORY
|
||||
|HWLOC_DISC_PHASE_PCI
|
||||
|HWLOC_DISC_PHASE_IO
|
||||
|HWLOC_DISC_PHASE_MISC
|
||||
|HWLOC_DISC_PHASE_ANNOTATE
|
||||
|HWLOC_DISC_PHASE_TWEAK))) {
|
||||
fprintf(stderr, "Cannot register discovery component `%s' with invalid phases 0x%x\n",
|
||||
component->name, component->phases);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -295,8 +412,8 @@ hwloc_disc_component_register(struct hwloc_disc_component *component,
|
|||
prev = &((*prev)->next);
|
||||
}
|
||||
if (hwloc_components_verbose)
|
||||
fprintf(stderr, "Registered %s discovery component `%s' with priority %u (%s%s)\n",
|
||||
hwloc_disc_component_type_string(component->type), component->name, component->priority,
|
||||
fprintf(stderr, "Registered discovery component `%s' phases 0x%x with priority %u (%s%s)\n",
|
||||
component->name, component->phases, component->priority,
|
||||
filename ? "from plugin " : "statically build", filename ? filename : "");
|
||||
|
||||
prev = &hwloc_disc_components;
|
||||
|
@ -310,7 +427,7 @@ hwloc_disc_component_register(struct hwloc_disc_component *component,
|
|||
return 0;
|
||||
}
|
||||
|
||||
#include <static-components.h>
|
||||
#include "static-components.h"
|
||||
|
||||
static void (**hwloc_component_finalize_cbs)(unsigned long);
|
||||
static unsigned hwloc_component_finalize_cb_count;
|
||||
|
@ -415,31 +532,152 @@ hwloc_components_init(void)
|
|||
}
|
||||
|
||||
void
|
||||
hwloc_backends_init(struct hwloc_topology *topology)
|
||||
hwloc_topology_components_init(struct hwloc_topology *topology)
|
||||
{
|
||||
topology->nr_blacklisted_components = 0;
|
||||
topology->blacklisted_components = NULL;
|
||||
|
||||
topology->backends = NULL;
|
||||
topology->backend_excludes = 0;
|
||||
topology->backend_phases = 0;
|
||||
topology->backend_excluded_phases = 0;
|
||||
}
|
||||
|
||||
/* look for name among components, ignoring things after `:' */
|
||||
static struct hwloc_disc_component *
|
||||
hwloc_disc_component_find(int type /* hwloc_disc_component_type_t or -1 if any */,
|
||||
const char *name /* name of NULL if any */)
|
||||
hwloc_disc_component_find(const char *name, const char **endp)
|
||||
{
|
||||
struct hwloc_disc_component *comp = hwloc_disc_components;
|
||||
struct hwloc_disc_component *comp;
|
||||
size_t length;
|
||||
const char *end = strchr(name, HWLOC_COMPONENT_PHASESEP_CHAR);
|
||||
if (end) {
|
||||
length = end-name;
|
||||
if (endp)
|
||||
*endp = end+1;
|
||||
} else {
|
||||
length = strlen(name);
|
||||
if (endp)
|
||||
*endp = NULL;
|
||||
}
|
||||
|
||||
comp = hwloc_disc_components;
|
||||
while (NULL != comp) {
|
||||
if ((-1 == type || type == (int) comp->type)
|
||||
&& (NULL == name || !strcmp(name, comp->name)))
|
||||
if (!strncmp(name, comp->name, length))
|
||||
return comp;
|
||||
comp = comp->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static unsigned
|
||||
hwloc_phases_from_string(const char *s)
|
||||
{
|
||||
if (!s)
|
||||
return ~0U;
|
||||
if (s[0]<'0' || s[0]>'9') {
|
||||
if (!strcasecmp(s, "global"))
|
||||
return HWLOC_DISC_PHASE_GLOBAL;
|
||||
else if (!strcasecmp(s, "cpu"))
|
||||
return HWLOC_DISC_PHASE_CPU;
|
||||
if (!strcasecmp(s, "memory"))
|
||||
return HWLOC_DISC_PHASE_MEMORY;
|
||||
if (!strcasecmp(s, "pci"))
|
||||
return HWLOC_DISC_PHASE_PCI;
|
||||
if (!strcasecmp(s, "io"))
|
||||
return HWLOC_DISC_PHASE_IO;
|
||||
if (!strcasecmp(s, "misc"))
|
||||
return HWLOC_DISC_PHASE_MISC;
|
||||
if (!strcasecmp(s, "annotate"))
|
||||
return HWLOC_DISC_PHASE_ANNOTATE;
|
||||
if (!strcasecmp(s, "tweak"))
|
||||
return HWLOC_DISC_PHASE_TWEAK;
|
||||
return 0;
|
||||
}
|
||||
return (unsigned) strtoul(s, NULL, 0);
|
||||
}
|
||||
|
||||
static int
|
||||
hwloc_disc_component_blacklist_one(struct hwloc_topology *topology,
|
||||
const char *name)
|
||||
{
|
||||
struct hwloc_topology_forced_component_s *blacklisted;
|
||||
struct hwloc_disc_component *comp;
|
||||
unsigned phases;
|
||||
unsigned i;
|
||||
|
||||
if (!strcmp(name, "linuxpci") || !strcmp(name, "linuxio")) {
|
||||
/* replace linuxpci and linuxio with linux (with IO phases)
|
||||
* for backward compatibility with pre-v2.0 and v2.0 respectively */
|
||||
if (hwloc_components_verbose)
|
||||
fprintf(stderr, "Replacing deprecated component `%s' with `linux' IO phases in blacklisting\n", name);
|
||||
comp = hwloc_disc_component_find("linux", NULL);
|
||||
phases = HWLOC_DISC_PHASE_PCI | HWLOC_DISC_PHASE_IO | HWLOC_DISC_PHASE_MISC | HWLOC_DISC_PHASE_ANNOTATE;
|
||||
|
||||
} else {
|
||||
/* normal lookup */
|
||||
const char *end;
|
||||
comp = hwloc_disc_component_find(name, &end);
|
||||
phases = hwloc_phases_from_string(end);
|
||||
}
|
||||
if (!comp) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (hwloc_components_verbose)
|
||||
fprintf(stderr, "Blacklisting component `%s` phases 0x%x\n", comp->name, phases);
|
||||
|
||||
for(i=0; i<topology->nr_blacklisted_components; i++) {
|
||||
if (topology->blacklisted_components[i].component == comp) {
|
||||
topology->blacklisted_components[i].phases |= phases;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
blacklisted = realloc(topology->blacklisted_components, (topology->nr_blacklisted_components+1)*sizeof(*blacklisted));
|
||||
if (!blacklisted)
|
||||
return -1;
|
||||
|
||||
blacklisted[topology->nr_blacklisted_components].component = comp;
|
||||
blacklisted[topology->nr_blacklisted_components].phases = phases;
|
||||
topology->blacklisted_components = blacklisted;
|
||||
topology->nr_blacklisted_components++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_topology_set_components(struct hwloc_topology *topology,
|
||||
unsigned long flags,
|
||||
const char *name)
|
||||
{
|
||||
if (topology->is_loaded) {
|
||||
errno = EBUSY;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (flags & ~HWLOC_TOPOLOGY_COMPONENTS_FLAG_BLACKLIST) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* this flag is strictly required for now */
|
||||
if (flags != HWLOC_TOPOLOGY_COMPONENTS_FLAG_BLACKLIST) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!strncmp(name, "all", 3) && name[3] == HWLOC_COMPONENT_PHASESEP_CHAR) {
|
||||
topology->backend_excluded_phases = hwloc_phases_from_string(name+4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return hwloc_disc_component_blacklist_one(topology, name);
|
||||
}
|
||||
|
||||
/* used by set_xml(), set_synthetic(), ... environment variables, ... to force the first backend */
|
||||
int
|
||||
hwloc_disc_component_force_enable(struct hwloc_topology *topology,
|
||||
int envvar_forced,
|
||||
int type, const char *name,
|
||||
const char *name,
|
||||
const void *data1, const void *data2, const void *data3)
|
||||
{
|
||||
struct hwloc_disc_component *comp;
|
||||
|
@ -450,18 +688,28 @@ hwloc_disc_component_force_enable(struct hwloc_topology *topology,
|
|||
return -1;
|
||||
}
|
||||
|
||||
comp = hwloc_disc_component_find(type, name);
|
||||
comp = hwloc_disc_component_find(name, NULL);
|
||||
if (!comp) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
backend = comp->instantiate(comp, data1, data2, data3);
|
||||
backend = comp->instantiate(topology, comp, 0U /* force-enabled don't get any phase blacklisting */,
|
||||
data1, data2, data3);
|
||||
if (backend) {
|
||||
int err;
|
||||
backend->envvar_forced = envvar_forced;
|
||||
if (topology->backends)
|
||||
hwloc_backends_disable_all(topology);
|
||||
return hwloc_backend_enable(topology, backend);
|
||||
err = hwloc_backend_enable(backend);
|
||||
|
||||
if (comp->phases == HWLOC_DISC_PHASE_GLOBAL) {
|
||||
char *env = getenv("HWLOC_ANNOTATE_GLOBAL_COMPONENTS");
|
||||
if (env && atoi(env))
|
||||
topology->backend_excluded_phases &= ~HWLOC_DISC_PHASE_ANNOTATE;
|
||||
}
|
||||
|
||||
return err;
|
||||
} else
|
||||
return -1;
|
||||
}
|
||||
|
@ -469,29 +717,32 @@ hwloc_disc_component_force_enable(struct hwloc_topology *topology,
|
|||
static int
|
||||
hwloc_disc_component_try_enable(struct hwloc_topology *topology,
|
||||
struct hwloc_disc_component *comp,
|
||||
const char *comparg,
|
||||
int envvar_forced)
|
||||
int envvar_forced,
|
||||
unsigned blacklisted_phases)
|
||||
{
|
||||
struct hwloc_backend *backend;
|
||||
|
||||
if (topology->backend_excludes & comp->type) {
|
||||
if (!(comp->phases & ~(topology->backend_excluded_phases | blacklisted_phases))) {
|
||||
/* all this backend phases are already excluded, exclude the backend entirely */
|
||||
if (hwloc_components_verbose)
|
||||
/* do not warn if envvar_forced since system-wide HWLOC_COMPONENTS must be silently ignored after set_xml() etc.
|
||||
*/
|
||||
fprintf(stderr, "Excluding %s discovery component `%s', conflicts with excludes 0x%x\n",
|
||||
hwloc_disc_component_type_string(comp->type), comp->name, topology->backend_excludes);
|
||||
fprintf(stderr, "Excluding discovery component `%s' phases 0x%x, conflicts with excludes 0x%x\n",
|
||||
comp->name, comp->phases, topology->backend_excluded_phases);
|
||||
return -1;
|
||||
}
|
||||
|
||||
backend = comp->instantiate(comp, comparg, NULL, NULL);
|
||||
backend = comp->instantiate(topology, comp, topology->backend_excluded_phases | blacklisted_phases,
|
||||
NULL, NULL, NULL);
|
||||
if (!backend) {
|
||||
if (hwloc_components_verbose || envvar_forced)
|
||||
fprintf(stderr, "Failed to instantiate discovery component `%s'\n", comp->name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
backend->phases &= ~blacklisted_phases;
|
||||
backend->envvar_forced = envvar_forced;
|
||||
return hwloc_backend_enable(topology, backend);
|
||||
return hwloc_backend_enable(backend);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -502,10 +753,47 @@ hwloc_disc_components_enable_others(struct hwloc_topology *topology)
|
|||
int tryall = 1;
|
||||
const char *_env;
|
||||
char *env; /* we'll to modify the env value, so duplicate it */
|
||||
unsigned i;
|
||||
|
||||
_env = getenv("HWLOC_COMPONENTS");
|
||||
env = _env ? strdup(_env) : NULL;
|
||||
|
||||
/* blacklist disabled components */
|
||||
if (env) {
|
||||
char *curenv = env;
|
||||
size_t s;
|
||||
|
||||
while (*curenv) {
|
||||
s = strcspn(curenv, HWLOC_COMPONENT_SEPS);
|
||||
if (s) {
|
||||
char c;
|
||||
|
||||
if (curenv[0] != HWLOC_COMPONENT_EXCLUDE_CHAR)
|
||||
goto nextname;
|
||||
|
||||
/* save the last char and replace with \0 */
|
||||
c = curenv[s];
|
||||
curenv[s] = '\0';
|
||||
|
||||
/* blacklist it, and just ignore failures to allocate */
|
||||
hwloc_disc_component_blacklist_one(topology, curenv+1);
|
||||
|
||||
/* remove that blacklisted name from the string */
|
||||
for(i=0; i<s; i++)
|
||||
curenv[i] = *HWLOC_COMPONENT_SEPS;
|
||||
|
||||
/* restore chars (the second loop below needs env to be unmodified) */
|
||||
curenv[s] = c;
|
||||
}
|
||||
|
||||
nextname:
|
||||
curenv += s;
|
||||
if (*curenv)
|
||||
/* Skip comma */
|
||||
curenv++;
|
||||
}
|
||||
}
|
||||
|
||||
/* enable explicitly listed components */
|
||||
if (env) {
|
||||
char *curenv = env;
|
||||
|
@ -515,22 +803,7 @@ hwloc_disc_components_enable_others(struct hwloc_topology *topology)
|
|||
s = strcspn(curenv, HWLOC_COMPONENT_SEPS);
|
||||
if (s) {
|
||||
char c;
|
||||
|
||||
/* replace linuxpci with linuxio for backward compatibility with pre-v2.0 */
|
||||
if (!strncmp(curenv, "linuxpci", 8) && s == 8) {
|
||||
curenv[5] = 'i';
|
||||
curenv[6] = 'o';
|
||||
curenv[7] = *HWLOC_COMPONENT_SEPS;
|
||||
} else if (curenv[0] == HWLOC_COMPONENT_EXCLUDE_CHAR && !strncmp(curenv+1, "linuxpci", 8) && s == 9) {
|
||||
curenv[6] = 'i';
|
||||
curenv[7] = 'o';
|
||||
curenv[8] = *HWLOC_COMPONENT_SEPS;
|
||||
/* skip this name, it's a negated one */
|
||||
goto nextname;
|
||||
}
|
||||
|
||||
if (curenv[0] == HWLOC_COMPONENT_EXCLUDE_CHAR)
|
||||
goto nextname;
|
||||
const char *name;
|
||||
|
||||
if (!strncmp(curenv, HWLOC_COMPONENT_STOP_NAME, s)) {
|
||||
tryall = 0;
|
||||
|
@ -541,18 +814,31 @@ hwloc_disc_components_enable_others(struct hwloc_topology *topology)
|
|||
c = curenv[s];
|
||||
curenv[s] = '\0';
|
||||
|
||||
comp = hwloc_disc_component_find(-1, curenv);
|
||||
name = curenv;
|
||||
if (!strcmp(name, "linuxpci") || !strcmp(name, "linuxio")) {
|
||||
if (hwloc_components_verbose)
|
||||
fprintf(stderr, "Replacing deprecated component `%s' with `linux' in envvar forcing\n", name);
|
||||
name = "linux";
|
||||
}
|
||||
|
||||
comp = hwloc_disc_component_find(name, NULL /* we enable the entire component, phases must be blacklisted separately */);
|
||||
if (comp) {
|
||||
hwloc_disc_component_try_enable(topology, comp, NULL, 1 /* envvar forced */);
|
||||
unsigned blacklisted_phases = 0U;
|
||||
for(i=0; i<topology->nr_blacklisted_components; i++)
|
||||
if (comp == topology->blacklisted_components[i].component) {
|
||||
blacklisted_phases = topology->blacklisted_components[i].phases;
|
||||
break;
|
||||
}
|
||||
if (comp->phases & ~blacklisted_phases)
|
||||
hwloc_disc_component_try_enable(topology, comp, 1 /* envvar forced */, blacklisted_phases);
|
||||
} else {
|
||||
fprintf(stderr, "Cannot find discovery component `%s'\n", curenv);
|
||||
fprintf(stderr, "Cannot find discovery component `%s'\n", name);
|
||||
}
|
||||
|
||||
/* restore chars (the second loop below needs env to be unmodified) */
|
||||
curenv[s] = c;
|
||||
}
|
||||
|
||||
nextname:
|
||||
curenv += s;
|
||||
if (*curenv)
|
||||
/* Skip comma */
|
||||
|
@ -566,26 +852,24 @@ nextname:
|
|||
if (tryall) {
|
||||
comp = hwloc_disc_components;
|
||||
while (NULL != comp) {
|
||||
unsigned blacklisted_phases = 0U;
|
||||
if (!comp->enabled_by_default)
|
||||
goto nextcomp;
|
||||
/* check if this component was explicitly excluded in env */
|
||||
if (env) {
|
||||
char *curenv = env;
|
||||
while (*curenv) {
|
||||
size_t s = strcspn(curenv, HWLOC_COMPONENT_SEPS);
|
||||
if (curenv[0] == HWLOC_COMPONENT_EXCLUDE_CHAR && !strncmp(curenv+1, comp->name, s-1) && strlen(comp->name) == s-1) {
|
||||
if (hwloc_components_verbose)
|
||||
fprintf(stderr, "Excluding %s discovery component `%s' because of HWLOC_COMPONENTS environment variable\n",
|
||||
hwloc_disc_component_type_string(comp->type), comp->name);
|
||||
goto nextcomp;
|
||||
}
|
||||
curenv += s;
|
||||
if (*curenv)
|
||||
/* Skip comma */
|
||||
curenv++;
|
||||
/* check if this component was blacklisted by the application */
|
||||
for(i=0; i<topology->nr_blacklisted_components; i++)
|
||||
if (comp == topology->blacklisted_components[i].component) {
|
||||
blacklisted_phases = topology->blacklisted_components[i].phases;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(comp->phases & ~blacklisted_phases)) {
|
||||
if (hwloc_components_verbose)
|
||||
fprintf(stderr, "Excluding blacklisted discovery component `%s' phases 0x%x\n",
|
||||
comp->name, comp->phases);
|
||||
goto nextcomp;
|
||||
}
|
||||
hwloc_disc_component_try_enable(topology, comp, NULL, 0 /* defaults, not envvar forced */);
|
||||
|
||||
hwloc_disc_component_try_enable(topology, comp, 0 /* defaults, not envvar forced */, blacklisted_phases);
|
||||
nextcomp:
|
||||
comp = comp->next;
|
||||
}
|
||||
|
@ -597,7 +881,7 @@ nextcomp:
|
|||
backend = topology->backends;
|
||||
fprintf(stderr, "Final list of enabled discovery components: ");
|
||||
while (backend != NULL) {
|
||||
fprintf(stderr, "%s%s", first ? "" : ",", backend->component->name);
|
||||
fprintf(stderr, "%s%s(0x%x)", first ? "" : ",", backend->component->name, backend->phases);
|
||||
backend = backend->next;
|
||||
first = 0;
|
||||
}
|
||||
|
@ -638,7 +922,8 @@ hwloc_components_fini(void)
|
|||
}
|
||||
|
||||
struct hwloc_backend *
|
||||
hwloc_backend_alloc(struct hwloc_disc_component *component)
|
||||
hwloc_backend_alloc(struct hwloc_topology *topology,
|
||||
struct hwloc_disc_component *component)
|
||||
{
|
||||
struct hwloc_backend * backend = malloc(sizeof(*backend));
|
||||
if (!backend) {
|
||||
|
@ -646,6 +931,12 @@ hwloc_backend_alloc(struct hwloc_disc_component *component)
|
|||
return NULL;
|
||||
}
|
||||
backend->component = component;
|
||||
backend->topology = topology;
|
||||
/* filter-out component phases that are excluded */
|
||||
backend->phases = component->phases & ~topology->backend_excluded_phases;
|
||||
if (backend->phases != component->phases && hwloc_components_verbose)
|
||||
fprintf(stderr, "Trying discovery component `%s' with phases 0x%x instead of 0x%x\n",
|
||||
component->name, backend->phases, component->phases);
|
||||
backend->flags = 0;
|
||||
backend->discover = NULL;
|
||||
backend->get_pci_busid_cpuset = NULL;
|
||||
|
@ -665,14 +956,15 @@ hwloc_backend_disable(struct hwloc_backend *backend)
|
|||
}
|
||||
|
||||
int
|
||||
hwloc_backend_enable(struct hwloc_topology *topology, struct hwloc_backend *backend)
|
||||
hwloc_backend_enable(struct hwloc_backend *backend)
|
||||
{
|
||||
struct hwloc_topology *topology = backend->topology;
|
||||
struct hwloc_backend **pprev;
|
||||
|
||||
/* check backend flags */
|
||||
if (backend->flags) {
|
||||
fprintf(stderr, "Cannot enable %s discovery component `%s' with unknown flags %lx\n",
|
||||
hwloc_disc_component_type_string(backend->component->type), backend->component->name, backend->flags);
|
||||
fprintf(stderr, "Cannot enable discovery component `%s' phases 0x%x with unknown flags %lx\n",
|
||||
backend->component->name, backend->component->phases, backend->flags);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -681,8 +973,8 @@ hwloc_backend_enable(struct hwloc_topology *topology, struct hwloc_backend *back
|
|||
while (NULL != *pprev) {
|
||||
if ((*pprev)->component == backend->component) {
|
||||
if (hwloc_components_verbose)
|
||||
fprintf(stderr, "Cannot enable %s discovery component `%s' twice\n",
|
||||
hwloc_disc_component_type_string(backend->component->type), backend->component->name);
|
||||
fprintf(stderr, "Cannot enable discovery component `%s' phases 0x%x twice\n",
|
||||
backend->component->name, backend->component->phases);
|
||||
hwloc_backend_disable(backend);
|
||||
errno = EBUSY;
|
||||
return -1;
|
||||
|
@ -691,8 +983,8 @@ hwloc_backend_enable(struct hwloc_topology *topology, struct hwloc_backend *back
|
|||
}
|
||||
|
||||
if (hwloc_components_verbose)
|
||||
fprintf(stderr, "Enabling %s discovery component `%s'\n",
|
||||
hwloc_disc_component_type_string(backend->component->type), backend->component->name);
|
||||
fprintf(stderr, "Enabling discovery component `%s' with phases 0x%x (among 0x%x)\n",
|
||||
backend->component->name, backend->phases, backend->component->phases);
|
||||
|
||||
/* enqueue at the end */
|
||||
pprev = &topology->backends;
|
||||
|
@ -701,8 +993,8 @@ hwloc_backend_enable(struct hwloc_topology *topology, struct hwloc_backend *back
|
|||
backend->next = *pprev;
|
||||
*pprev = backend;
|
||||
|
||||
backend->topology = topology;
|
||||
topology->backend_excludes |= backend->component->excludes;
|
||||
topology->backend_phases |= backend->component->phases;
|
||||
topology->backend_excluded_phases |= backend->component->excluded_phases;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -712,7 +1004,7 @@ hwloc_backends_is_thissystem(struct hwloc_topology *topology)
|
|||
struct hwloc_backend *backend;
|
||||
const char *local_env;
|
||||
|
||||
/* Apply is_thissystem topology flag before we enforce envvar backends.
|
||||
/*
|
||||
* If the application changed the backend with set_foo(),
|
||||
* it may use set_flags() update the is_thissystem flag here.
|
||||
* If it changes the backend with environment variables below,
|
||||
|
@ -775,11 +1067,20 @@ hwloc_backends_disable_all(struct hwloc_topology *topology)
|
|||
while (NULL != (backend = topology->backends)) {
|
||||
struct hwloc_backend *next = backend->next;
|
||||
if (hwloc_components_verbose)
|
||||
fprintf(stderr, "Disabling %s discovery component `%s'\n",
|
||||
hwloc_disc_component_type_string(backend->component->type), backend->component->name);
|
||||
fprintf(stderr, "Disabling discovery component `%s'\n",
|
||||
backend->component->name);
|
||||
hwloc_backend_disable(backend);
|
||||
topology->backends = next;
|
||||
}
|
||||
topology->backends = NULL;
|
||||
topology->backend_excludes = 0;
|
||||
topology->backend_excluded_phases = 0;
|
||||
}
|
||||
|
||||
void
|
||||
hwloc_topology_components_fini(struct hwloc_topology *topology)
|
||||
{
|
||||
/* hwloc_backends_disable_all() must have been called earlier */
|
||||
assert(!topology->backends);
|
||||
|
||||
free(topology->blacklisted_components);
|
||||
}
|
||||
|
|
15
src/3rdparty/hwloc/src/diff.c
vendored
15
src/3rdparty/hwloc/src/diff.c
vendored
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
* Copyright © 2013-2018 Inria. All rights reserved.
|
||||
* 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>
|
||||
#include "private/autogen/config.h"
|
||||
#include "private/private.h"
|
||||
#include "private/misc.h"
|
||||
|
||||
int hwloc_topology_diff_destroy(hwloc_topology_diff_t diff)
|
||||
{
|
||||
|
@ -351,7 +351,8 @@ int hwloc_topology_diff_build(hwloc_topology_t topo1,
|
|||
err = 1;
|
||||
break;
|
||||
}
|
||||
if (dist1->type != dist2->type
|
||||
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))) {
|
||||
|
@ -463,6 +464,10 @@ int hwloc_topology_diff_apply(hwloc_topology_t topology,
|
|||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (topology->adopted_shmem_addr) {
|
||||
errno = EPERM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (flags & ~HWLOC_TOPOLOGY_DIFF_APPLY_REVERSE) {
|
||||
errno = EINVAL;
|
||||
|
|
371
src/3rdparty/hwloc/src/distances.c
vendored
371
src/3rdparty/hwloc/src/distances.c
vendored
|
@ -1,19 +1,22 @@
|
|||
/*
|
||||
* Copyright © 2010-2018 Inria. All rights reserved.
|
||||
* Copyright © 2010-2019 Inria. All rights reserved.
|
||||
* Copyright © 2011-2012 Université Bordeaux
|
||||
* Copyright © 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>
|
||||
#include <private/debug.h>
|
||||
#include <private/misc.h>
|
||||
#include "private/autogen/config.h"
|
||||
#include "hwloc.h"
|
||||
#include "private/private.h"
|
||||
#include "private/debug.h"
|
||||
#include "private/misc.h"
|
||||
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
|
||||
static struct hwloc_internal_distances_s *
|
||||
hwloc__internal_distances_from_public(hwloc_topology_t topology, struct hwloc_distances_s *distances);
|
||||
|
||||
/******************************************************
|
||||
* Global init, prepare, destroy, dup
|
||||
*/
|
||||
|
@ -70,6 +73,8 @@ void hwloc_internal_distances_prepare(struct hwloc_topology *topology)
|
|||
|
||||
static void hwloc_internal_distances_free(struct hwloc_internal_distances_s *dist)
|
||||
{
|
||||
free(dist->name);
|
||||
free(dist->different_types);
|
||||
free(dist->indexes);
|
||||
free(dist->objs);
|
||||
free(dist->values);
|
||||
|
@ -96,15 +101,35 @@ static int hwloc_internal_distances_dup_one(struct hwloc_topology *new, struct h
|
|||
newdist = hwloc_tma_malloc(tma, sizeof(*newdist));
|
||||
if (!newdist)
|
||||
return -1;
|
||||
if (olddist->name) {
|
||||
newdist->name = hwloc_tma_strdup(tma, olddist->name);
|
||||
if (!newdist->name) {
|
||||
assert(!tma || !tma->dontfree); /* this tma cannot fail to allocate */
|
||||
hwloc_internal_distances_free(newdist);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
newdist->name = NULL;
|
||||
}
|
||||
|
||||
newdist->type = olddist->type;
|
||||
if (olddist->different_types) {
|
||||
newdist->different_types = hwloc_tma_malloc(tma, nbobjs * sizeof(*newdist->different_types));
|
||||
if (!newdist->different_types) {
|
||||
assert(!tma || !tma->dontfree); /* this tma cannot fail to allocate */
|
||||
hwloc_internal_distances_free(newdist);
|
||||
return -1;
|
||||
}
|
||||
memcpy(newdist->different_types, olddist->different_types, nbobjs * sizeof(*newdist->different_types));
|
||||
} else
|
||||
newdist->different_types = NULL;
|
||||
newdist->unique_type = olddist->unique_type;
|
||||
newdist->nbobjs = nbobjs;
|
||||
newdist->kind = olddist->kind;
|
||||
newdist->id = olddist->id;
|
||||
|
||||
newdist->indexes = hwloc_tma_malloc(tma, nbobjs * sizeof(*newdist->indexes));
|
||||
newdist->objs = hwloc_tma_calloc(tma, nbobjs * sizeof(*newdist->objs));
|
||||
newdist->objs_are_valid = 0;
|
||||
newdist->iflags = olddist->iflags & ~HWLOC_INTERNAL_DIST_FLAG_OBJS_VALID; /* must be revalidated after dup() */
|
||||
newdist->values = hwloc_tma_malloc(tma, nbobjs*nbobjs * sizeof(*newdist->values));
|
||||
if (!newdist->indexes || !newdist->objs || !newdist->values) {
|
||||
assert(!tma || !tma->dontfree); /* this tma cannot fail to allocate */
|
||||
|
@ -150,6 +175,10 @@ int hwloc_distances_remove(hwloc_topology_t topology)
|
|||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (topology->adopted_shmem_addr) {
|
||||
errno = EPERM;
|
||||
return -1;
|
||||
}
|
||||
hwloc_internal_distances_destroy(topology);
|
||||
return 0;
|
||||
}
|
||||
|
@ -163,6 +192,10 @@ int hwloc_distances_remove_by_depth(hwloc_topology_t topology, int depth)
|
|||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (topology->adopted_shmem_addr) {
|
||||
errno = EPERM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* switch back to types since we don't support groups for now */
|
||||
type = hwloc_get_depth_type(topology, depth);
|
||||
|
@ -174,7 +207,7 @@ int hwloc_distances_remove_by_depth(hwloc_topology_t topology, int depth)
|
|||
next = topology->first_dist;
|
||||
while ((dist = next) != NULL) {
|
||||
next = dist->next;
|
||||
if (dist->type == type) {
|
||||
if (dist->unique_type == type) {
|
||||
if (next)
|
||||
next->prev = dist->prev;
|
||||
else
|
||||
|
@ -190,6 +223,27 @@ int hwloc_distances_remove_by_depth(hwloc_topology_t topology, int depth)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int hwloc_distances_release_remove(hwloc_topology_t topology,
|
||||
struct hwloc_distances_s *distances)
|
||||
{
|
||||
struct hwloc_internal_distances_s *dist = hwloc__internal_distances_from_public(topology, distances);
|
||||
if (!dist) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (dist->prev)
|
||||
dist->prev->next = dist->next;
|
||||
else
|
||||
topology->first_dist = dist->next;
|
||||
if (dist->next)
|
||||
dist->next->prev = dist->prev;
|
||||
else
|
||||
topology->last_dist = dist->prev;
|
||||
hwloc_internal_distances_free(dist);
|
||||
hwloc_distances_release(topology, distances);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************
|
||||
* Add distances to the topology
|
||||
*/
|
||||
|
@ -201,17 +255,34 @@ hwloc__groups_by_distances(struct hwloc_topology *topology, unsigned nbobjs, str
|
|||
* the caller gives us the distances and objs pointers, we'll free them later.
|
||||
*/
|
||||
static int
|
||||
hwloc_internal_distances__add(hwloc_topology_t topology,
|
||||
hwloc_obj_type_t type, unsigned nbobjs, hwloc_obj_t *objs, uint64_t *indexes, uint64_t *values,
|
||||
unsigned long kind)
|
||||
hwloc_internal_distances__add(hwloc_topology_t topology, const char *name,
|
||||
hwloc_obj_type_t unique_type, hwloc_obj_type_t *different_types,
|
||||
unsigned nbobjs, hwloc_obj_t *objs, uint64_t *indexes, uint64_t *values,
|
||||
unsigned long kind, unsigned iflags)
|
||||
{
|
||||
struct hwloc_internal_distances_s *dist = calloc(1, sizeof(*dist));
|
||||
struct hwloc_internal_distances_s *dist;
|
||||
|
||||
if (different_types) {
|
||||
kind |= HWLOC_DISTANCES_KIND_HETEROGENEOUS_TYPES; /* the user isn't forced to give it */
|
||||
} else if (kind & HWLOC_DISTANCES_KIND_HETEROGENEOUS_TYPES) {
|
||||
errno = EINVAL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
dist = calloc(1, sizeof(*dist));
|
||||
if (!dist)
|
||||
goto err;
|
||||
|
||||
dist->type = type;
|
||||
if (name)
|
||||
dist->name = strdup(name); /* ignore failure */
|
||||
|
||||
dist->unique_type = unique_type;
|
||||
dist->different_types = different_types;
|
||||
dist->nbobjs = nbobjs;
|
||||
dist->kind = kind;
|
||||
dist->iflags = iflags;
|
||||
|
||||
assert(!!(iflags & HWLOC_INTERNAL_DIST_FLAG_OBJS_VALID) == !!objs);
|
||||
|
||||
if (!objs) {
|
||||
assert(indexes);
|
||||
|
@ -220,18 +291,16 @@ hwloc_internal_distances__add(hwloc_topology_t topology,
|
|||
dist->objs = calloc(nbobjs, sizeof(hwloc_obj_t));
|
||||
if (!dist->objs)
|
||||
goto err_with_dist;
|
||||
dist->objs_are_valid = 0;
|
||||
|
||||
} else {
|
||||
unsigned i;
|
||||
assert(!indexes);
|
||||
/* we only have objs, generate the indexes arrays so that we can refresh objs later */
|
||||
dist->objs = objs;
|
||||
dist->objs_are_valid = 1;
|
||||
dist->indexes = malloc(nbobjs * sizeof(*dist->indexes));
|
||||
if (!dist->indexes)
|
||||
goto err_with_dist;
|
||||
if (dist->type == HWLOC_OBJ_PU || dist->type == HWLOC_OBJ_NUMANODE) {
|
||||
if (HWLOC_DIST_TYPE_USE_OS_INDEX(dist->unique_type)) {
|
||||
for(i=0; i<nbobjs; i++)
|
||||
dist->indexes[i] = objs[i]->os_index;
|
||||
} else {
|
||||
|
@ -254,18 +323,23 @@ hwloc_internal_distances__add(hwloc_topology_t topology,
|
|||
return 0;
|
||||
|
||||
err_with_dist:
|
||||
if (name)
|
||||
free(dist->name);
|
||||
free(dist);
|
||||
err:
|
||||
free(different_types);
|
||||
free(objs);
|
||||
free(indexes);
|
||||
free(values);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int hwloc_internal_distances_add_by_index(hwloc_topology_t topology,
|
||||
hwloc_obj_type_t type, unsigned nbobjs, uint64_t *indexes, uint64_t *values,
|
||||
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)
|
||||
{
|
||||
unsigned iflags = 0; /* objs not valid */
|
||||
|
||||
if (nbobjs < 2) {
|
||||
errno = EINVAL;
|
||||
goto err;
|
||||
|
@ -279,24 +353,71 @@ int hwloc_internal_distances_add_by_index(hwloc_topology_t topology,
|
|||
goto err;
|
||||
}
|
||||
|
||||
return hwloc_internal_distances__add(topology, type, nbobjs, NULL, indexes, values, kind);
|
||||
return hwloc_internal_distances__add(topology, name, unique_type, different_types, nbobjs, NULL, indexes, values, kind, iflags);
|
||||
|
||||
err:
|
||||
free(indexes);
|
||||
free(values);
|
||||
free(different_types);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int hwloc_internal_distances_add(hwloc_topology_t topology,
|
||||
static void
|
||||
hwloc_internal_distances_restrict(hwloc_obj_t *objs,
|
||||
uint64_t *indexes,
|
||||
uint64_t *values,
|
||||
unsigned nbobjs, unsigned disappeared);
|
||||
|
||||
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)
|
||||
{
|
||||
hwloc_obj_type_t unique_type, *different_types;
|
||||
unsigned i, disappeared = 0;
|
||||
unsigned iflags = HWLOC_INTERNAL_DIST_FLAG_OBJS_VALID;
|
||||
|
||||
if (nbobjs < 2) {
|
||||
errno = EINVAL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (topology->grouping && (flags & HWLOC_DISTANCES_ADD_FLAG_GROUP)) {
|
||||
/* is there any NULL object? (useful in case of problem during insert in backends) */
|
||||
for(i=0; i<nbobjs; i++)
|
||||
if (!objs[i])
|
||||
disappeared++;
|
||||
if (disappeared) {
|
||||
/* some objects are NULL */
|
||||
if (disappeared == nbobjs) {
|
||||
/* nothing left, drop the matrix */
|
||||
free(objs);
|
||||
free(values);
|
||||
return 0;
|
||||
}
|
||||
/* restrict the matrix */
|
||||
hwloc_internal_distances_restrict(objs, NULL, values, nbobjs, disappeared);
|
||||
nbobjs -= disappeared;
|
||||
}
|
||||
|
||||
unique_type = objs[0]->type;
|
||||
for(i=1; i<nbobjs; i++)
|
||||
if (objs[i]->type != unique_type) {
|
||||
unique_type = HWLOC_OBJ_TYPE_NONE;
|
||||
break;
|
||||
}
|
||||
if (unique_type == HWLOC_OBJ_TYPE_NONE) {
|
||||
/* heterogeneous types */
|
||||
different_types = malloc(nbobjs * sizeof(*different_types));
|
||||
if (!different_types)
|
||||
goto err;
|
||||
for(i=0; i<nbobjs; i++)
|
||||
different_types[i] = objs[i]->type;
|
||||
|
||||
} else {
|
||||
/* homogeneous types */
|
||||
different_types = NULL;
|
||||
}
|
||||
|
||||
if (topology->grouping && (flags & HWLOC_DISTANCES_ADD_FLAG_GROUP) && !different_types) {
|
||||
float full_accuracy = 0.f;
|
||||
float *accuracies;
|
||||
unsigned nbaccuracies;
|
||||
|
@ -310,8 +431,8 @@ int hwloc_internal_distances_add(hwloc_topology_t topology,
|
|||
}
|
||||
|
||||
if (topology->grouping_verbose) {
|
||||
unsigned i, j;
|
||||
int gp = (objs[0]->type != HWLOC_OBJ_NUMANODE && objs[0]->type != HWLOC_OBJ_PU);
|
||||
unsigned j;
|
||||
int gp = !HWLOC_DIST_TYPE_USE_OS_INDEX(unique_type);
|
||||
fprintf(stderr, "Trying to group objects using distance matrix:\n");
|
||||
fprintf(stderr, "%s", gp ? "gp_index" : "os_index");
|
||||
for(j=0; j<nbobjs; j++)
|
||||
|
@ -329,7 +450,7 @@ int hwloc_internal_distances_add(hwloc_topology_t topology,
|
|||
kind, nbaccuracies, accuracies, 1 /* check the first matrice */);
|
||||
}
|
||||
|
||||
return hwloc_internal_distances__add(topology, objs[0]->type, nbobjs, objs, NULL, values, kind);
|
||||
return hwloc_internal_distances__add(topology, name, unique_type, different_types, nbobjs, objs, NULL, values, kind, iflags);
|
||||
|
||||
err:
|
||||
free(objs);
|
||||
|
@ -348,7 +469,6 @@ int hwloc_distances_add(hwloc_topology_t topology,
|
|||
unsigned nbobjs, hwloc_obj_t *objs, hwloc_uint64_t *values,
|
||||
unsigned long kind, unsigned long flags)
|
||||
{
|
||||
hwloc_obj_type_t type;
|
||||
unsigned i;
|
||||
uint64_t *_values;
|
||||
hwloc_obj_t *_objs;
|
||||
|
@ -358,6 +478,10 @@ int hwloc_distances_add(hwloc_topology_t topology,
|
|||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (topology->adopted_shmem_addr) {
|
||||
errno = EPERM;
|
||||
return -1;
|
||||
}
|
||||
if ((kind & ~HWLOC_DISTANCES_KIND_ALL)
|
||||
|| hwloc_weight_long(kind & HWLOC_DISTANCES_KIND_FROM_ALL) != 1
|
||||
|| hwloc_weight_long(kind & HWLOC_DISTANCES_KIND_MEANS_ALL) != 1
|
||||
|
@ -368,15 +492,8 @@ int hwloc_distances_add(hwloc_topology_t topology,
|
|||
|
||||
/* no strict need to check for duplicates, things shouldn't break */
|
||||
|
||||
type = objs[0]->type;
|
||||
if (type == HWLOC_OBJ_GROUP) {
|
||||
/* not supported yet, would require we save the subkind together with the type. */
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
for(i=1; i<nbobjs; i++)
|
||||
if (!objs[i] || objs[i]->type != type) {
|
||||
if (!objs[i]) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
@ -389,7 +506,7 @@ int hwloc_distances_add(hwloc_topology_t topology,
|
|||
|
||||
memcpy(_objs, objs, nbobjs*sizeof(hwloc_obj_t));
|
||||
memcpy(_values, values, nbobjs*nbobjs*sizeof(*_values));
|
||||
err = hwloc_internal_distances_add(topology, nbobjs, _objs, _values, kind, flags);
|
||||
err = hwloc_internal_distances_add(topology, NULL, nbobjs, _objs, _values, kind, flags);
|
||||
if (err < 0)
|
||||
goto out; /* _objs and _values freed in hwloc_internal_distances_add() */
|
||||
|
||||
|
@ -409,9 +526,9 @@ int hwloc_distances_add(hwloc_topology_t topology,
|
|||
* Refresh objects in distances
|
||||
*/
|
||||
|
||||
static hwloc_obj_t hwloc_find_obj_by_type_and_gp_index(hwloc_topology_t topology, hwloc_obj_type_t type, uint64_t gp_index)
|
||||
static hwloc_obj_t hwloc_find_obj_by_depth_and_gp_index(hwloc_topology_t topology, unsigned depth, uint64_t gp_index)
|
||||
{
|
||||
hwloc_obj_t obj = hwloc_get_obj_by_type(topology, type, 0);
|
||||
hwloc_obj_t obj = hwloc_get_obj_by_depth(topology, depth, 0);
|
||||
while (obj) {
|
||||
if (obj->gp_index == gp_index)
|
||||
return obj;
|
||||
|
@ -420,12 +537,31 @@ static hwloc_obj_t hwloc_find_obj_by_type_and_gp_index(hwloc_topology_t topology
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
hwloc_internal_distances_restrict(struct hwloc_internal_distances_s *dist,
|
||||
hwloc_obj_t *objs,
|
||||
unsigned disappeared)
|
||||
static hwloc_obj_t hwloc_find_obj_by_type_and_gp_index(hwloc_topology_t topology, hwloc_obj_type_t type, uint64_t gp_index)
|
||||
{
|
||||
int depth = hwloc_get_type_depth(topology, type);
|
||||
if (depth == HWLOC_TYPE_DEPTH_UNKNOWN)
|
||||
return NULL;
|
||||
if (depth == HWLOC_TYPE_DEPTH_MULTIPLE) {
|
||||
int topodepth = hwloc_topology_get_depth(topology);
|
||||
for(depth=0; depth<topodepth; depth++) {
|
||||
if (hwloc_get_depth_type(topology, depth) == type) {
|
||||
hwloc_obj_t obj = hwloc_find_obj_by_depth_and_gp_index(topology, depth, gp_index);
|
||||
if (obj)
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
return hwloc_find_obj_by_depth_and_gp_index(topology, depth, gp_index);
|
||||
}
|
||||
|
||||
static void
|
||||
hwloc_internal_distances_restrict(hwloc_obj_t *objs,
|
||||
uint64_t *indexes,
|
||||
uint64_t *values,
|
||||
unsigned nbobjs, unsigned disappeared)
|
||||
{
|
||||
unsigned nbobjs = dist->nbobjs;
|
||||
unsigned i, newi;
|
||||
unsigned j, newj;
|
||||
|
||||
|
@ -433,7 +569,7 @@ hwloc_internal_distances_restrict(struct hwloc_internal_distances_s *dist,
|
|||
if (objs[i]) {
|
||||
for(j=0, newj=0; j<nbobjs; j++)
|
||||
if (objs[j]) {
|
||||
dist->values[newi*(nbobjs-disappeared)+newj] = dist->values[i*nbobjs+j];
|
||||
values[newi*(nbobjs-disappeared)+newj] = values[i*nbobjs+j];
|
||||
newj++;
|
||||
}
|
||||
newi++;
|
||||
|
@ -442,25 +578,25 @@ hwloc_internal_distances_restrict(struct hwloc_internal_distances_s *dist,
|
|||
for(i=0, newi=0; i<nbobjs; i++)
|
||||
if (objs[i]) {
|
||||
objs[newi] = objs[i];
|
||||
dist->indexes[newi] = dist->indexes[i];
|
||||
if (indexes)
|
||||
indexes[newi] = indexes[i];
|
||||
newi++;
|
||||
}
|
||||
|
||||
dist->nbobjs -= disappeared;
|
||||
}
|
||||
|
||||
static int
|
||||
hwloc_internal_distances_refresh_one(hwloc_topology_t topology,
|
||||
struct hwloc_internal_distances_s *dist)
|
||||
{
|
||||
hwloc_obj_type_t type = dist->type;
|
||||
hwloc_obj_type_t unique_type = dist->unique_type;
|
||||
hwloc_obj_type_t *different_types = dist->different_types;
|
||||
unsigned nbobjs = dist->nbobjs;
|
||||
hwloc_obj_t *objs = dist->objs;
|
||||
uint64_t *indexes = dist->indexes;
|
||||
unsigned disappeared = 0;
|
||||
unsigned i;
|
||||
|
||||
if (dist->objs_are_valid)
|
||||
if (dist->iflags & HWLOC_INTERNAL_DIST_FLAG_OBJS_VALID)
|
||||
return 0;
|
||||
|
||||
for(i=0; i<nbobjs; i++) {
|
||||
|
@ -468,12 +604,16 @@ hwloc_internal_distances_refresh_one(hwloc_topology_t topology,
|
|||
/* TODO use cpuset/nodeset to find pus/numas from the root?
|
||||
* faster than traversing the entire level?
|
||||
*/
|
||||
if (type == HWLOC_OBJ_PU)
|
||||
obj = hwloc_get_pu_obj_by_os_index(topology, (unsigned) indexes[i]);
|
||||
else if (type == HWLOC_OBJ_NUMANODE)
|
||||
obj = hwloc_get_numanode_obj_by_os_index(topology, (unsigned) indexes[i]);
|
||||
else
|
||||
obj = hwloc_find_obj_by_type_and_gp_index(topology, type, indexes[i]);
|
||||
if (HWLOC_DIST_TYPE_USE_OS_INDEX(unique_type)) {
|
||||
if (unique_type == HWLOC_OBJ_PU)
|
||||
obj = hwloc_get_pu_obj_by_os_index(topology, (unsigned) indexes[i]);
|
||||
else if (unique_type == HWLOC_OBJ_NUMANODE)
|
||||
obj = hwloc_get_numanode_obj_by_os_index(topology, (unsigned) indexes[i]);
|
||||
else
|
||||
abort();
|
||||
} else {
|
||||
obj = hwloc_find_obj_by_type_and_gp_index(topology, different_types ? different_types[i] : unique_type, indexes[i]);
|
||||
}
|
||||
objs[i] = obj;
|
||||
if (!obj)
|
||||
disappeared++;
|
||||
|
@ -483,10 +623,12 @@ hwloc_internal_distances_refresh_one(hwloc_topology_t topology,
|
|||
/* became useless, drop */
|
||||
return -1;
|
||||
|
||||
if (disappeared)
|
||||
hwloc_internal_distances_restrict(dist, objs, disappeared);
|
||||
if (disappeared) {
|
||||
hwloc_internal_distances_restrict(objs, dist->indexes, dist->values, nbobjs, disappeared);
|
||||
dist->nbobjs -= disappeared;
|
||||
}
|
||||
|
||||
dist->objs_are_valid = 1;
|
||||
dist->iflags |= HWLOC_INTERNAL_DIST_FLAG_OBJS_VALID;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -520,32 +662,64 @@ hwloc_internal_distances_invalidate_cached_objs(hwloc_topology_t topology)
|
|||
{
|
||||
struct hwloc_internal_distances_s *dist;
|
||||
for(dist = topology->first_dist; dist; dist = dist->next)
|
||||
dist->objs_are_valid = 0;
|
||||
dist->iflags &= ~HWLOC_INTERNAL_DIST_FLAG_OBJS_VALID;
|
||||
}
|
||||
|
||||
/******************************************************
|
||||
* User API for getting distances
|
||||
*/
|
||||
|
||||
/* what we actually allocate for user queries, even if we only
|
||||
* return the distances part of it.
|
||||
*/
|
||||
struct hwloc_distances_container_s {
|
||||
unsigned id;
|
||||
struct hwloc_distances_s distances;
|
||||
};
|
||||
|
||||
#define HWLOC_DISTANCES_CONTAINER_OFFSET ((char*)&((struct hwloc_distances_container_s*)NULL)->distances - (char*)NULL)
|
||||
#define HWLOC_DISTANCES_CONTAINER(_d) (struct hwloc_distances_container_s *) ( ((char*)_d) - HWLOC_DISTANCES_CONTAINER_OFFSET )
|
||||
|
||||
static struct hwloc_internal_distances_s *
|
||||
hwloc__internal_distances_from_public(hwloc_topology_t topology, struct hwloc_distances_s *distances)
|
||||
{
|
||||
struct hwloc_distances_container_s *cont = HWLOC_DISTANCES_CONTAINER(distances);
|
||||
struct hwloc_internal_distances_s *dist;
|
||||
for(dist = topology->first_dist; dist; dist = dist->next)
|
||||
if (dist->id == cont->id)
|
||||
return dist;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
hwloc_distances_release(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||
struct hwloc_distances_s *distances)
|
||||
{
|
||||
struct hwloc_distances_container_s *cont = HWLOC_DISTANCES_CONTAINER(distances);
|
||||
free(distances->values);
|
||||
free(distances->objs);
|
||||
free(distances);
|
||||
free(cont);
|
||||
}
|
||||
|
||||
const char *
|
||||
hwloc_distances_get_name(hwloc_topology_t topology, struct hwloc_distances_s *distances)
|
||||
{
|
||||
struct hwloc_internal_distances_s *dist = hwloc__internal_distances_from_public(topology, distances);
|
||||
return dist ? dist->name : NULL;
|
||||
}
|
||||
|
||||
static struct hwloc_distances_s *
|
||||
hwloc_distances_get_one(hwloc_topology_t topology __hwloc_attribute_unused,
|
||||
struct hwloc_internal_distances_s *dist)
|
||||
{
|
||||
struct hwloc_distances_container_s *cont;
|
||||
struct hwloc_distances_s *distances;
|
||||
unsigned nbobjs;
|
||||
|
||||
distances = malloc(sizeof(*distances));
|
||||
if (!distances)
|
||||
cont = malloc(sizeof(*cont));
|
||||
if (!cont)
|
||||
return NULL;
|
||||
distances = &cont->distances;
|
||||
|
||||
nbobjs = distances->nbobjs = dist->nbobjs;
|
||||
|
||||
|
@ -560,18 +734,20 @@ hwloc_distances_get_one(hwloc_topology_t topology __hwloc_attribute_unused,
|
|||
memcpy(distances->values, dist->values, nbobjs*nbobjs*sizeof(*distances->values));
|
||||
|
||||
distances->kind = dist->kind;
|
||||
|
||||
cont->id = dist->id;
|
||||
return distances;
|
||||
|
||||
out_with_objs:
|
||||
free(distances->objs);
|
||||
out:
|
||||
free(distances);
|
||||
free(cont);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
hwloc__distances_get(hwloc_topology_t topology,
|
||||
hwloc_obj_type_t type,
|
||||
const char *name, hwloc_obj_type_t type,
|
||||
unsigned *nrp, struct hwloc_distances_s **distancesp,
|
||||
unsigned long kind, unsigned long flags __hwloc_attribute_unused)
|
||||
{
|
||||
|
@ -602,7 +778,10 @@ hwloc__distances_get(hwloc_topology_t topology,
|
|||
unsigned long kind_from = kind & HWLOC_DISTANCES_KIND_FROM_ALL;
|
||||
unsigned long kind_means = kind & HWLOC_DISTANCES_KIND_MEANS_ALL;
|
||||
|
||||
if (type != HWLOC_OBJ_TYPE_NONE && type != dist->type)
|
||||
if (name && (!dist->name || strcmp(name, dist->name)))
|
||||
continue;
|
||||
|
||||
if (type != HWLOC_OBJ_TYPE_NONE && type != dist->unique_type)
|
||||
continue;
|
||||
|
||||
if (kind_from && !(kind_from & dist->kind))
|
||||
|
@ -640,7 +819,7 @@ hwloc_distances_get(hwloc_topology_t topology,
|
|||
return -1;
|
||||
}
|
||||
|
||||
return hwloc__distances_get(topology, HWLOC_OBJ_TYPE_NONE, nrp, distancesp, kind, flags);
|
||||
return hwloc__distances_get(topology, NULL, HWLOC_OBJ_TYPE_NONE, nrp, distancesp, kind, flags);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -655,14 +834,40 @@ hwloc_distances_get_by_depth(hwloc_topology_t topology, int depth,
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* switch back to types since we don't support groups for now */
|
||||
/* FIXME: passing the depth of a group level may return group distances at a different depth */
|
||||
type = hwloc_get_depth_type(topology, depth);
|
||||
if (type == (hwloc_obj_type_t)-1) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return hwloc__distances_get(topology, type, nrp, distancesp, kind, flags);
|
||||
return hwloc__distances_get(topology, NULL, type, nrp, distancesp, kind, flags);
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_distances_get_by_name(hwloc_topology_t topology, const char *name,
|
||||
unsigned *nrp, struct hwloc_distances_s **distancesp,
|
||||
unsigned long flags)
|
||||
{
|
||||
if (flags || !topology->is_loaded) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return hwloc__distances_get(topology, name, HWLOC_OBJ_TYPE_NONE, nrp, distancesp, HWLOC_DISTANCES_KIND_ALL, flags);
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_distances_get_by_type(hwloc_topology_t topology, hwloc_obj_type_t type,
|
||||
unsigned *nrp, struct hwloc_distances_s **distancesp,
|
||||
unsigned long kind, unsigned long flags)
|
||||
{
|
||||
if (flags || !topology->is_loaded) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return hwloc__distances_get(topology, NULL, type, nrp, distancesp, kind, flags);
|
||||
}
|
||||
|
||||
/******************************************************
|
||||
|
@ -823,10 +1028,14 @@ hwloc__groups_by_distances(struct hwloc_topology *topology,
|
|||
float *accuracies,
|
||||
int needcheck)
|
||||
{
|
||||
HWLOC_VLA(unsigned, groupids, nbobjs);
|
||||
unsigned *groupids;
|
||||
unsigned nbgroups = 0;
|
||||
unsigned i,j;
|
||||
int verbose = topology->grouping_verbose;
|
||||
hwloc_obj_t *groupobjs;
|
||||
unsigned * groupsizes;
|
||||
uint64_t *groupvalues;
|
||||
unsigned failed = 0;
|
||||
|
||||
if (nbobjs <= 2)
|
||||
return;
|
||||
|
@ -836,6 +1045,10 @@ hwloc__groups_by_distances(struct hwloc_topology *topology,
|
|||
/* TODO hwloc__find_groups_by_max_distance() for bandwidth */
|
||||
return;
|
||||
|
||||
groupids = malloc(nbobjs * sizeof(*groupids));
|
||||
if (!groupids)
|
||||
return;
|
||||
|
||||
for(i=0; i<nbaccuracies; i++) {
|
||||
if (verbose)
|
||||
fprintf(stderr, "Trying to group %u %s objects according to physical distances with accuracy %f\n",
|
||||
|
@ -847,13 +1060,13 @@ hwloc__groups_by_distances(struct hwloc_topology *topology,
|
|||
break;
|
||||
}
|
||||
if (!nbgroups)
|
||||
return;
|
||||
goto out_with_groupids;
|
||||
|
||||
{
|
||||
HWLOC_VLA(hwloc_obj_t, groupobjs, nbgroups);
|
||||
HWLOC_VLA(unsigned, groupsizes, nbgroups);
|
||||
HWLOC_VLA(uint64_t, groupvalues, nbgroups*nbgroups);
|
||||
unsigned failed = 0;
|
||||
groupobjs = malloc(nbgroups * sizeof(*groupobjs));
|
||||
groupsizes = malloc(nbgroups * sizeof(*groupsizes));
|
||||
groupvalues = malloc(nbgroups * nbgroups * sizeof(*groupvalues));
|
||||
if (!groupobjs || !groupsizes || !groupvalues)
|
||||
goto out_with_groups;
|
||||
|
||||
/* create new Group objects and record their size */
|
||||
memset(&(groupsizes[0]), 0, sizeof(groupsizes[0]) * nbgroups);
|
||||
|
@ -884,7 +1097,7 @@ hwloc__groups_by_distances(struct hwloc_topology *topology,
|
|||
|
||||
if (failed)
|
||||
/* don't try to group above if we got a NULL group here, just keep this incomplete level */
|
||||
return;
|
||||
goto out_with_groups;
|
||||
|
||||
/* factorize values */
|
||||
memset(&(groupvalues[0]), 0, sizeof(groupvalues[0]) * nbgroups * nbgroups);
|
||||
|
@ -916,5 +1129,11 @@ hwloc__groups_by_distances(struct hwloc_topology *topology,
|
|||
#endif
|
||||
|
||||
hwloc__groups_by_distances(topology, nbgroups, groupobjs, groupvalues, kind, nbaccuracies, accuracies, 0 /* no need to check generated matrix */);
|
||||
}
|
||||
|
||||
out_with_groups:
|
||||
free(groupobjs);
|
||||
free(groupsizes);
|
||||
free(groupvalues);
|
||||
out_with_groupids:
|
||||
free(groupids);
|
||||
}
|
||||
|
|
25
src/3rdparty/hwloc/src/misc.c
vendored
25
src/3rdparty/hwloc/src/misc.c
vendored
|
@ -1,14 +1,14 @@
|
|||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2015 Inria. All rights reserved.
|
||||
* 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 "private/autogen/config.h"
|
||||
#include "private/private.h"
|
||||
#include "private/misc.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#ifdef HAVE_SYS_UTSNAME_H
|
||||
|
@ -28,6 +28,7 @@ extern char *program_invocation_name;
|
|||
extern char *__progname;
|
||||
#endif
|
||||
|
||||
#ifndef HWLOC_HAVE_CORRECT_SNPRINTF
|
||||
int hwloc_snprintf(char *str, size_t size, const char *format, ...)
|
||||
{
|
||||
int ret;
|
||||
|
@ -77,21 +78,7 @@ int hwloc_snprintf(char *str, size_t size, const char *format, ...)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int hwloc_namecoloncmp(const char *haystack, const char *needle, size_t n)
|
||||
{
|
||||
size_t i = 0;
|
||||
while (*haystack && *haystack != ':') {
|
||||
int ha = *haystack++;
|
||||
int low_h = tolower(ha);
|
||||
int ne = *needle++;
|
||||
int low_n = tolower(ne);
|
||||
if (low_h != low_n)
|
||||
return 1;
|
||||
i++;
|
||||
}
|
||||
return i < n;
|
||||
}
|
||||
#endif
|
||||
|
||||
void hwloc_add_uname_info(struct hwloc_topology *topology __hwloc_attribute_unused,
|
||||
void *cached_uname __hwloc_attribute_unused)
|
||||
|
|
401
src/3rdparty/hwloc/src/pci-common.c
vendored
401
src/3rdparty/hwloc/src/pci-common.c
vendored
|
@ -1,14 +1,14 @@
|
|||
/*
|
||||
* Copyright © 2009-2018 Inria. All rights reserved.
|
||||
* Copyright © 2009-2020 Inria. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
#include <private/autogen/config.h>
|
||||
#include <hwloc.h>
|
||||
#include <hwloc/plugins.h>
|
||||
#include <private/private.h>
|
||||
#include <private/debug.h>
|
||||
#include <private/misc.h>
|
||||
#include "private/autogen/config.h"
|
||||
#include "hwloc.h"
|
||||
#include "hwloc/plugins.h"
|
||||
#include "private/private.h"
|
||||
#include "private/debug.h"
|
||||
#include "private/misc.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
|
@ -23,6 +23,11 @@
|
|||
#define close _close
|
||||
#endif
|
||||
|
||||
|
||||
/**************************************
|
||||
* Init/Exit and Forced PCI localities
|
||||
*/
|
||||
|
||||
static void
|
||||
hwloc_pci_forced_locality_parse_one(struct hwloc_topology *topology,
|
||||
const char *string /* must contain a ' ' */,
|
||||
|
@ -109,11 +114,11 @@ hwloc_pci_forced_locality_parse(struct hwloc_topology *topology, const char *_en
|
|||
void
|
||||
hwloc_pci_discovery_init(struct hwloc_topology *topology)
|
||||
{
|
||||
topology->need_pci_belowroot_apply_locality = 0;
|
||||
|
||||
topology->pci_has_forced_locality = 0;
|
||||
topology->pci_forced_locality_nr = 0;
|
||||
topology->pci_forced_locality = NULL;
|
||||
|
||||
topology->first_pci_locality = topology->last_pci_locality = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -135,7 +140,7 @@ hwloc_pci_discovery_prepare(struct hwloc_topology *topology)
|
|||
if (!err) {
|
||||
if (st.st_size <= 64*1024) { /* random limit large enough to store multiple cpusets for thousands of PUs */
|
||||
buffer = malloc(st.st_size+1);
|
||||
if (read(fd, buffer, st.st_size) == st.st_size) {
|
||||
if (buffer && read(fd, buffer, st.st_size) == st.st_size) {
|
||||
buffer[st.st_size] = '\0';
|
||||
hwloc_pci_forced_locality_parse(topology, buffer);
|
||||
}
|
||||
|
@ -152,16 +157,31 @@ hwloc_pci_discovery_prepare(struct hwloc_topology *topology)
|
|||
}
|
||||
|
||||
void
|
||||
hwloc_pci_discovery_exit(struct hwloc_topology *topology __hwloc_attribute_unused)
|
||||
hwloc_pci_discovery_exit(struct hwloc_topology *topology)
|
||||
{
|
||||
struct hwloc_pci_locality_s *cur;
|
||||
unsigned i;
|
||||
|
||||
for(i=0; i<topology->pci_forced_locality_nr; i++)
|
||||
hwloc_bitmap_free(topology->pci_forced_locality[i].cpuset);
|
||||
free(topology->pci_forced_locality);
|
||||
|
||||
cur = topology->first_pci_locality;
|
||||
while (cur) {
|
||||
struct hwloc_pci_locality_s *next = cur->next;
|
||||
hwloc_bitmap_free(cur->cpuset);
|
||||
free(cur);
|
||||
cur = next;
|
||||
}
|
||||
|
||||
hwloc_pci_discovery_init(topology);
|
||||
}
|
||||
|
||||
|
||||
/******************************
|
||||
* Inserting in Tree by Bus ID
|
||||
*/
|
||||
|
||||
#ifdef HWLOC_DEBUG
|
||||
static void
|
||||
hwloc_pci_traverse_print_cb(void * cbdata __hwloc_attribute_unused,
|
||||
|
@ -324,32 +344,16 @@ hwloc_pcidisc_tree_insert_by_busid(struct hwloc_obj **treep,
|
|||
hwloc_pci_add_object(NULL /* no parent on top of tree */, treep, obj);
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_pcidisc_tree_attach(struct hwloc_topology *topology, struct hwloc_obj *old_tree)
|
||||
|
||||
/**********************
|
||||
* Attaching PCI Trees
|
||||
*/
|
||||
|
||||
static struct hwloc_obj *
|
||||
hwloc_pcidisc_add_hostbridges(struct hwloc_topology *topology,
|
||||
struct hwloc_obj *old_tree)
|
||||
{
|
||||
struct hwloc_obj **next_hb_p;
|
||||
enum hwloc_type_filter_e bfilter;
|
||||
|
||||
if (!old_tree)
|
||||
/* found nothing, exit */
|
||||
return 0;
|
||||
|
||||
#ifdef HWLOC_DEBUG
|
||||
hwloc_debug("%s", "\nPCI hierarchy:\n");
|
||||
hwloc_pci_traverse(NULL, old_tree, hwloc_pci_traverse_print_cb);
|
||||
hwloc_debug("%s", "\n");
|
||||
#endif
|
||||
|
||||
next_hb_p = &hwloc_get_root_obj(topology)->io_first_child;
|
||||
while (*next_hb_p)
|
||||
next_hb_p = &((*next_hb_p)->next_sibling);
|
||||
|
||||
bfilter = topology->type_filter[HWLOC_OBJ_BRIDGE];
|
||||
if (bfilter == HWLOC_TYPE_FILTER_KEEP_NONE) {
|
||||
*next_hb_p = old_tree;
|
||||
topology->modified = 1;
|
||||
goto done;
|
||||
}
|
||||
struct hwloc_obj * new = NULL, **newp = &new;
|
||||
|
||||
/*
|
||||
* tree points to all objects connected to any upstream bus in the machine.
|
||||
|
@ -358,15 +362,29 @@ hwloc_pcidisc_tree_attach(struct hwloc_topology *topology, struct hwloc_obj *old
|
|||
*/
|
||||
while (old_tree) {
|
||||
/* start a new host bridge */
|
||||
struct hwloc_obj *hostbridge = hwloc_alloc_setup_object(topology, HWLOC_OBJ_BRIDGE, HWLOC_UNKNOWN_INDEX);
|
||||
struct hwloc_obj **dstnextp = &hostbridge->io_first_child;
|
||||
struct hwloc_obj **srcnextp = &old_tree;
|
||||
struct hwloc_obj *child = *srcnextp;
|
||||
unsigned short current_domain = child->attr->pcidev.domain;
|
||||
unsigned char current_bus = child->attr->pcidev.bus;
|
||||
unsigned char current_subordinate = current_bus;
|
||||
struct hwloc_obj *hostbridge;
|
||||
struct hwloc_obj **dstnextp;
|
||||
struct hwloc_obj **srcnextp;
|
||||
struct hwloc_obj *child;
|
||||
unsigned current_domain;
|
||||
unsigned char current_bus;
|
||||
unsigned char current_subordinate;
|
||||
|
||||
hwloc_debug("Starting new PCI hostbridge %04x:%02x\n", current_domain, current_bus);
|
||||
hostbridge = hwloc_alloc_setup_object(topology, HWLOC_OBJ_BRIDGE, HWLOC_UNKNOWN_INDEX);
|
||||
if (!hostbridge) {
|
||||
/* just queue remaining things without hostbridges and return */
|
||||
*newp = old_tree;
|
||||
return new;
|
||||
}
|
||||
dstnextp = &hostbridge->io_first_child;
|
||||
|
||||
srcnextp = &old_tree;
|
||||
child = *srcnextp;
|
||||
current_domain = child->attr->pcidev.domain;
|
||||
current_bus = child->attr->pcidev.bus;
|
||||
current_subordinate = current_bus;
|
||||
|
||||
hwloc_debug("Adding new PCI hostbridge %04x:%02x\n", current_domain, current_bus);
|
||||
|
||||
next_child:
|
||||
/* remove next child from tree */
|
||||
|
@ -395,19 +413,14 @@ hwloc_pcidisc_tree_attach(struct hwloc_topology *topology, struct hwloc_obj *old
|
|||
hostbridge->attr->bridge.downstream.pci.domain = current_domain;
|
||||
hostbridge->attr->bridge.downstream.pci.secondary_bus = current_bus;
|
||||
hostbridge->attr->bridge.downstream.pci.subordinate_bus = current_subordinate;
|
||||
hwloc_debug("New PCI hostbridge %04x:[%02x-%02x]\n",
|
||||
hwloc_debug(" new PCI hostbridge covers %04x:[%02x-%02x]\n",
|
||||
current_domain, current_bus, current_subordinate);
|
||||
|
||||
*next_hb_p = hostbridge;
|
||||
next_hb_p = &hostbridge->next_sibling;
|
||||
topology->modified = 1; /* needed in case somebody reconnects levels before the core calls hwloc_pci_belowroot_apply_locality()
|
||||
* or if hwloc_pci_belowroot_apply_locality() keeps hostbridges below root.
|
||||
*/
|
||||
*newp = hostbridge;
|
||||
newp = &hostbridge->next_sibling;
|
||||
}
|
||||
|
||||
done:
|
||||
topology->need_pci_belowroot_apply_locality = 1;
|
||||
return 0;
|
||||
return new;
|
||||
}
|
||||
|
||||
static struct hwloc_obj *
|
||||
|
@ -458,6 +471,9 @@ hwloc__pci_find_busid_parent(struct hwloc_topology *topology, struct hwloc_pcide
|
|||
unsigned i;
|
||||
int err;
|
||||
|
||||
hwloc_debug("Looking for parent of PCI busid %04x:%02x:%02x.%01x\n",
|
||||
busid->domain, busid->bus, busid->dev, busid->func);
|
||||
|
||||
/* try to match a forced locality */
|
||||
if (topology->pci_has_forced_locality) {
|
||||
for(i=0; i<topology->pci_forced_locality_nr; i++) {
|
||||
|
@ -489,7 +505,7 @@ hwloc__pci_find_busid_parent(struct hwloc_topology *topology, struct hwloc_pcide
|
|||
}
|
||||
if (*env) {
|
||||
/* force the cpuset */
|
||||
hwloc_debug("Overriding localcpus using %s in the environment\n", envname);
|
||||
hwloc_debug("Overriding PCI locality using %s in the environment\n", envname);
|
||||
hwloc_bitmap_sscanf(cpuset, env);
|
||||
forced = 1;
|
||||
}
|
||||
|
@ -499,7 +515,7 @@ hwloc__pci_find_busid_parent(struct hwloc_topology *topology, struct hwloc_pcide
|
|||
}
|
||||
|
||||
if (!forced) {
|
||||
/* get the cpuset by asking the OS backend. */
|
||||
/* get the cpuset by asking the backend that provides the relevant hook, if any. */
|
||||
struct hwloc_backend *backend = topology->get_pci_busid_cpuset_backend;
|
||||
if (backend)
|
||||
err = backend->get_pci_busid_cpuset(backend, busid, cpuset);
|
||||
|
@ -510,7 +526,7 @@ hwloc__pci_find_busid_parent(struct hwloc_topology *topology, struct hwloc_pcide
|
|||
hwloc_bitmap_copy(cpuset, hwloc_topology_get_topology_cpuset(topology));
|
||||
}
|
||||
|
||||
hwloc_debug_bitmap("Attaching PCI tree to cpuset %s\n", cpuset);
|
||||
hwloc_debug_bitmap(" will attach PCI bus to cpuset %s\n", cpuset);
|
||||
|
||||
parent = hwloc_find_insert_io_parent_by_complete_cpuset(topology, cpuset);
|
||||
if (parent) {
|
||||
|
@ -526,11 +542,129 @@ hwloc__pci_find_busid_parent(struct hwloc_topology *topology, struct hwloc_pcide
|
|||
return parent;
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_pcidisc_tree_attach(struct hwloc_topology *topology, struct hwloc_obj *tree)
|
||||
{
|
||||
enum hwloc_type_filter_e bfilter;
|
||||
|
||||
if (!tree)
|
||||
/* found nothing, exit */
|
||||
return 0;
|
||||
|
||||
#ifdef HWLOC_DEBUG
|
||||
hwloc_debug("%s", "\nPCI hierarchy:\n");
|
||||
hwloc_pci_traverse(NULL, tree, hwloc_pci_traverse_print_cb);
|
||||
hwloc_debug("%s", "\n");
|
||||
#endif
|
||||
|
||||
bfilter = topology->type_filter[HWLOC_OBJ_BRIDGE];
|
||||
if (bfilter != HWLOC_TYPE_FILTER_KEEP_NONE) {
|
||||
tree = hwloc_pcidisc_add_hostbridges(topology, tree);
|
||||
}
|
||||
|
||||
while (tree) {
|
||||
struct hwloc_obj *obj, *pciobj;
|
||||
struct hwloc_obj *parent;
|
||||
struct hwloc_pci_locality_s *loc;
|
||||
unsigned domain, bus_min, bus_max;
|
||||
|
||||
obj = tree;
|
||||
|
||||
/* hostbridges don't have a PCI busid for looking up locality, use their first child */
|
||||
if (obj->type == HWLOC_OBJ_BRIDGE && obj->attr->bridge.upstream_type == HWLOC_OBJ_BRIDGE_HOST)
|
||||
pciobj = obj->io_first_child;
|
||||
else
|
||||
pciobj = obj;
|
||||
/* now we have a pci device or a pci bridge */
|
||||
assert(pciobj->type == HWLOC_OBJ_PCI_DEVICE
|
||||
|| (pciobj->type == HWLOC_OBJ_BRIDGE && pciobj->attr->bridge.upstream_type == HWLOC_OBJ_BRIDGE_PCI));
|
||||
|
||||
if (obj->type == HWLOC_OBJ_BRIDGE) {
|
||||
domain = obj->attr->bridge.downstream.pci.domain;
|
||||
bus_min = obj->attr->bridge.downstream.pci.secondary_bus;
|
||||
bus_max = obj->attr->bridge.downstream.pci.subordinate_bus;
|
||||
} else {
|
||||
domain = pciobj->attr->pcidev.domain;
|
||||
bus_min = pciobj->attr->pcidev.bus;
|
||||
bus_max = pciobj->attr->pcidev.bus;
|
||||
}
|
||||
|
||||
/* find where to attach that PCI bus */
|
||||
parent = hwloc__pci_find_busid_parent(topology, &pciobj->attr->pcidev);
|
||||
|
||||
/* reuse the previous locality if possible */
|
||||
if (topology->last_pci_locality
|
||||
&& parent == topology->last_pci_locality->parent
|
||||
&& domain == topology->last_pci_locality->domain
|
||||
&& (bus_min == topology->last_pci_locality->bus_max
|
||||
|| bus_min == topology->last_pci_locality->bus_max+1)) {
|
||||
hwloc_debug(" Reusing PCI locality up to bus %04x:%02x\n",
|
||||
domain, bus_max);
|
||||
topology->last_pci_locality->bus_max = bus_max;
|
||||
goto done;
|
||||
}
|
||||
|
||||
loc = malloc(sizeof(*loc));
|
||||
if (!loc) {
|
||||
/* fallback to attaching to root */
|
||||
parent = hwloc_get_root_obj(topology);
|
||||
goto done;
|
||||
}
|
||||
|
||||
loc->domain = domain;
|
||||
loc->bus_min = bus_min;
|
||||
loc->bus_max = bus_max;
|
||||
loc->parent = parent;
|
||||
loc->cpuset = hwloc_bitmap_dup(parent->cpuset);
|
||||
if (!loc->cpuset) {
|
||||
/* fallback to attaching to root */
|
||||
free(loc);
|
||||
parent = hwloc_get_root_obj(topology);
|
||||
goto done;
|
||||
}
|
||||
|
||||
hwloc_debug("Adding PCI locality %s P#%u for bus %04x:[%02x:%02x]\n",
|
||||
hwloc_obj_type_string(parent->type), parent->os_index, loc->domain, loc->bus_min, loc->bus_max);
|
||||
if (topology->last_pci_locality) {
|
||||
loc->prev = topology->last_pci_locality;
|
||||
loc->next = NULL;
|
||||
topology->last_pci_locality->next = loc;
|
||||
topology->last_pci_locality = loc;
|
||||
} else {
|
||||
loc->prev = NULL;
|
||||
loc->next = NULL;
|
||||
topology->first_pci_locality = loc;
|
||||
topology->last_pci_locality = loc;
|
||||
}
|
||||
|
||||
done:
|
||||
/* dequeue this object */
|
||||
tree = obj->next_sibling;
|
||||
obj->next_sibling = NULL;
|
||||
hwloc_insert_object_by_parent(topology, parent, obj);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*********************************
|
||||
* Finding PCI objects or parents
|
||||
*/
|
||||
|
||||
struct hwloc_obj *
|
||||
hwloc_pcidisc_find_busid_parent(struct hwloc_topology *topology,
|
||||
unsigned domain, unsigned bus, unsigned dev, unsigned func)
|
||||
hwloc_pci_find_parent_by_busid(struct hwloc_topology *topology,
|
||||
unsigned domain, unsigned bus, unsigned dev, unsigned func)
|
||||
{
|
||||
struct hwloc_pcidev_attr_s busid;
|
||||
hwloc_obj_t parent;
|
||||
|
||||
/* try to find that exact busid */
|
||||
parent = hwloc_pci_find_by_busid(topology, domain, bus, dev, func);
|
||||
if (parent)
|
||||
return parent;
|
||||
|
||||
/* try to find the locality of that bus instead */
|
||||
busid.domain = domain;
|
||||
busid.bus = bus;
|
||||
busid.dev = dev;
|
||||
|
@ -538,66 +672,10 @@ hwloc_pcidisc_find_busid_parent(struct hwloc_topology *topology,
|
|||
return hwloc__pci_find_busid_parent(topology, &busid);
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_pci_belowroot_apply_locality(struct hwloc_topology *topology)
|
||||
{
|
||||
struct hwloc_obj *root = hwloc_get_root_obj(topology);
|
||||
struct hwloc_obj **listp, *obj;
|
||||
|
||||
if (!topology->need_pci_belowroot_apply_locality)
|
||||
return 0;
|
||||
topology->need_pci_belowroot_apply_locality = 0;
|
||||
|
||||
/* root->io_first_child contains some PCI hierarchies, any maybe some non-PCI things.
|
||||
* insert the PCI trees according to their PCI-locality.
|
||||
*/
|
||||
listp = &root->io_first_child;
|
||||
while ((obj = *listp) != NULL) {
|
||||
struct hwloc_pcidev_attr_s *busid;
|
||||
struct hwloc_obj *parent;
|
||||
|
||||
/* skip non-PCI objects */
|
||||
if (obj->type != HWLOC_OBJ_PCI_DEVICE
|
||||
&& !(obj->type == HWLOC_OBJ_BRIDGE && obj->attr->bridge.downstream_type == HWLOC_OBJ_BRIDGE_PCI)
|
||||
&& !(obj->type == HWLOC_OBJ_BRIDGE && obj->attr->bridge.upstream_type == HWLOC_OBJ_BRIDGE_PCI)) {
|
||||
listp = &obj->next_sibling;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (obj->type == HWLOC_OBJ_PCI_DEVICE
|
||||
|| (obj->type == HWLOC_OBJ_BRIDGE
|
||||
&& obj->attr->bridge.upstream_type == HWLOC_OBJ_BRIDGE_PCI))
|
||||
busid = &obj->attr->pcidev;
|
||||
else {
|
||||
/* hostbridges don't have a PCI busid for looking up locality, use their first child if PCI */
|
||||
hwloc_obj_t child = obj->io_first_child;
|
||||
if (child && (child->type == HWLOC_OBJ_PCI_DEVICE
|
||||
|| (child->type == HWLOC_OBJ_BRIDGE
|
||||
&& child->attr->bridge.upstream_type == HWLOC_OBJ_BRIDGE_PCI)))
|
||||
busid = &obj->io_first_child->attr->pcidev;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
/* attach the object (and children) where it belongs */
|
||||
parent = hwloc__pci_find_busid_parent(topology, busid);
|
||||
if (parent == root) {
|
||||
/* keep this object here */
|
||||
listp = &obj->next_sibling;
|
||||
} else {
|
||||
/* dequeue this object */
|
||||
*listp = obj->next_sibling;
|
||||
obj->next_sibling = NULL;
|
||||
hwloc_insert_object_by_parent(topology, parent, obj);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* return the smallest object that contains the desired busid */
|
||||
static struct hwloc_obj *
|
||||
hwloc__pci_belowroot_find_by_busid(hwloc_obj_t parent,
|
||||
unsigned domain, unsigned bus, unsigned dev, unsigned func)
|
||||
hwloc__pci_find_by_busid(hwloc_obj_t parent,
|
||||
unsigned domain, unsigned bus, unsigned dev, unsigned func)
|
||||
{
|
||||
hwloc_obj_t child;
|
||||
|
||||
|
@ -622,7 +700,7 @@ hwloc__pci_belowroot_find_by_busid(hwloc_obj_t parent,
|
|||
&& child->attr->bridge.downstream.pci.secondary_bus <= bus
|
||||
&& child->attr->bridge.downstream.pci.subordinate_bus >= bus)
|
||||
/* not the right bus id, but it's included in the bus below that bridge */
|
||||
return hwloc__pci_belowroot_find_by_busid(child, domain, bus, dev, func);
|
||||
return hwloc__pci_find_by_busid(child, domain, bus, dev, func);
|
||||
|
||||
} else if (child->type == HWLOC_OBJ_BRIDGE
|
||||
&& child->attr->bridge.upstream_type != HWLOC_OBJ_BRIDGE_PCI
|
||||
|
@ -632,7 +710,7 @@ hwloc__pci_belowroot_find_by_busid(hwloc_obj_t parent,
|
|||
&& child->attr->bridge.downstream.pci.secondary_bus <= bus
|
||||
&& child->attr->bridge.downstream.pci.subordinate_bus >= bus) {
|
||||
/* contains our bus, recurse */
|
||||
return hwloc__pci_belowroot_find_by_busid(child, domain, bus, dev, func);
|
||||
return hwloc__pci_find_by_busid(child, domain, bus, dev, func);
|
||||
}
|
||||
}
|
||||
/* didn't find anything, return parent */
|
||||
|
@ -640,17 +718,54 @@ hwloc__pci_belowroot_find_by_busid(hwloc_obj_t parent,
|
|||
}
|
||||
|
||||
struct hwloc_obj *
|
||||
hwloc_pcidisc_find_by_busid(struct hwloc_topology *topology,
|
||||
unsigned domain, unsigned bus, unsigned dev, unsigned func)
|
||||
hwloc_pci_find_by_busid(struct hwloc_topology *topology,
|
||||
unsigned domain, unsigned bus, unsigned dev, unsigned func)
|
||||
{
|
||||
struct hwloc_pci_locality_s *loc;
|
||||
hwloc_obj_t root = hwloc_get_root_obj(topology);
|
||||
hwloc_obj_t parent = hwloc__pci_belowroot_find_by_busid(root, domain, bus, dev, func);
|
||||
if (parent == root)
|
||||
hwloc_obj_t parent = NULL;
|
||||
|
||||
hwloc_debug("pcidisc looking for bus id %04x:%02x:%02x.%01x\n", domain, bus, dev, func);
|
||||
loc = topology->first_pci_locality;
|
||||
while (loc) {
|
||||
if (loc->domain == domain && loc->bus_min <= bus && loc->bus_max >= bus) {
|
||||
parent = loc->parent;
|
||||
assert(parent);
|
||||
hwloc_debug(" found pci locality for %04x:[%02x:%02x]\n",
|
||||
loc->domain, loc->bus_min, loc->bus_max);
|
||||
break;
|
||||
}
|
||||
loc = loc->next;
|
||||
}
|
||||
/* if we failed to insert localities, look at root too */
|
||||
if (!parent)
|
||||
parent = root;
|
||||
|
||||
hwloc_debug(" looking for bus %04x:%02x:%02x.%01x below %s P#%u\n",
|
||||
domain, bus, dev, func,
|
||||
hwloc_obj_type_string(parent->type), parent->os_index);
|
||||
parent = hwloc__pci_find_by_busid(parent, domain, bus, dev, func);
|
||||
if (parent == root) {
|
||||
hwloc_debug(" found nothing better than root object, ignoring\n");
|
||||
return NULL;
|
||||
else
|
||||
} else {
|
||||
if (parent->type == HWLOC_OBJ_PCI_DEVICE
|
||||
|| (parent->type == HWLOC_OBJ_BRIDGE && parent->attr->bridge.upstream_type == HWLOC_OBJ_BRIDGE_PCI))
|
||||
hwloc_debug(" found busid %04x:%02x:%02x.%01x\n",
|
||||
parent->attr->pcidev.domain, parent->attr->pcidev.bus,
|
||||
parent->attr->pcidev.dev, parent->attr->pcidev.func);
|
||||
else
|
||||
hwloc_debug(" found parent %s P#%u\n",
|
||||
hwloc_obj_type_string(parent->type), parent->os_index);
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************
|
||||
* Parsing the PCI Config Space
|
||||
*/
|
||||
|
||||
#define HWLOC_PCI_STATUS 0x06
|
||||
#define HWLOC_PCI_STATUS_CAP_LIST 0x10
|
||||
#define HWLOC_PCI_CAPABILITY_LIST 0x34
|
||||
|
@ -703,13 +818,14 @@ hwloc_pcidisc_find_linkspeed(const unsigned char *config,
|
|||
* PCIe Gen2 = 5 GT/s signal-rate per lane with 8/10 encoding = 0.5 GB/s data-rate per lane
|
||||
* PCIe Gen3 = 8 GT/s signal-rate per lane with 128/130 encoding = 1 GB/s data-rate per lane
|
||||
* PCIe Gen4 = 16 GT/s signal-rate per lane with 128/130 encoding = 2 GB/s data-rate per lane
|
||||
* PCIe Gen5 = 32 GT/s signal-rate per lane with 128/130 encoding = 4 GB/s data-rate per lane
|
||||
*/
|
||||
|
||||
/* lanespeed in Gbit/s */
|
||||
if (speed <= 2)
|
||||
lanespeed = 2.5f * speed * 0.8f;
|
||||
else
|
||||
lanespeed = 8.0f * (1<<(speed-3)) * 128/130; /* assume Gen5 will be 32 GT/s and so on */
|
||||
lanespeed = 8.0f * (1<<(speed-3)) * 128/130; /* assume Gen6 will be 64 GT/s and so on */
|
||||
|
||||
/* linkspeed in GB/s */
|
||||
*linkspeed = lanespeed * width / 8;
|
||||
|
@ -738,30 +854,27 @@ hwloc_pcidisc_check_bridge_type(unsigned device_class, const unsigned char *conf
|
|||
#define HWLOC_PCI_SUBORDINATE_BUS 0x1a
|
||||
|
||||
int
|
||||
hwloc_pcidisc_setup_bridge_attr(hwloc_obj_t obj,
|
||||
hwloc_pcidisc_find_bridge_buses(unsigned domain, unsigned bus, unsigned dev, unsigned func,
|
||||
unsigned *secondary_busp, unsigned *subordinate_busp,
|
||||
const unsigned char *config)
|
||||
{
|
||||
struct hwloc_bridge_attr_s *battr = &obj->attr->bridge;
|
||||
struct hwloc_pcidev_attr_s *pattr = &battr->upstream.pci;
|
||||
unsigned secondary_bus, subordinate_bus;
|
||||
|
||||
if (config[HWLOC_PCI_PRIMARY_BUS] != pattr->bus) {
|
||||
if (config[HWLOC_PCI_PRIMARY_BUS] != bus) {
|
||||
/* Sometimes the config space contains 00 instead of the actual primary bus number.
|
||||
* Always trust the bus ID because it was built by the system which has more information
|
||||
* to workaround such problems (e.g. ACPI information about PCI parent/children).
|
||||
*/
|
||||
hwloc_debug(" %04x:%02x:%02x.%01x bridge with (ignored) invalid PCI_PRIMARY_BUS %02x\n",
|
||||
pattr->domain, pattr->bus, pattr->dev, pattr->func, config[HWLOC_PCI_PRIMARY_BUS]);
|
||||
domain, bus, dev, func, config[HWLOC_PCI_PRIMARY_BUS]);
|
||||
}
|
||||
|
||||
battr->upstream_type = HWLOC_OBJ_BRIDGE_PCI;
|
||||
battr->downstream_type = HWLOC_OBJ_BRIDGE_PCI;
|
||||
battr->downstream.pci.domain = pattr->domain;
|
||||
battr->downstream.pci.secondary_bus = config[HWLOC_PCI_SECONDARY_BUS];
|
||||
battr->downstream.pci.subordinate_bus = config[HWLOC_PCI_SUBORDINATE_BUS];
|
||||
secondary_bus = config[HWLOC_PCI_SECONDARY_BUS];
|
||||
subordinate_bus = config[HWLOC_PCI_SUBORDINATE_BUS];
|
||||
|
||||
if (battr->downstream.pci.secondary_bus <= pattr->bus
|
||||
|| battr->downstream.pci.subordinate_bus <= pattr->bus
|
||||
|| battr->downstream.pci.secondary_bus > battr->downstream.pci.subordinate_bus) {
|
||||
if (secondary_bus <= bus
|
||||
|| subordinate_bus <= bus
|
||||
|| secondary_bus > subordinate_bus) {
|
||||
/* This should catch most cases of invalid bridge information
|
||||
* (e.g. 00 for secondary and subordinate).
|
||||
* Ideally we would also check that [secondary-subordinate] is included
|
||||
|
@ -769,15 +882,21 @@ hwloc_pcidisc_setup_bridge_attr(hwloc_obj_t obj,
|
|||
* because objects may be discovered out of order (especially in the fsroot case).
|
||||
*/
|
||||
hwloc_debug(" %04x:%02x:%02x.%01x bridge has invalid secondary-subordinate buses [%02x-%02x]\n",
|
||||
pattr->domain, pattr->bus, pattr->dev, pattr->func,
|
||||
battr->downstream.pci.secondary_bus, battr->downstream.pci.subordinate_bus);
|
||||
hwloc_free_unlinked_object(obj);
|
||||
domain, bus, dev, func,
|
||||
secondary_bus, subordinate_bus);
|
||||
return -1;
|
||||
}
|
||||
|
||||
*secondary_busp = secondary_bus;
|
||||
*subordinate_busp = subordinate_bus;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/****************
|
||||
* Class Strings
|
||||
*/
|
||||
|
||||
const char *
|
||||
hwloc_pci_class_string(unsigned short class_id)
|
||||
{
|
||||
|
|
17
src/3rdparty/hwloc/src/shmem.c
vendored
17
src/3rdparty/hwloc/src/shmem.c
vendored
|
@ -1,12 +1,12 @@
|
|||
/*
|
||||
* Copyright © 2017-2018 Inria. All rights reserved.
|
||||
* 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>
|
||||
#include "private/autogen/config.h"
|
||||
#include "hwloc.h"
|
||||
#include "hwloc/shmem.h"
|
||||
#include "private/private.h"
|
||||
|
||||
#ifndef HWLOC_WIN_SYS
|
||||
|
||||
|
@ -214,6 +214,8 @@ hwloc_shmem_topology_adopt(hwloc_topology_t *topologyp,
|
|||
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));
|
||||
|
@ -230,6 +232,11 @@ hwloc_shmem_topology_adopt(hwloc_topology_t *topologyp,
|
|||
*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:
|
||||
|
|
57
src/3rdparty/hwloc/src/topology-noos.c
vendored
57
src/3rdparty/hwloc/src/topology-noos.c
vendored
|
@ -1,45 +1,60 @@
|
|||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2017 Inria. All rights reserved.
|
||||
* Copyright © 2009-2012 Université Bordeaux
|
||||
* 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>
|
||||
#include "private/autogen/config.h"
|
||||
#include "hwloc.h"
|
||||
#include "private/private.h"
|
||||
|
||||
static int
|
||||
hwloc_look_noos(struct hwloc_backend *backend)
|
||||
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;
|
||||
int nbprocs;
|
||||
int64_t memsize;
|
||||
|
||||
if (topology->levels[0][0]->cpuset)
|
||||
/* somebody discovered things */
|
||||
return -1;
|
||||
assert(dstatus->phase == HWLOC_DISC_PHASE_CPU);
|
||||
|
||||
nbprocs = hwloc_fallback_nbprocessors(topology);
|
||||
if (nbprocs >= 1)
|
||||
topology->support.discovery->pu = 1;
|
||||
else
|
||||
nbprocs = 1;
|
||||
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_alloc_root_sets(topology->levels[0][0]);
|
||||
hwloc_setup_pu_level(topology, nbprocs);
|
||||
hwloc_add_uname_info(topology, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct hwloc_backend *
|
||||
hwloc_noos_component_instantiate(struct hwloc_disc_component *component,
|
||||
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(component);
|
||||
backend = hwloc_backend_alloc(topology, component);
|
||||
if (!backend)
|
||||
return NULL;
|
||||
backend->discover = hwloc_look_noos;
|
||||
|
@ -47,9 +62,9 @@ hwloc_noos_component_instantiate(struct hwloc_disc_component *component,
|
|||
}
|
||||
|
||||
static struct hwloc_disc_component hwloc_noos_disc_component = {
|
||||
HWLOC_DISC_COMPONENT_TYPE_CPU,
|
||||
"no_os",
|
||||
HWLOC_DISC_COMPONENT_TYPE_GLOBAL,
|
||||
HWLOC_DISC_PHASE_CPU,
|
||||
HWLOC_DISC_PHASE_GLOBAL,
|
||||
hwloc_noos_component_instantiate,
|
||||
40, /* lower than native OS component, higher than globals */
|
||||
1,
|
||||
|
|
85
src/3rdparty/hwloc/src/topology-synthetic.c
vendored
85
src/3rdparty/hwloc/src/topology-synthetic.c
vendored
|
@ -6,11 +6,11 @@
|
|||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
#include <private/autogen/config.h>
|
||||
#include <hwloc.h>
|
||||
#include <private/private.h>
|
||||
#include <private/misc.h>
|
||||
#include <private/debug.h>
|
||||
#include "private/autogen/config.h"
|
||||
#include "hwloc.h"
|
||||
#include "private/private.h"
|
||||
#include "private/misc.h"
|
||||
#include "private/debug.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <assert.h>
|
||||
|
@ -122,6 +122,7 @@ hwloc_synthetic_process_indexes(struct hwloc_synthetic_backend_data_s *data,
|
|||
unsigned long nbs = 1;
|
||||
unsigned j, mul;
|
||||
const char *tmp;
|
||||
struct hwloc_synthetic_intlv_loop_s *loops;
|
||||
|
||||
tmp = attr;
|
||||
while (tmp) {
|
||||
|
@ -132,9 +133,10 @@ hwloc_synthetic_process_indexes(struct hwloc_synthetic_backend_data_s *data,
|
|||
tmp++;
|
||||
}
|
||||
|
||||
{
|
||||
/* nr_loops colon-separated fields, but we may need one more at the end */
|
||||
HWLOC_VLA(struct hwloc_synthetic_intlv_loop_s, loops, nr_loops+1);
|
||||
loops = malloc((nr_loops+1) * sizeof(*loops));
|
||||
if (!loops)
|
||||
goto out_with_array;
|
||||
|
||||
if (*attr >= '0' && *attr <= '9') {
|
||||
/* interleaving as x*y:z*t:... */
|
||||
|
@ -148,11 +150,13 @@ hwloc_synthetic_process_indexes(struct hwloc_synthetic_backend_data_s *data,
|
|||
if (tmp2 == tmp || *tmp2 != '*') {
|
||||
if (verbose)
|
||||
fprintf(stderr, "Failed to read synthetic index interleaving loop '%s' without number before '*'\n", tmp);
|
||||
free(loops);
|
||||
goto out_with_array;
|
||||
}
|
||||
if (!step) {
|
||||
if (verbose)
|
||||
fprintf(stderr, "Invalid interleaving loop with step 0 at '%s'\n", tmp);
|
||||
free(loops);
|
||||
goto out_with_array;
|
||||
}
|
||||
tmp2++;
|
||||
|
@ -160,11 +164,13 @@ hwloc_synthetic_process_indexes(struct hwloc_synthetic_backend_data_s *data,
|
|||
if (tmp3 == tmp2 || (*tmp3 && *tmp3 != ':' && *tmp3 != ')' && *tmp3 != ' ')) {
|
||||
if (verbose)
|
||||
fprintf(stderr, "Failed to read synthetic index interleaving loop '%s' without number between '*' and ':'\n", tmp);
|
||||
free(loops);
|
||||
goto out_with_array;
|
||||
}
|
||||
if (!nb) {
|
||||
if (verbose)
|
||||
fprintf(stderr, "Invalid interleaving loop with number 0 at '%s'\n", tmp2);
|
||||
free(loops);
|
||||
goto out_with_array;
|
||||
}
|
||||
loops[cur_loop].step = step;
|
||||
|
@ -192,11 +198,13 @@ hwloc_synthetic_process_indexes(struct hwloc_synthetic_backend_data_s *data,
|
|||
if (err < 0) {
|
||||
if (verbose)
|
||||
fprintf(stderr, "Failed to read synthetic index interleaving loop type '%s'\n", tmp);
|
||||
free(loops);
|
||||
goto out_with_array;
|
||||
}
|
||||
if (type == HWLOC_OBJ_MISC || type == HWLOC_OBJ_BRIDGE || type == HWLOC_OBJ_PCI_DEVICE || type == HWLOC_OBJ_OS_DEVICE) {
|
||||
if (verbose)
|
||||
fprintf(stderr, "Misc object type disallowed in synthetic index interleaving loop type '%s'\n", tmp);
|
||||
free(loops);
|
||||
goto out_with_array;
|
||||
}
|
||||
for(i=0; ; i++) {
|
||||
|
@ -217,6 +225,7 @@ hwloc_synthetic_process_indexes(struct hwloc_synthetic_backend_data_s *data,
|
|||
if (verbose)
|
||||
fprintf(stderr, "Failed to find level for synthetic index interleaving loop type '%s'\n",
|
||||
tmp);
|
||||
free(loops);
|
||||
goto out_with_array;
|
||||
}
|
||||
tmp = strchr(tmp, ':');
|
||||
|
@ -235,6 +244,7 @@ hwloc_synthetic_process_indexes(struct hwloc_synthetic_backend_data_s *data,
|
|||
if (loops[i].level_depth == mydepth && i != cur_loop) {
|
||||
if (verbose)
|
||||
fprintf(stderr, "Invalid duplicate interleaving loop type in synthetic index '%s'\n", attr);
|
||||
free(loops);
|
||||
goto out_with_array;
|
||||
}
|
||||
if (loops[i].level_depth < mydepth
|
||||
|
@ -264,6 +274,7 @@ hwloc_synthetic_process_indexes(struct hwloc_synthetic_backend_data_s *data,
|
|||
} else {
|
||||
if (verbose)
|
||||
fprintf(stderr, "Invalid index interleaving total width %lu instead of %lu\n", nbs, total);
|
||||
free(loops);
|
||||
goto out_with_array;
|
||||
}
|
||||
}
|
||||
|
@ -278,6 +289,8 @@ hwloc_synthetic_process_indexes(struct hwloc_synthetic_backend_data_s *data,
|
|||
mul *= nb;
|
||||
}
|
||||
|
||||
free(loops);
|
||||
|
||||
/* check that we have the right values (cannot pass total, cannot give duplicate 0) */
|
||||
for(j=0; j<total; j++) {
|
||||
if (array[j] >= total) {
|
||||
|
@ -293,7 +306,6 @@ hwloc_synthetic_process_indexes(struct hwloc_synthetic_backend_data_s *data,
|
|||
}
|
||||
|
||||
indexes->array = array;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -527,7 +539,8 @@ hwloc_backend_synthetic_init(struct hwloc_synthetic_backend_data_s *data,
|
|||
|
||||
if (*pos < '0' || *pos > '9') {
|
||||
if (hwloc_type_sscanf(pos, &type, &attrs, sizeof(attrs)) < 0) {
|
||||
if (!strncmp(pos, "Die", 3) || !strncmp(pos, "Tile", 4) || !strncmp(pos, "Module", 6)) {
|
||||
if (!strncmp(pos, "Tile", 4) || !strncmp(pos, "Module", 6)) {
|
||||
/* possible future types */
|
||||
type = HWLOC_OBJ_GROUP;
|
||||
} else {
|
||||
/* FIXME: allow generic "Cache" string? would require to deal with possibly duplicate cache levels */
|
||||
|
@ -645,6 +658,12 @@ hwloc_backend_synthetic_init(struct hwloc_synthetic_backend_data_s *data,
|
|||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (type_count[HWLOC_OBJ_DIE] > 1) {
|
||||
if (verbose)
|
||||
fprintf(stderr, "Synthetic string cannot have several die levels\n");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (type_count[HWLOC_OBJ_NUMANODE] > 1) {
|
||||
if (verbose)
|
||||
fprintf(stderr, "Synthetic string cannot have several NUMA node levels\n");
|
||||
|
@ -829,6 +848,7 @@ hwloc_synthetic_set_attr(struct hwloc_synthetic_attr_s *sattr,
|
|||
obj->attr->numanode.page_types[0].count = sattr->memorysize / 4096;
|
||||
break;
|
||||
case HWLOC_OBJ_PACKAGE:
|
||||
case HWLOC_OBJ_DIE:
|
||||
break;
|
||||
case HWLOC_OBJ_L1CACHE:
|
||||
case HWLOC_OBJ_L2CACHE:
|
||||
|
@ -953,13 +973,19 @@ hwloc__look_synthetic(struct hwloc_topology *topology,
|
|||
}
|
||||
|
||||
static int
|
||||
hwloc_look_synthetic(struct hwloc_backend *backend)
|
||||
hwloc_look_synthetic(struct hwloc_backend *backend, struct hwloc_disc_status *dstatus)
|
||||
{
|
||||
/*
|
||||
* This backend enforces !topology->is_thissystem by default.
|
||||
*/
|
||||
|
||||
struct hwloc_topology *topology = backend->topology;
|
||||
struct hwloc_synthetic_backend_data_s *data = backend->private_data;
|
||||
hwloc_bitmap_t cpuset = hwloc_bitmap_alloc();
|
||||
unsigned i;
|
||||
|
||||
assert(dstatus->phase == HWLOC_DISC_PHASE_GLOBAL);
|
||||
|
||||
assert(!topology->levels[0][0]->cpuset);
|
||||
|
||||
hwloc_alloc_root_sets(topology->levels[0][0]);
|
||||
|
@ -1001,7 +1027,9 @@ hwloc_synthetic_backend_disable(struct hwloc_backend *backend)
|
|||
}
|
||||
|
||||
static struct hwloc_backend *
|
||||
hwloc_synthetic_component_instantiate(struct hwloc_disc_component *component,
|
||||
hwloc_synthetic_component_instantiate(struct hwloc_topology *topology,
|
||||
struct hwloc_disc_component *component,
|
||||
unsigned excluded_phases __hwloc_attribute_unused,
|
||||
const void *_data1,
|
||||
const void *_data2 __hwloc_attribute_unused,
|
||||
const void *_data3 __hwloc_attribute_unused)
|
||||
|
@ -1021,7 +1049,7 @@ hwloc_synthetic_component_instantiate(struct hwloc_disc_component *component,
|
|||
}
|
||||
}
|
||||
|
||||
backend = hwloc_backend_alloc(component);
|
||||
backend = hwloc_backend_alloc(topology, component);
|
||||
if (!backend)
|
||||
goto out;
|
||||
|
||||
|
@ -1051,8 +1079,8 @@ hwloc_synthetic_component_instantiate(struct hwloc_disc_component *component,
|
|||
}
|
||||
|
||||
static struct hwloc_disc_component hwloc_synthetic_disc_component = {
|
||||
HWLOC_DISC_COMPONENT_TYPE_GLOBAL,
|
||||
"synthetic",
|
||||
HWLOC_DISC_PHASE_GLOBAL,
|
||||
~0,
|
||||
hwloc_synthetic_component_instantiate,
|
||||
30,
|
||||
|
@ -1267,6 +1295,12 @@ hwloc__export_synthetic_obj(struct hwloc_topology * topology, unsigned long flag
|
|||
/* if exporting to v1 or without extended-types, use all-v1-compatible Socket name */
|
||||
res = hwloc_snprintf(tmp, tmplen, "Socket%s", aritys);
|
||||
|
||||
} else if (obj->type == HWLOC_OBJ_DIE
|
||||
&& (flags & (HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_EXTENDED_TYPES
|
||||
|HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_V1))) {
|
||||
/* if exporting to v1 or without extended-types, use all-v1-compatible Group name */
|
||||
res = hwloc_snprintf(tmp, tmplen, "Group%s", aritys);
|
||||
|
||||
} else if (obj->type == HWLOC_OBJ_GROUP /* don't export group depth */
|
||||
|| flags & HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_EXTENDED_TYPES) {
|
||||
res = hwloc_snprintf(tmp, tmplen, "%s%s", hwloc_obj_type_string(obj->type), aritys);
|
||||
|
@ -1323,16 +1357,26 @@ hwloc__export_synthetic_memory_children(struct hwloc_topology * topology, unsign
|
|||
}
|
||||
|
||||
while (mchild) {
|
||||
/* v2: export all NUMA children */
|
||||
|
||||
assert(mchild->type == HWLOC_OBJ_NUMANODE); /* only NUMA node memory children for now */
|
||||
/* FIXME: really recurse to export memcaches and numanode,
|
||||
* but it requires clever parsing of [ memcache [numa] [numa] ] during import,
|
||||
* better attaching of things to describe the hierarchy.
|
||||
*/
|
||||
hwloc_obj_t numanode = mchild;
|
||||
/* only export the first NUMA node leaf of each memory child
|
||||
* FIXME: This assumes mscache aren't shared between nodes, that's true in current platforms
|
||||
*/
|
||||
while (numanode && numanode->type != HWLOC_OBJ_NUMANODE) {
|
||||
assert(numanode->arity == 1);
|
||||
numanode = numanode->memory_first_child;
|
||||
}
|
||||
assert(numanode); /* there's always a numanode at the bottom of the memory tree */
|
||||
|
||||
if (needprefix)
|
||||
hwloc__export_synthetic_add_char(&ret, &tmp, &tmplen, ' ');
|
||||
|
||||
hwloc__export_synthetic_add_char(&ret, &tmp, &tmplen, '[');
|
||||
|
||||
res = hwloc__export_synthetic_obj(topology, flags, mchild, (unsigned)-1, tmp, tmplen);
|
||||
res = hwloc__export_synthetic_obj(topology, flags, numanode, (unsigned)-1, tmp, tmplen);
|
||||
if (hwloc__export_synthetic_update_status(&ret, &tmp, &tmplen, res) < 0)
|
||||
return -1;
|
||||
|
||||
|
@ -1366,9 +1410,8 @@ hwloc_check_memory_symmetric(struct hwloc_topology * topology)
|
|||
assert(node);
|
||||
|
||||
first_parent = node->parent;
|
||||
assert(hwloc__obj_type_is_normal(first_parent->type)); /* only depth-1 memory children for now */
|
||||
|
||||
/* check whether all object on parent's level have same number of NUMA children */
|
||||
/* check whether all object on parent's level have same number of NUMA bits */
|
||||
for(i=0; i<hwloc_get_nbobjs_by_depth(topology, first_parent->depth); i++) {
|
||||
hwloc_obj_t parent, mchild;
|
||||
|
||||
|
@ -1379,10 +1422,9 @@ hwloc_check_memory_symmetric(struct hwloc_topology * topology)
|
|||
if (parent->memory_arity != first_parent->memory_arity)
|
||||
goto out_with_bitmap;
|
||||
|
||||
/* clear these NUMA children from remaining_nodes */
|
||||
/* clear children NUMA bits from remaining_nodes */
|
||||
mchild = parent->memory_first_child;
|
||||
while (mchild) {
|
||||
assert(mchild->type == HWLOC_OBJ_NUMANODE); /* only NUMA node memory children for now */
|
||||
hwloc_bitmap_clr(remaining_nodes, mchild->os_index); /* cannot use parent->nodeset, some normal children may have other NUMA nodes */
|
||||
mchild = mchild->next_sibling;
|
||||
}
|
||||
|
@ -1461,6 +1503,7 @@ hwloc_topology_export_synthetic(struct hwloc_topology * topology,
|
|||
signed pdepth;
|
||||
|
||||
node = hwloc_get_obj_by_type(topology, HWLOC_OBJ_NUMANODE, 0);
|
||||
assert(node);
|
||||
assert(hwloc__obj_type_is_normal(node->parent->type)); /* only depth-1 memory children for now */
|
||||
pdepth = node->parent->depth;
|
||||
|
||||
|
|
50
src/3rdparty/hwloc/src/topology-windows.c
vendored
50
src/3rdparty/hwloc/src/topology-windows.c
vendored
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2018 Inria. All rights reserved.
|
||||
* Copyright © 2009-2012 Université Bordeaux
|
||||
* Copyright © 2009-2020 Inria. All rights reserved.
|
||||
* Copyright © 2009-2012, 2020 Université Bordeaux
|
||||
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
@ -9,10 +9,10 @@
|
|||
/* To try to get all declarations duplicated below. */
|
||||
#define _WIN32_WINNT 0x0601
|
||||
|
||||
#include <private/autogen/config.h>
|
||||
#include <hwloc.h>
|
||||
#include <private/private.h>
|
||||
#include <private/debug.h>
|
||||
#include "private/autogen/config.h"
|
||||
#include "hwloc.h"
|
||||
#include "private/private.h"
|
||||
#include "private/debug.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
@ -232,6 +232,10 @@ static void hwloc_win_get_function_ptrs(void)
|
|||
{
|
||||
HMODULE kernel32;
|
||||
|
||||
#if HWLOC_HAVE_GCC_W_CAST_FUNCTION_TYPE
|
||||
#pragma GCC diagnostic ignored "-Wcast-function-type"
|
||||
#endif
|
||||
|
||||
kernel32 = LoadLibrary("kernel32.dll");
|
||||
if (kernel32) {
|
||||
GetActiveProcessorGroupCountProc =
|
||||
|
@ -270,6 +274,10 @@ static void hwloc_win_get_function_ptrs(void)
|
|||
if (psapi)
|
||||
QueryWorkingSetExProc = (PFN_QUERYWORKINGSETEX) GetProcAddress(psapi, "QueryWorkingSetEx");
|
||||
}
|
||||
|
||||
#if HWLOC_HAVE_GCC_W_CAST_FUNCTION_TYPE
|
||||
#pragma GCC diagnostic warning "-Wcast-function-type"
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -731,8 +739,14 @@ hwloc_win_get_area_memlocation(hwloc_topology_t topology __hwloc_attribute_unuse
|
|||
*/
|
||||
|
||||
static int
|
||||
hwloc_look_windows(struct hwloc_backend *backend)
|
||||
hwloc_look_windows(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;
|
||||
hwloc_bitmap_t groups_pu_set = NULL;
|
||||
SYSTEM_INFO SystemInfo;
|
||||
|
@ -740,6 +754,8 @@ hwloc_look_windows(struct hwloc_backend *backend)
|
|||
int gotnuma = 0;
|
||||
int gotnumamemory = 0;
|
||||
|
||||
assert(dstatus->phase == HWLOC_DISC_PHASE_CPU);
|
||||
|
||||
if (topology->levels[0][0]->cpuset)
|
||||
/* somebody discovered things */
|
||||
return -1;
|
||||
|
@ -1136,13 +1152,15 @@ static void hwloc_windows_component_finalize(unsigned long flags __hwloc_attribu
|
|||
}
|
||||
|
||||
static struct hwloc_backend *
|
||||
hwloc_windows_component_instantiate(struct hwloc_disc_component *component,
|
||||
hwloc_windows_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(component);
|
||||
backend = hwloc_backend_alloc(topology, component);
|
||||
if (!backend)
|
||||
return NULL;
|
||||
backend->discover = hwloc_look_windows;
|
||||
|
@ -1150,9 +1168,9 @@ hwloc_windows_component_instantiate(struct hwloc_disc_component *component,
|
|||
}
|
||||
|
||||
static struct hwloc_disc_component hwloc_windows_disc_component = {
|
||||
HWLOC_DISC_COMPONENT_TYPE_CPU,
|
||||
"windows",
|
||||
HWLOC_DISC_COMPONENT_TYPE_GLOBAL,
|
||||
HWLOC_DISC_PHASE_CPU,
|
||||
HWLOC_DISC_PHASE_GLOBAL,
|
||||
hwloc_windows_component_instantiate,
|
||||
50,
|
||||
1,
|
||||
|
@ -1168,10 +1186,12 @@ const struct hwloc_component hwloc_windows_component = {
|
|||
};
|
||||
|
||||
int
|
||||
hwloc_fallback_nbprocessors(struct hwloc_topology *topology __hwloc_attribute_unused) {
|
||||
hwloc_fallback_nbprocessors(unsigned flags __hwloc_attribute_unused) {
|
||||
int n;
|
||||
SYSTEM_INFO sysinfo;
|
||||
|
||||
/* TODO handle flags & HWLOC_FALLBACK_NBPROCESSORS_INCLUDE_OFFLINE */
|
||||
|
||||
/* by default, ignore groups (return only the number in the current group) */
|
||||
GetSystemInfo(&sysinfo);
|
||||
n = sysinfo.dwNumberOfProcessors; /* FIXME could be non-contigous, rather return a mask from dwActiveProcessorMask? */
|
||||
|
@ -1187,3 +1207,9 @@ hwloc_fallback_nbprocessors(struct hwloc_topology *topology __hwloc_attribute_un
|
|||
|
||||
return n;
|
||||
}
|
||||
|
||||
int64_t
|
||||
hwloc_fallback_memsize(void) {
|
||||
/* Unused */
|
||||
return -1;
|
||||
}
|
||||
|
|
905
src/3rdparty/hwloc/src/topology-x86.c
vendored
905
src/3rdparty/hwloc/src/topology-x86.c
vendored
File diff suppressed because it is too large
Load diff
52
src/3rdparty/hwloc/src/topology-xml-nolibxml.c
vendored
52
src/3rdparty/hwloc/src/topology-xml-nolibxml.c
vendored
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2018 Inria. All rights reserved.
|
||||
* Copyright © 2009-2020 Inria. All rights reserved.
|
||||
* Copyright © 2009-2011 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 <hwloc/plugins.h>
|
||||
#include <private/private.h>
|
||||
#include <private/misc.h>
|
||||
#include <private/xml.h>
|
||||
#include <private/debug.h>
|
||||
#include "private/autogen/config.h"
|
||||
#include "hwloc.h"
|
||||
#include "hwloc/plugins.h"
|
||||
#include "private/private.h"
|
||||
#include "private/misc.h"
|
||||
#include "private/xml.h"
|
||||
#include "private/debug.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
@ -27,15 +27,14 @@
|
|||
*******************/
|
||||
|
||||
struct hwloc__nolibxml_backend_data_s {
|
||||
size_t buflen; /* size of both buffer and copy buffers, set during backend_init() */
|
||||
size_t buflen; /* size of both buffer, set during backend_init() */
|
||||
char *buffer; /* allocated and filled during backend_init() */
|
||||
char *copy; /* allocated during backend_init(), used later during actual parsing */
|
||||
};
|
||||
|
||||
typedef struct hwloc__nolibxml_import_state_data_s {
|
||||
char *tagbuffer; /* buffer containing the next tag */
|
||||
char *attrbuffer; /* buffer containing the next attribute of the current node */
|
||||
char *tagname; /* tag name of the current node */
|
||||
const char *tagname; /* tag name of the current node */
|
||||
int closed; /* set if the current node is auto-closing */
|
||||
} __hwloc_attribute_may_alias * hwloc__nolibxml_import_state_data_t;
|
||||
|
||||
|
@ -138,7 +137,7 @@ hwloc__nolibxml_import_find_child(hwloc__xml_import_state_t state,
|
|||
return 0;
|
||||
|
||||
/* normal tag */
|
||||
tag = nchildstate->tagname = buffer;
|
||||
nchildstate->tagname = tag = buffer;
|
||||
|
||||
/* find the end, mark it and return it */
|
||||
end = strchr(buffer, '>');
|
||||
|
@ -260,14 +259,11 @@ hwloc_nolibxml_look_init(struct hwloc_xml_backend_data_s *bdata,
|
|||
struct hwloc__nolibxml_backend_data_s *nbdata = bdata->data;
|
||||
unsigned major, minor;
|
||||
char *end;
|
||||
char *buffer;
|
||||
char *buffer = nbdata->buffer;
|
||||
const char *tagname;
|
||||
|
||||
HWLOC_BUILD_ASSERT(sizeof(*nstate) <= sizeof(state->data));
|
||||
|
||||
/* use a copy in the temporary buffer, we may modify during parsing */
|
||||
buffer = nbdata->copy;
|
||||
memcpy(buffer, nbdata->buffer, nbdata->buflen);
|
||||
|
||||
/* skip headers */
|
||||
while (!strncmp(buffer, "<?xml ", 6) || !strncmp(buffer, "<!DOCTYPE ", 10)) {
|
||||
buffer = strchr(buffer, '\n');
|
||||
|
@ -281,14 +277,17 @@ hwloc_nolibxml_look_init(struct hwloc_xml_backend_data_s *bdata,
|
|||
bdata->version_major = major;
|
||||
bdata->version_minor = minor;
|
||||
end = strchr(buffer, '>') + 1;
|
||||
tagname = "topology";
|
||||
} else if (!strncmp(buffer, "<topology>", 10)) {
|
||||
bdata->version_major = 1;
|
||||
bdata->version_minor = 0;
|
||||
end = buffer + 10;
|
||||
tagname = "topology";
|
||||
} else if (!strncmp(buffer, "<root>", 6)) {
|
||||
bdata->version_major = 0;
|
||||
bdata->version_minor = 9;
|
||||
end = buffer + 6;
|
||||
tagname = "root";
|
||||
} else
|
||||
goto failed;
|
||||
|
||||
|
@ -301,7 +300,7 @@ hwloc_nolibxml_look_init(struct hwloc_xml_backend_data_s *bdata,
|
|||
state->parent = NULL;
|
||||
nstate->closed = 0;
|
||||
nstate->tagbuffer = end;
|
||||
nstate->tagname = (char *) "topology";
|
||||
nstate->tagname = tagname;
|
||||
nstate->attrbuffer = NULL;
|
||||
return 0; /* success */
|
||||
|
||||
|
@ -320,10 +319,6 @@ hwloc_nolibxml_free_buffers(struct hwloc_xml_backend_data_s *bdata)
|
|||
free(nbdata->buffer);
|
||||
nbdata->buffer = NULL;
|
||||
}
|
||||
if (nbdata->copy) {
|
||||
free(nbdata->copy);
|
||||
nbdata->copy = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -429,19 +424,11 @@ hwloc_nolibxml_backend_init(struct hwloc_xml_backend_data_s *bdata,
|
|||
goto out_with_nbdata;
|
||||
}
|
||||
|
||||
/* allocate a temporary copy buffer that we may modify during parsing */
|
||||
nbdata->copy = malloc(nbdata->buflen+1);
|
||||
if (!nbdata->copy)
|
||||
goto out_with_buffer;
|
||||
nbdata->copy[nbdata->buflen] = '\0';
|
||||
|
||||
bdata->look_init = hwloc_nolibxml_look_init;
|
||||
bdata->look_done = hwloc_nolibxml_look_done;
|
||||
bdata->backend_exit = hwloc_nolibxml_backend_exit;
|
||||
return 0;
|
||||
|
||||
out_with_buffer:
|
||||
free(nbdata->buffer);
|
||||
out_with_nbdata:
|
||||
free(nbdata);
|
||||
out:
|
||||
|
@ -666,7 +653,7 @@ hwloc__nolibxml_export_end_object(hwloc__xml_export_state_t state, const char *n
|
|||
}
|
||||
|
||||
static void
|
||||
hwloc__nolibxml_export_add_content(hwloc__xml_export_state_t state, const char *buffer, size_t length)
|
||||
hwloc__nolibxml_export_add_content(hwloc__xml_export_state_t state, const char *buffer, size_t length __hwloc_attribute_unused)
|
||||
{
|
||||
hwloc__nolibxml_export_state_data_t ndata = (void *) state->data;
|
||||
int res;
|
||||
|
@ -678,7 +665,7 @@ hwloc__nolibxml_export_add_content(hwloc__xml_export_state_t state, const char *
|
|||
}
|
||||
ndata->has_content = 1;
|
||||
|
||||
res = hwloc_snprintf(ndata->buffer, ndata->remaining, buffer, length);
|
||||
res = hwloc_snprintf(ndata->buffer, ndata->remaining, "%s", buffer);
|
||||
hwloc__nolibxml_export_update_buffer(ndata, res);
|
||||
}
|
||||
|
||||
|
@ -799,6 +786,7 @@ hwloc___nolibxml_prepare_export_diff(hwloc_topology_diff_t diff, const char *ref
|
|||
state.new_prop = hwloc__nolibxml_export_new_prop;
|
||||
state.add_content = hwloc__nolibxml_export_add_content;
|
||||
state.end_object = hwloc__nolibxml_export_end_object;
|
||||
state.global = NULL;
|
||||
|
||||
ndata->indent = 0;
|
||||
ndata->written = 0;
|
||||
|
|
538
src/3rdparty/hwloc/src/topology-xml.c
vendored
538
src/3rdparty/hwloc/src/topology-xml.c
vendored
File diff suppressed because it is too large
Load diff
1121
src/3rdparty/hwloc/src/topology.c
vendored
1121
src/3rdparty/hwloc/src/topology.c
vendored
File diff suppressed because it is too large
Load diff
131
src/3rdparty/hwloc/src/traversal.c
vendored
131
src/3rdparty/hwloc/src/traversal.c
vendored
|
@ -1,16 +1,17 @@
|
|||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2018 Inria. All rights reserved.
|
||||
* Copyright © 2009-2019 Inria. All rights reserved.
|
||||
* Copyright © 2009-2010 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>
|
||||
#include <private/misc.h>
|
||||
#include <private/debug.h>
|
||||
#include "private/autogen/config.h"
|
||||
#include "hwloc.h"
|
||||
#include "private/private.h"
|
||||
#include "private/misc.h"
|
||||
#include "private/debug.h"
|
||||
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif /* HAVE_STRINGS_H */
|
||||
|
@ -40,6 +41,8 @@ hwloc_get_depth_type (hwloc_topology_t topology, int depth)
|
|||
return HWLOC_OBJ_OS_DEVICE;
|
||||
case HWLOC_TYPE_DEPTH_MISC:
|
||||
return HWLOC_OBJ_MISC;
|
||||
case HWLOC_TYPE_DEPTH_MEMCACHE:
|
||||
return HWLOC_OBJ_MEMCACHE;
|
||||
default:
|
||||
return HWLOC_OBJ_TYPE_NONE;
|
||||
}
|
||||
|
@ -237,8 +240,10 @@ hwloc_obj_type_string (hwloc_obj_type_t obj)
|
|||
case HWLOC_OBJ_MACHINE: return "Machine";
|
||||
case HWLOC_OBJ_MISC: return "Misc";
|
||||
case HWLOC_OBJ_GROUP: return "Group";
|
||||
case HWLOC_OBJ_MEMCACHE: return "MemCache";
|
||||
case HWLOC_OBJ_NUMANODE: return "NUMANode";
|
||||
case HWLOC_OBJ_PACKAGE: return "Package";
|
||||
case HWLOC_OBJ_DIE: return "Die";
|
||||
case HWLOC_OBJ_L1CACHE: return "L1Cache";
|
||||
case HWLOC_OBJ_L2CACHE: return "L2Cache";
|
||||
case HWLOC_OBJ_L3CACHE: return "L3Cache";
|
||||
|
@ -256,6 +261,41 @@ hwloc_obj_type_string (hwloc_obj_type_t obj)
|
|||
}
|
||||
}
|
||||
|
||||
/* Check if string matches the given type at least on minmatch chars.
|
||||
* On success, return the address of where matching stop, either pointing to \0 or to a suffix (digits, colon, etc)
|
||||
* On error, return NULL;
|
||||
*/
|
||||
static __hwloc_inline const char *
|
||||
hwloc__type_match(const char *string,
|
||||
const char *type, /* type must be lowercase */
|
||||
size_t minmatch)
|
||||
{
|
||||
const char *s, *t;
|
||||
unsigned i;
|
||||
for(i=0, s=string, t=type; ; i++, s++, t++) {
|
||||
if (!*s) {
|
||||
/* string ends before type */
|
||||
if (i<minmatch)
|
||||
return NULL;
|
||||
else
|
||||
return s;
|
||||
}
|
||||
if (*s != *t && *s != *t + 'A' - 'a') {
|
||||
/* string is different */
|
||||
if ((*s >= 'a' && *s <= 'z') || (*s >= 'A' && *s <= 'Z') || *s == '-')
|
||||
/* valid character that doesn't match */
|
||||
return NULL;
|
||||
/* invalid character, we reached the end of the type namein string, stop matching here */
|
||||
if (i<minmatch)
|
||||
return NULL;
|
||||
else
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
hwloc_type_sscanf(const char *string, hwloc_obj_type_t *typep,
|
||||
union hwloc_obj_attr_u *attrp, size_t attrsize)
|
||||
|
@ -267,86 +307,102 @@ hwloc_type_sscanf(const char *string, hwloc_obj_type_t *typep,
|
|||
hwloc_obj_osdev_type_t ostype = (hwloc_obj_osdev_type_t) -1;
|
||||
char *end;
|
||||
|
||||
/* never match the ending \0 since we want to match things like core:2 too.
|
||||
* just use hwloc_strncasecmp() everywhere.
|
||||
/* Never match the ending \0 since we want to match things like core:2 too.
|
||||
* We'll only compare the beginning substring only made of letters and dash.
|
||||
*/
|
||||
|
||||
/* types without a custom depth */
|
||||
|
||||
/* osdev subtype first to avoid conflicts coproc/core etc */
|
||||
if (!hwloc_strncasecmp(string, "os", 2)) {
|
||||
if (hwloc__type_match(string, "osdev", 2)) {
|
||||
type = HWLOC_OBJ_OS_DEVICE;
|
||||
} else if (!hwloc_strncasecmp(string, "bloc", 4)) {
|
||||
} else if (hwloc__type_match(string, "block", 4)) {
|
||||
type = HWLOC_OBJ_OS_DEVICE;
|
||||
ostype = HWLOC_OBJ_OSDEV_BLOCK;
|
||||
} else if (!hwloc_strncasecmp(string, "net", 3)) {
|
||||
} else if (hwloc__type_match(string, "network", 3)) {
|
||||
type = HWLOC_OBJ_OS_DEVICE;
|
||||
ostype = HWLOC_OBJ_OSDEV_NETWORK;
|
||||
} else if (!hwloc_strncasecmp(string, "openfab", 7)) {
|
||||
} else if (hwloc__type_match(string, "openfabrics", 7)) {
|
||||
type = HWLOC_OBJ_OS_DEVICE;
|
||||
ostype = HWLOC_OBJ_OSDEV_OPENFABRICS;
|
||||
} else if (!hwloc_strncasecmp(string, "dma", 3)) {
|
||||
} else if (hwloc__type_match(string, "dma", 3)) {
|
||||
type = HWLOC_OBJ_OS_DEVICE;
|
||||
ostype = HWLOC_OBJ_OSDEV_DMA;
|
||||
} else if (!hwloc_strncasecmp(string, "gpu", 3)) {
|
||||
} else if (hwloc__type_match(string, "gpu", 3)) {
|
||||
type = HWLOC_OBJ_OS_DEVICE;
|
||||
ostype = HWLOC_OBJ_OSDEV_GPU;
|
||||
} else if (!hwloc_strncasecmp(string, "copro", 5)
|
||||
|| !hwloc_strncasecmp(string, "co-pro", 6)) {
|
||||
} else if (hwloc__type_match(string, "coproc", 5)
|
||||
|| hwloc__type_match(string, "co-processor", 6)) {
|
||||
type = HWLOC_OBJ_OS_DEVICE;
|
||||
ostype = HWLOC_OBJ_OSDEV_COPROC;
|
||||
|
||||
} else if (!hwloc_strncasecmp(string, "machine", 2)) {
|
||||
} else if (hwloc__type_match(string, "machine", 2)) {
|
||||
type = HWLOC_OBJ_MACHINE;
|
||||
} else if (!hwloc_strncasecmp(string, "node", 2)
|
||||
|| !hwloc_strncasecmp(string, "numa", 2)) { /* matches node and numanode */
|
||||
} else if (hwloc__type_match(string, "numanode", 2)
|
||||
|| hwloc__type_match(string, "node", 2)) { /* for convenience */
|
||||
type = HWLOC_OBJ_NUMANODE;
|
||||
} else if (!hwloc_strncasecmp(string, "package", 2)
|
||||
|| !hwloc_strncasecmp(string, "socket", 2)) { /* backward compat with v1.10 */
|
||||
} else if (hwloc__type_match(string, "memcache", 5)
|
||||
|| hwloc__type_match(string, "memory-side cache", 8)) {
|
||||
type = HWLOC_OBJ_MEMCACHE;
|
||||
} else if (hwloc__type_match(string, "package", 2)
|
||||
|| hwloc__type_match(string, "socket", 2)) { /* backward compat with v1.10 */
|
||||
type = HWLOC_OBJ_PACKAGE;
|
||||
} else if (!hwloc_strncasecmp(string, "core", 2)) {
|
||||
} else if (hwloc__type_match(string, "die", 2)) {
|
||||
type = HWLOC_OBJ_DIE;
|
||||
} else if (hwloc__type_match(string, "core", 2)) {
|
||||
type = HWLOC_OBJ_CORE;
|
||||
} else if (!hwloc_strncasecmp(string, "pu", 2)) {
|
||||
} else if (hwloc__type_match(string, "pu", 2)) {
|
||||
type = HWLOC_OBJ_PU;
|
||||
} else if (!hwloc_strncasecmp(string, "misc", 4)) {
|
||||
} else if (hwloc__type_match(string, "misc", 4)) {
|
||||
type = HWLOC_OBJ_MISC;
|
||||
|
||||
} else if (!hwloc_strncasecmp(string, "bridge", 4)) {
|
||||
} else if (hwloc__type_match(string, "bridge", 4)) {
|
||||
type = HWLOC_OBJ_BRIDGE;
|
||||
} else if (!hwloc_strncasecmp(string, "hostbridge", 6)) {
|
||||
} else if (hwloc__type_match(string, "hostbridge", 6)) {
|
||||
type = HWLOC_OBJ_BRIDGE;
|
||||
ubtype = HWLOC_OBJ_BRIDGE_HOST;
|
||||
} else if (!hwloc_strncasecmp(string, "pcibridge", 5)) {
|
||||
} else if (hwloc__type_match(string, "pcibridge", 5)) {
|
||||
type = HWLOC_OBJ_BRIDGE;
|
||||
ubtype = HWLOC_OBJ_BRIDGE_PCI;
|
||||
|
||||
} else if (!hwloc_strncasecmp(string, "pci", 3)) {
|
||||
} else if (hwloc__type_match(string, "pcidev", 3)) {
|
||||
type = HWLOC_OBJ_PCI_DEVICE;
|
||||
|
||||
/* types with depthattr */
|
||||
} else if ((string[0] == 'l' || string[0] == 'L') && string[1] >= '0' && string[1] <= '9') {
|
||||
char *suffix;
|
||||
depthattr = strtol(string+1, &end, 10);
|
||||
if (*end == 'i') {
|
||||
if (*end == 'i' || *end == 'I') {
|
||||
if (depthattr >= 1 && depthattr <= 3) {
|
||||
type = HWLOC_OBJ_L1ICACHE + depthattr-1;
|
||||
cachetypeattr = HWLOC_OBJ_CACHE_INSTRUCTION;
|
||||
suffix = end+1;
|
||||
} else
|
||||
return -1;
|
||||
} else {
|
||||
if (depthattr >= 1 && depthattr <= 5) {
|
||||
type = HWLOC_OBJ_L1CACHE + depthattr-1;
|
||||
cachetypeattr = *end == 'd' ? HWLOC_OBJ_CACHE_DATA : HWLOC_OBJ_CACHE_UNIFIED;
|
||||
if (*end == 'd' || *end == 'D') {
|
||||
cachetypeattr = HWLOC_OBJ_CACHE_DATA;
|
||||
suffix = end+1;
|
||||
} else if (*end == 'u' || *end == 'U') {
|
||||
cachetypeattr = HWLOC_OBJ_CACHE_UNIFIED;
|
||||
suffix = end+1;
|
||||
} else {
|
||||
cachetypeattr = HWLOC_OBJ_CACHE_UNIFIED;
|
||||
suffix = end;
|
||||
}
|
||||
} else
|
||||
return -1;
|
||||
}
|
||||
/* check whether the optional suffix matches "cache" */
|
||||
if (!hwloc__type_match(suffix, "cache", 0))
|
||||
return -1;
|
||||
|
||||
} else if (!hwloc_strncasecmp(string, "group", 2)) {
|
||||
size_t length;
|
||||
} else if ((end = (char *) hwloc__type_match(string, "group", 2)) != NULL) {
|
||||
type = HWLOC_OBJ_GROUP;
|
||||
length = strcspn(string, "0123456789");
|
||||
if (length <= 5 && !hwloc_strncasecmp(string, "group", length)
|
||||
&& string[length] >= '0' && string[length] <= '9') {
|
||||
depthattr = strtol(string+length, &end, 10);
|
||||
if (*end >= '0' && *end <= '9') {
|
||||
depthattr = strtol(end, &end, 10);
|
||||
}
|
||||
|
||||
} else
|
||||
|
@ -421,7 +477,9 @@ hwloc_obj_type_snprintf(char * __hwloc_restrict string, size_t size, hwloc_obj_t
|
|||
case HWLOC_OBJ_MISC:
|
||||
case HWLOC_OBJ_MACHINE:
|
||||
case HWLOC_OBJ_NUMANODE:
|
||||
case HWLOC_OBJ_MEMCACHE:
|
||||
case HWLOC_OBJ_PACKAGE:
|
||||
case HWLOC_OBJ_DIE:
|
||||
case HWLOC_OBJ_CORE:
|
||||
case HWLOC_OBJ_PU:
|
||||
return hwloc_snprintf(string, size, "%s", hwloc_obj_type_string(type));
|
||||
|
@ -523,6 +581,7 @@ hwloc_obj_attr_snprintf(char * __hwloc_restrict string, size_t size, hwloc_obj_t
|
|||
case HWLOC_OBJ_L1ICACHE:
|
||||
case HWLOC_OBJ_L2ICACHE:
|
||||
case HWLOC_OBJ_L3ICACHE:
|
||||
case HWLOC_OBJ_MEMCACHE:
|
||||
if (verbose) {
|
||||
char assoc[32];
|
||||
if (obj->attr->cache.associativity == -1)
|
||||
|
|
24
src/3rdparty/libethash/CMakeLists.txt
vendored
Normal file
24
src/3rdparty/libethash/CMakeLists.txt
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
cmake_minimum_required (VERSION 2.8)
|
||||
project (ethash C)
|
||||
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Os")
|
||||
|
||||
set(HEADERS
|
||||
data_sizes.h
|
||||
endian.h
|
||||
ethash.h
|
||||
ethash_internal.h
|
||||
fnv.h
|
||||
)
|
||||
|
||||
set(SOURCES
|
||||
ethash_internal.c
|
||||
keccakf800.c
|
||||
)
|
||||
|
||||
include_directories(../..)
|
||||
|
||||
add_library(ethash STATIC
|
||||
${HEADERS}
|
||||
${SOURCES}
|
||||
)
|
811
src/3rdparty/libethash/data_sizes.h
vendored
Normal file
811
src/3rdparty/libethash/data_sizes.h
vendored
Normal file
|
@ -0,0 +1,811 @@
|
|||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software FoundationUUU,either version 3 of the LicenseUUU,or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be usefulU,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If notUUU,see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file data_sizes.h
|
||||
* @author Matthew Wampler-Doty <negacthulhu@gmail.com>
|
||||
* @date 2015
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// 2048 Epochs (~20 years) worth of tabulated DAG sizes
|
||||
|
||||
// Generated with the following Mathematica Code:
|
||||
|
||||
// GetCacheSizes[n_] := Module[{
|
||||
// CacheSizeBytesInit = 2^24,
|
||||
// CacheGrowth = 2^17,
|
||||
// HashBytes = 64,
|
||||
// j = 0},
|
||||
// Reap[
|
||||
// While[j < n,
|
||||
// Module[{i =
|
||||
// Floor[(CacheSizeBytesInit + CacheGrowth * j) / HashBytes]},
|
||||
// While[! PrimeQ[i], i--];
|
||||
// Sow[i*HashBytes]; j++]]]][[2]][[1]]
|
||||
|
||||
|
||||
static const uint64_t dag_sizes[2048] = {
|
||||
1073739904U, 1082130304U, 1090514816U, 1098906752U, 1107293056U,
|
||||
1115684224U, 1124070016U, 1132461952U, 1140849536U, 1149232768U,
|
||||
1157627776U, 1166013824U, 1174404736U, 1182786944U, 1191180416U,
|
||||
1199568512U, 1207958912U, 1216345216U, 1224732032U, 1233124736U,
|
||||
1241513344U, 1249902464U, 1258290304U, 1266673792U, 1275067264U,
|
||||
1283453312U, 1291844992U, 1300234112U, 1308619904U, 1317010048U,
|
||||
1325397376U, 1333787776U, 1342176128U, 1350561664U, 1358954368U,
|
||||
1367339392U, 1375731584U, 1384118144U, 1392507008U, 1400897408U,
|
||||
1409284736U, 1417673344U, 1426062464U, 1434451072U, 1442839168U,
|
||||
1451229056U, 1459615616U, 1468006016U, 1476394112U, 1484782976U,
|
||||
1493171584U, 1501559168U, 1509948032U, 1518337664U, 1526726528U,
|
||||
1535114624U, 1543503488U, 1551892096U, 1560278656U, 1568669056U,
|
||||
1577056384U, 1585446272U, 1593831296U, 1602219392U, 1610610304U,
|
||||
1619000192U, 1627386752U, 1635773824U, 1644164224U, 1652555648U,
|
||||
1660943488U, 1669332608U, 1677721216U, 1686109312U, 1694497664U,
|
||||
1702886272U, 1711274624U, 1719661184U, 1728047744U, 1736434816U,
|
||||
1744829056U, 1753218944U, 1761606272U, 1769995904U, 1778382464U,
|
||||
1786772864U, 1795157888U, 1803550592U, 1811937664U, 1820327552U,
|
||||
1828711552U, 1837102976U, 1845488768U, 1853879936U, 1862269312U,
|
||||
1870656896U, 1879048064U, 1887431552U, 1895825024U, 1904212096U,
|
||||
1912601216U, 1920988544U, 1929379456U, 1937765504U, 1946156672U,
|
||||
1954543232U, 1962932096U, 1971321728U, 1979707264U, 1988093056U,
|
||||
1996487552U, 2004874624U, 2013262208U, 2021653888U, 2030039936U,
|
||||
2038430848U, 2046819968U, 2055208576U, 2063596672U, 2071981952U,
|
||||
2080373632U, 2088762752U, 2097149056U, 2105539712U, 2113928576U,
|
||||
2122315136U, 2130700672U, 2139092608U, 2147483264U, 2155872128U,
|
||||
2164257664U, 2172642176U, 2181035392U, 2189426048U, 2197814912U,
|
||||
2206203008U, 2214587264U, 2222979712U, 2231367808U, 2239758208U,
|
||||
2248145024U, 2256527744U, 2264922752U, 2273312128U, 2281701248U,
|
||||
2290086272U, 2298476672U, 2306867072U, 2315251072U, 2323639168U,
|
||||
2332032128U, 2340420224U, 2348808064U, 2357196416U, 2365580416U,
|
||||
2373966976U, 2382363008U, 2390748544U, 2399139968U, 2407530368U,
|
||||
2415918976U, 2424307328U, 2432695424U, 2441084288U, 2449472384U,
|
||||
2457861248U, 2466247808U, 2474637184U, 2483026816U, 2491414144U,
|
||||
2499803776U, 2508191872U, 2516582272U, 2524970368U, 2533359232U,
|
||||
2541743488U, 2550134144U, 2558525056U, 2566913408U, 2575301504U,
|
||||
2583686528U, 2592073856U, 2600467328U, 2608856192U, 2617240448U,
|
||||
2625631616U, 2634022016U, 2642407552U, 2650796416U, 2659188352U,
|
||||
2667574912U, 2675965312U, 2684352896U, 2692738688U, 2701130624U,
|
||||
2709518464U, 2717907328U, 2726293376U, 2734685056U, 2743073152U,
|
||||
2751462016U, 2759851648U, 2768232832U, 2776625536U, 2785017728U,
|
||||
2793401984U, 2801794432U, 2810182016U, 2818571648U, 2826959488U,
|
||||
2835349376U, 2843734144U, 2852121472U, 2860514432U, 2868900992U,
|
||||
2877286784U, 2885676928U, 2894069632U, 2902451584U, 2910843008U,
|
||||
2919234688U, 2927622784U, 2936011648U, 2944400768U, 2952789376U,
|
||||
2961177728U, 2969565568U, 2977951616U, 2986338944U, 2994731392U,
|
||||
3003120256U, 3011508352U, 3019895936U, 3028287104U, 3036675968U,
|
||||
3045063808U, 3053452928U, 3061837696U, 3070228352U, 3078615424U,
|
||||
3087003776U, 3095394944U, 3103782272U, 3112173184U, 3120562048U,
|
||||
3128944768U, 3137339264U, 3145725056U, 3154109312U, 3162505088U,
|
||||
3170893184U, 3179280256U, 3187669376U, 3196056704U, 3204445568U,
|
||||
3212836736U, 3221224064U, 3229612928U, 3238002304U, 3246391168U,
|
||||
3254778496U, 3263165824U, 3271556224U, 3279944576U, 3288332416U,
|
||||
3296719232U, 3305110912U, 3313500032U, 3321887104U, 3330273152U,
|
||||
3338658944U, 3347053184U, 3355440512U, 3363827072U, 3372220288U,
|
||||
3380608384U, 3388997504U, 3397384576U, 3405774208U, 3414163072U,
|
||||
3422551936U, 3430937984U, 3439328384U, 3447714176U, 3456104576U,
|
||||
3464493952U, 3472883584U, 3481268864U, 3489655168U, 3498048896U,
|
||||
3506434432U, 3514826368U, 3523213952U, 3531603584U, 3539987072U,
|
||||
3548380288U, 3556763264U, 3565157248U, 3573545344U, 3581934464U,
|
||||
3590324096U, 3598712704U, 3607098752U, 3615488384U, 3623877248U,
|
||||
3632265856U, 3640646528U, 3649043584U, 3657430144U, 3665821568U,
|
||||
3674207872U, 3682597504U, 3690984832U, 3699367808U, 3707764352U,
|
||||
3716152448U, 3724541056U, 3732925568U, 3741318016U, 3749706368U,
|
||||
3758091136U, 3766481536U, 3774872704U, 3783260032U, 3791650432U,
|
||||
3800036224U, 3808427648U, 3816815488U, 3825204608U, 3833592704U,
|
||||
3841981568U, 3850370432U, 3858755968U, 3867147904U, 3875536256U,
|
||||
3883920512U, 3892313728U, 3900702592U, 3909087872U, 3917478784U,
|
||||
3925868416U, 3934256512U, 3942645376U, 3951032192U, 3959422336U,
|
||||
3967809152U, 3976200064U, 3984588416U, 3992974976U, 4001363584U,
|
||||
4009751168U, 4018141312U, 4026530432U, 4034911616U, 4043308928U,
|
||||
4051695488U, 4060084352U, 4068472448U, 4076862848U, 4085249408U,
|
||||
4093640576U, 4102028416U, 4110413696U, 4118805632U, 4127194496U,
|
||||
4135583104U, 4143971968U, 4152360832U, 4160746112U, 4169135744U,
|
||||
4177525888U, 4185912704U, 4194303616U, 4202691968U, 4211076736U,
|
||||
4219463552U, 4227855488U, 4236246656U, 4244633728U, 4253022848U,
|
||||
4261412224U, 4269799808U, 4278184832U, 4286578048U, 4294962304U,
|
||||
4303349632U, 4311743104U, 4320130432U, 4328521088U, 4336909184U,
|
||||
4345295488U, 4353687424U, 4362073472U, 4370458496U, 4378852736U,
|
||||
4387238528U, 4395630208U, 4404019072U, 4412407424U, 4420790656U,
|
||||
4429182848U, 4437571456U, 4445962112U, 4454344064U, 4462738048U,
|
||||
4471119232U, 4479516544U, 4487904128U, 4496289664U, 4504682368U,
|
||||
4513068416U, 4521459584U, 4529846144U, 4538232704U, 4546619776U,
|
||||
4555010176U, 4563402112U, 4571790208U, 4580174464U, 4588567936U,
|
||||
4596957056U, 4605344896U, 4613734016U, 4622119808U, 4630511488U,
|
||||
4638898816U, 4647287936U, 4655675264U, 4664065664U, 4672451968U,
|
||||
4680842624U, 4689231488U, 4697620352U, 4706007424U, 4714397056U,
|
||||
4722786176U, 4731173248U, 4739562368U, 4747951744U, 4756340608U,
|
||||
4764727936U, 4773114496U, 4781504384U, 4789894784U, 4798283648U,
|
||||
4806667648U, 4815059584U, 4823449472U, 4831835776U, 4840226176U,
|
||||
4848612224U, 4857003392U, 4865391488U, 4873780096U, 4882169728U,
|
||||
4890557312U, 4898946944U, 4907333248U, 4915722368U, 4924110976U,
|
||||
4932499328U, 4940889728U, 4949276032U, 4957666432U, 4966054784U,
|
||||
4974438016U, 4982831488U, 4991221376U, 4999607168U, 5007998848U,
|
||||
5016386432U, 5024763776U, 5033164672U, 5041544576U, 5049941888U,
|
||||
5058329728U, 5066717056U, 5075107456U, 5083494272U, 5091883904U,
|
||||
5100273536U, 5108662144U, 5117048192U, 5125436032U, 5133827456U,
|
||||
5142215296U, 5150605184U, 5158993024U, 5167382144U, 5175769472U,
|
||||
5184157568U, 5192543872U, 5200936064U, 5209324928U, 5217711232U,
|
||||
5226102656U, 5234490496U, 5242877312U, 5251263872U, 5259654016U,
|
||||
5268040832U, 5276434304U, 5284819328U, 5293209728U, 5301598592U,
|
||||
5309986688U, 5318374784U, 5326764416U, 5335151488U, 5343542144U,
|
||||
5351929472U, 5360319872U, 5368706944U, 5377096576U, 5385484928U,
|
||||
5393871232U, 5402263424U, 5410650496U, 5419040384U, 5427426944U,
|
||||
5435816576U, 5444205952U, 5452594816U, 5460981376U, 5469367936U,
|
||||
5477760896U, 5486148736U, 5494536832U, 5502925952U, 5511315328U,
|
||||
5519703424U, 5528089984U, 5536481152U, 5544869504U, 5553256064U,
|
||||
5561645696U, 5570032768U, 5578423936U, 5586811264U, 5595193216U,
|
||||
5603585408U, 5611972736U, 5620366208U, 5628750464U, 5637143936U,
|
||||
5645528192U, 5653921408U, 5662310272U, 5670694784U, 5679082624U,
|
||||
5687474048U, 5695864448U, 5704251008U, 5712641408U, 5721030272U,
|
||||
5729416832U, 5737806208U, 5746194304U, 5754583936U, 5762969984U,
|
||||
5771358592U, 5779748224U, 5788137856U, 5796527488U, 5804911232U,
|
||||
5813300608U, 5821692544U, 5830082176U, 5838468992U, 5846855552U,
|
||||
5855247488U, 5863636096U, 5872024448U, 5880411008U, 5888799872U,
|
||||
5897186432U, 5905576832U, 5913966976U, 5922352768U, 5930744704U,
|
||||
5939132288U, 5947522432U, 5955911296U, 5964299392U, 5972688256U,
|
||||
5981074304U, 5989465472U, 5997851008U, 6006241408U, 6014627968U,
|
||||
6023015552U, 6031408256U, 6039796096U, 6048185216U, 6056574848U,
|
||||
6064963456U, 6073351808U, 6081736064U, 6090128768U, 6098517632U,
|
||||
6106906496U, 6115289216U, 6123680896U, 6132070016U, 6140459648U,
|
||||
6148849024U, 6157237376U, 6165624704U, 6174009728U, 6182403712U,
|
||||
6190792064U, 6199176064U, 6207569792U, 6215952256U, 6224345216U,
|
||||
6232732544U, 6241124224U, 6249510272U, 6257899136U, 6266287744U,
|
||||
6274676864U, 6283065728U, 6291454336U, 6299843456U, 6308232064U,
|
||||
6316620928U, 6325006208U, 6333395584U, 6341784704U, 6350174848U,
|
||||
6358562176U, 6366951296U, 6375337856U, 6383729536U, 6392119168U,
|
||||
6400504192U, 6408895616U, 6417283456U, 6425673344U, 6434059136U,
|
||||
6442444672U, 6450837376U, 6459223424U, 6467613056U, 6476004224U,
|
||||
6484393088U, 6492781952U, 6501170048U, 6509555072U, 6517947008U,
|
||||
6526336384U, 6534725504U, 6543112832U, 6551500672U, 6559888768U,
|
||||
6568278656U, 6576662912U, 6585055616U, 6593443456U, 6601834112U,
|
||||
6610219648U, 6618610304U, 6626999168U, 6635385472U, 6643777408U,
|
||||
6652164224U, 6660552832U, 6668941952U, 6677330048U, 6685719424U,
|
||||
6694107776U, 6702493568U, 6710882176U, 6719274112U, 6727662976U,
|
||||
6736052096U, 6744437632U, 6752825984U, 6761213824U, 6769604224U,
|
||||
6777993856U, 6786383488U, 6794770816U, 6803158144U, 6811549312U,
|
||||
6819937664U, 6828326528U, 6836706176U, 6845101696U, 6853491328U,
|
||||
6861880448U, 6870269312U, 6878655104U, 6887046272U, 6895433344U,
|
||||
6903822208U, 6912212864U, 6920596864U, 6928988288U, 6937377152U,
|
||||
6945764992U, 6954149248U, 6962544256U, 6970928768U, 6979317376U,
|
||||
6987709312U, 6996093824U, 7004487296U, 7012875392U, 7021258624U,
|
||||
7029652352U, 7038038912U, 7046427776U, 7054818944U, 7063207808U,
|
||||
7071595136U, 7079980928U, 7088372608U, 7096759424U, 7105149824U,
|
||||
7113536896U, 7121928064U, 7130315392U, 7138699648U, 7147092352U,
|
||||
7155479168U, 7163865728U, 7172249984U, 7180648064U, 7189036672U,
|
||||
7197424768U, 7205810816U, 7214196608U, 7222589824U, 7230975104U,
|
||||
7239367552U, 7247755904U, 7256145536U, 7264533376U, 7272921472U,
|
||||
7281308032U, 7289694848U, 7298088832U, 7306471808U, 7314864512U,
|
||||
7323253888U, 7331643008U, 7340029568U, 7348419712U, 7356808832U,
|
||||
7365196672U, 7373585792U, 7381973888U, 7390362752U, 7398750592U,
|
||||
7407138944U, 7415528576U, 7423915648U, 7432302208U, 7440690304U,
|
||||
7449080192U, 7457472128U, 7465860992U, 7474249088U, 7482635648U,
|
||||
7491023744U, 7499412608U, 7507803008U, 7516192384U, 7524579968U,
|
||||
7532967296U, 7541358464U, 7549745792U, 7558134656U, 7566524032U,
|
||||
7574912896U, 7583300992U, 7591690112U, 7600075136U, 7608466816U,
|
||||
7616854912U, 7625244544U, 7633629824U, 7642020992U, 7650410368U,
|
||||
7658794112U, 7667187328U, 7675574912U, 7683961984U, 7692349568U,
|
||||
7700739712U, 7709130368U, 7717519232U, 7725905536U, 7734295424U,
|
||||
7742683264U, 7751069056U, 7759457408U, 7767849088U, 7776238208U,
|
||||
7784626816U, 7793014912U, 7801405312U, 7809792128U, 7818179968U,
|
||||
7826571136U, 7834957184U, 7843347328U, 7851732352U, 7860124544U,
|
||||
7868512384U, 7876902016U, 7885287808U, 7893679744U, 7902067072U,
|
||||
7910455936U, 7918844288U, 7927230848U, 7935622784U, 7944009344U,
|
||||
7952400256U, 7960786048U, 7969176704U, 7977565312U, 7985953408U,
|
||||
7994339968U, 8002730368U, 8011119488U, 8019508096U, 8027896192U,
|
||||
8036285056U, 8044674688U, 8053062272U, 8061448832U, 8069838464U,
|
||||
8078227328U, 8086616704U, 8095006592U, 8103393664U, 8111783552U,
|
||||
8120171392U, 8128560256U, 8136949376U, 8145336704U, 8153726848U,
|
||||
8162114944U, 8170503296U, 8178891904U, 8187280768U, 8195669632U,
|
||||
8204058496U, 8212444544U, 8220834176U, 8229222272U, 8237612672U,
|
||||
8246000768U, 8254389376U, 8262775168U, 8271167104U, 8279553664U,
|
||||
8287944064U, 8296333184U, 8304715136U, 8313108352U, 8321497984U,
|
||||
8329885568U, 8338274432U, 8346663296U, 8355052928U, 8363441536U,
|
||||
8371828352U, 8380217984U, 8388606592U, 8396996224U, 8405384576U,
|
||||
8413772672U, 8422161536U, 8430549376U, 8438939008U, 8447326592U,
|
||||
8455715456U, 8464104832U, 8472492928U, 8480882048U, 8489270656U,
|
||||
8497659776U, 8506045312U, 8514434944U, 8522823808U, 8531208832U,
|
||||
8539602304U, 8547990656U, 8556378752U, 8564768384U, 8573154176U,
|
||||
8581542784U, 8589933952U, 8598322816U, 8606705024U, 8615099264U,
|
||||
8623487872U, 8631876992U, 8640264064U, 8648653952U, 8657040256U,
|
||||
8665430656U, 8673820544U, 8682209152U, 8690592128U, 8698977152U,
|
||||
8707374464U, 8715763328U, 8724151424U, 8732540032U, 8740928384U,
|
||||
8749315712U, 8757704576U, 8766089344U, 8774480768U, 8782871936U,
|
||||
8791260032U, 8799645824U, 8808034432U, 8816426368U, 8824812928U,
|
||||
8833199488U, 8841591424U, 8849976448U, 8858366336U, 8866757248U,
|
||||
8875147136U, 8883532928U, 8891923328U, 8900306816U, 8908700288U,
|
||||
8917088384U, 8925478784U, 8933867392U, 8942250368U, 8950644608U,
|
||||
8959032704U, 8967420544U, 8975809664U, 8984197504U, 8992584064U,
|
||||
9000976256U, 9009362048U, 9017752448U, 9026141312U, 9034530688U,
|
||||
9042917504U, 9051307904U, 9059694208U, 9068084864U, 9076471424U,
|
||||
9084861824U, 9093250688U, 9101638528U, 9110027648U, 9118416512U,
|
||||
9126803584U, 9135188096U, 9143581312U, 9151969664U, 9160356224U,
|
||||
9168747136U, 9177134464U, 9185525632U, 9193910144U, 9202302848U,
|
||||
9210690688U, 9219079552U, 9227465344U, 9235854464U, 9244244864U,
|
||||
9252633472U, 9261021824U, 9269411456U, 9277799296U, 9286188928U,
|
||||
9294574208U, 9302965888U, 9311351936U, 9319740032U, 9328131968U,
|
||||
9336516736U, 9344907392U, 9353296768U, 9361685888U, 9370074752U,
|
||||
9378463616U, 9386849408U, 9395239808U, 9403629184U, 9412016512U,
|
||||
9420405376U, 9428795008U, 9437181568U, 9445570688U, 9453960832U,
|
||||
9462346624U, 9470738048U, 9479121536U, 9487515008U, 9495903616U,
|
||||
9504289664U, 9512678528U, 9521067904U, 9529456256U, 9537843584U,
|
||||
9546233728U, 9554621312U, 9563011456U, 9571398784U, 9579788672U,
|
||||
9588178304U, 9596567168U, 9604954496U, 9613343104U, 9621732992U,
|
||||
9630121856U, 9638508416U, 9646898816U, 9655283584U, 9663675776U,
|
||||
9672061312U, 9680449664U, 9688840064U, 9697230464U, 9705617536U,
|
||||
9714003584U, 9722393984U, 9730772608U, 9739172224U, 9747561088U,
|
||||
9755945344U, 9764338816U, 9772726144U, 9781116544U, 9789503872U,
|
||||
9797892992U, 9806282624U, 9814670464U, 9823056512U, 9831439232U,
|
||||
9839833984U, 9848224384U, 9856613504U, 9865000576U, 9873391232U,
|
||||
9881772416U, 9890162816U, 9898556288U, 9906940544U, 9915333248U,
|
||||
9923721088U, 9932108672U, 9940496512U, 9948888448U, 9957276544U,
|
||||
9965666176U, 9974048384U, 9982441088U, 9990830464U, 9999219584U,
|
||||
10007602816U, 10015996544U, 10024385152U, 10032774016U, 10041163648U,
|
||||
10049548928U, 10057940096U, 10066329472U, 10074717824U, 10083105152U,
|
||||
10091495296U, 10099878784U, 10108272256U, 10116660608U, 10125049216U,
|
||||
10133437312U, 10141825664U, 10150213504U, 10158601088U, 10166991232U,
|
||||
10175378816U, 10183766144U, 10192157312U, 10200545408U, 10208935552U,
|
||||
10217322112U, 10225712768U, 10234099328U, 10242489472U, 10250876032U,
|
||||
10259264896U, 10267656064U, 10276042624U, 10284429184U, 10292820352U,
|
||||
10301209472U, 10309598848U, 10317987712U, 10326375296U, 10334763392U,
|
||||
10343153536U, 10351541632U, 10359930752U, 10368318592U, 10376707456U,
|
||||
10385096576U, 10393484672U, 10401867136U, 10410262144U, 10418647424U,
|
||||
10427039104U, 10435425664U, 10443810176U, 10452203648U, 10460589952U,
|
||||
10468982144U, 10477369472U, 10485759104U, 10494147712U, 10502533504U,
|
||||
10510923392U, 10519313536U, 10527702656U, 10536091264U, 10544478592U,
|
||||
10552867712U, 10561255808U, 10569642368U, 10578032768U, 10586423168U,
|
||||
10594805632U, 10603200128U, 10611588992U, 10619976064U, 10628361344U,
|
||||
10636754048U, 10645143424U, 10653531776U, 10661920384U, 10670307968U,
|
||||
10678696832U, 10687086464U, 10695475072U, 10703863168U, 10712246144U,
|
||||
10720639616U, 10729026688U, 10737414784U, 10745806208U, 10754190976U,
|
||||
10762581376U, 10770971264U, 10779356288U, 10787747456U, 10796135552U,
|
||||
10804525184U, 10812915584U, 10821301888U, 10829692288U, 10838078336U,
|
||||
10846469248U, 10854858368U, 10863247232U, 10871631488U, 10880023424U,
|
||||
10888412032U, 10896799616U, 10905188992U, 10913574016U, 10921964672U,
|
||||
10930352768U, 10938742912U, 10947132544U, 10955518592U, 10963909504U,
|
||||
10972298368U, 10980687488U, 10989074816U, 10997462912U, 11005851776U,
|
||||
11014241152U, 11022627712U, 11031017344U, 11039403904U, 11047793024U,
|
||||
11056184704U, 11064570752U, 11072960896U, 11081343872U, 11089737856U,
|
||||
11098128256U, 11106514816U, 11114904448U, 11123293568U, 11131680128U,
|
||||
11140065152U, 11148458368U, 11156845696U, 11165236864U, 11173624192U,
|
||||
11182013824U, 11190402688U, 11198790784U, 11207179136U, 11215568768U,
|
||||
11223957376U, 11232345728U, 11240734592U, 11249122688U, 11257511296U,
|
||||
11265899648U, 11274285952U, 11282675584U, 11291065472U, 11299452544U,
|
||||
11307842432U, 11316231296U, 11324616832U, 11333009024U, 11341395584U,
|
||||
11349782656U, 11358172288U, 11366560384U, 11374950016U, 11383339648U,
|
||||
11391721856U, 11400117376U, 11408504192U, 11416893568U, 11425283456U,
|
||||
11433671552U, 11442061184U, 11450444672U, 11458837888U, 11467226752U,
|
||||
11475611776U, 11484003968U, 11492392064U, 11500780672U, 11509169024U,
|
||||
11517550976U, 11525944448U, 11534335616U, 11542724224U, 11551111808U,
|
||||
11559500672U, 11567890304U, 11576277376U, 11584667008U, 11593056128U,
|
||||
11601443456U, 11609830016U, 11618221952U, 11626607488U, 11634995072U,
|
||||
11643387776U, 11651775104U, 11660161664U, 11668552576U, 11676940928U,
|
||||
11685330304U, 11693718656U, 11702106496U, 11710496128U, 11718882688U,
|
||||
11727273088U, 11735660416U, 11744050048U, 11752437376U, 11760824704U,
|
||||
11769216128U, 11777604736U, 11785991296U, 11794381952U, 11802770048U,
|
||||
11811157888U, 11819548544U, 11827932544U, 11836324736U, 11844713344U,
|
||||
11853100928U, 11861486464U, 11869879936U, 11878268032U, 11886656896U,
|
||||
11895044992U, 11903433088U, 11911822976U, 11920210816U, 11928600448U,
|
||||
11936987264U, 11945375872U, 11953761152U, 11962151296U, 11970543488U,
|
||||
11978928512U, 11987320448U, 11995708288U, 12004095104U, 12012486272U,
|
||||
12020875136U, 12029255552U, 12037652096U, 12046039168U, 12054429568U,
|
||||
12062813824U, 12071206528U, 12079594624U, 12087983744U, 12096371072U,
|
||||
12104759936U, 12113147264U, 12121534592U, 12129924992U, 12138314624U,
|
||||
12146703232U, 12155091584U, 12163481216U, 12171864704U, 12180255872U,
|
||||
12188643968U, 12197034112U, 12205424512U, 12213811328U, 12222199424U,
|
||||
12230590336U, 12238977664U, 12247365248U, 12255755392U, 12264143488U,
|
||||
12272531584U, 12280920448U, 12289309568U, 12297694592U, 12306086528U,
|
||||
12314475392U, 12322865024U, 12331253632U, 12339640448U, 12348029312U,
|
||||
12356418944U, 12364805248U, 12373196672U, 12381580928U, 12389969024U,
|
||||
12398357632U, 12406750592U, 12415138432U, 12423527552U, 12431916416U,
|
||||
12440304512U, 12448692352U, 12457081216U, 12465467776U, 12473859968U,
|
||||
12482245504U, 12490636672U, 12499025536U, 12507411584U, 12515801728U,
|
||||
12524190592U, 12532577152U, 12540966272U, 12549354368U, 12557743232U,
|
||||
12566129536U, 12574523264U, 12582911872U, 12591299456U, 12599688064U,
|
||||
12608074624U, 12616463488U, 12624845696U, 12633239936U, 12641631616U,
|
||||
12650019968U, 12658407296U, 12666795136U, 12675183232U, 12683574656U,
|
||||
12691960192U, 12700350592U, 12708740224U, 12717128576U, 12725515904U,
|
||||
12733906816U, 12742295168U, 12750680192U, 12759071872U, 12767460736U,
|
||||
12775848832U, 12784236928U, 12792626816U, 12801014656U, 12809404288U,
|
||||
12817789312U, 12826181504U, 12834568832U, 12842954624U, 12851345792U,
|
||||
12859732352U, 12868122496U, 12876512128U, 12884901248U, 12893289088U,
|
||||
12901672832U, 12910067584U, 12918455168U, 12926842496U, 12935232896U,
|
||||
12943620736U, 12952009856U, 12960396928U, 12968786816U, 12977176192U,
|
||||
12985563776U, 12993951104U, 13002341504U, 13010730368U, 13019115392U,
|
||||
13027506304U, 13035895168U, 13044272512U, 13052673152U, 13061062528U,
|
||||
13069446272U, 13077838976U, 13086227072U, 13094613632U, 13103000192U,
|
||||
13111393664U, 13119782528U, 13128157568U, 13136559232U, 13144945024U,
|
||||
13153329536U, 13161724288U, 13170111872U, 13178502784U, 13186884736U,
|
||||
13195279744U, 13203667072U, 13212057472U, 13220445824U, 13228832128U,
|
||||
13237221248U, 13245610624U, 13254000512U, 13262388352U, 13270777472U,
|
||||
13279166336U, 13287553408U, 13295943296U, 13304331904U, 13312719488U,
|
||||
13321108096U, 13329494656U, 13337885824U, 13346274944U, 13354663808U,
|
||||
13363051136U, 13371439232U, 13379825024U, 13388210816U, 13396605056U,
|
||||
13404995456U, 13413380224U, 13421771392U, 13430159744U, 13438546048U,
|
||||
13446937216U, 13455326848U, 13463708288U, 13472103808U, 13480492672U,
|
||||
13488875648U, 13497269888U, 13505657728U, 13514045312U, 13522435712U,
|
||||
13530824576U, 13539210112U, 13547599232U, 13555989376U, 13564379008U,
|
||||
13572766336U, 13581154432U, 13589544832U, 13597932928U, 13606320512U,
|
||||
13614710656U, 13623097472U, 13631477632U, 13639874944U, 13648264064U,
|
||||
13656652928U, 13665041792U, 13673430656U, 13681818496U, 13690207616U,
|
||||
13698595712U, 13706982272U, 13715373184U, 13723762048U, 13732150144U,
|
||||
13740536704U, 13748926592U, 13757316224U, 13765700992U, 13774090112U,
|
||||
13782477952U, 13790869376U, 13799259008U, 13807647872U, 13816036736U,
|
||||
13824425344U, 13832814208U, 13841202304U, 13849591424U, 13857978752U,
|
||||
13866368896U, 13874754688U, 13883145344U, 13891533184U, 13899919232U,
|
||||
13908311168U, 13916692096U, 13925085056U, 13933473152U, 13941866368U,
|
||||
13950253696U, 13958643584U, 13967032192U, 13975417216U, 13983807616U,
|
||||
13992197504U, 14000582272U, 14008973696U, 14017363072U, 14025752192U,
|
||||
14034137984U, 14042528384U, 14050918016U, 14059301504U, 14067691648U,
|
||||
14076083584U, 14084470144U, 14092852352U, 14101249664U, 14109635968U,
|
||||
14118024832U, 14126407552U, 14134804352U, 14143188608U, 14151577984U,
|
||||
14159968384U, 14168357248U, 14176741504U, 14185127296U, 14193521024U,
|
||||
14201911424U, 14210301824U, 14218685056U, 14227067264U, 14235467392U,
|
||||
14243855488U, 14252243072U, 14260630144U, 14269021568U, 14277409408U,
|
||||
14285799296U, 14294187904U, 14302571392U, 14310961792U, 14319353728U,
|
||||
14327738752U, 14336130944U, 14344518784U, 14352906368U, 14361296512U,
|
||||
14369685376U, 14378071424U, 14386462592U, 14394848128U, 14403230848U,
|
||||
14411627392U, 14420013952U, 14428402304U, 14436793472U, 14445181568U,
|
||||
14453569664U, 14461959808U, 14470347904U, 14478737024U, 14487122816U,
|
||||
14495511424U, 14503901824U, 14512291712U, 14520677504U, 14529064832U,
|
||||
14537456768U, 14545845632U, 14554234496U, 14562618496U, 14571011456U,
|
||||
14579398784U, 14587789184U, 14596172672U, 14604564608U, 14612953984U,
|
||||
14621341312U, 14629724288U, 14638120832U, 14646503296U, 14654897536U,
|
||||
14663284864U, 14671675264U, 14680061056U, 14688447616U, 14696835968U,
|
||||
14705228416U, 14713616768U, 14722003328U, 14730392192U, 14738784128U,
|
||||
14747172736U, 14755561088U, 14763947648U, 14772336512U, 14780725376U,
|
||||
14789110144U, 14797499776U, 14805892736U, 14814276992U, 14822670208U,
|
||||
14831056256U, 14839444352U, 14847836032U, 14856222848U, 14864612992U,
|
||||
14872997504U, 14881388672U, 14889775744U, 14898165376U, 14906553472U,
|
||||
14914944896U, 14923329664U, 14931721856U, 14940109696U, 14948497024U,
|
||||
14956887424U, 14965276544U, 14973663616U, 14982053248U, 14990439808U,
|
||||
14998830976U, 15007216768U, 15015605888U, 15023995264U, 15032385152U,
|
||||
15040768384U, 15049154944U, 15057549184U, 15065939072U, 15074328448U,
|
||||
15082715008U, 15091104128U, 15099493504U, 15107879296U, 15116269184U,
|
||||
15124659584U, 15133042304U, 15141431936U, 15149824384U, 15158214272U,
|
||||
15166602368U, 15174991232U, 15183378304U, 15191760512U, 15200154496U,
|
||||
15208542592U, 15216931712U, 15225323392U, 15233708416U, 15242098048U,
|
||||
15250489216U, 15258875264U, 15267265408U, 15275654528U, 15284043136U,
|
||||
15292431488U, 15300819584U, 15309208192U, 15317596544U, 15325986176U,
|
||||
15334374784U, 15342763648U, 15351151744U, 15359540608U, 15367929728U,
|
||||
15376318336U, 15384706432U, 15393092992U, 15401481856U, 15409869952U,
|
||||
15418258816U, 15426649984U, 15435037568U, 15443425664U, 15451815296U,
|
||||
15460203392U, 15468589184U, 15476979328U, 15485369216U, 15493755776U,
|
||||
15502146944U, 15510534272U, 15518924416U, 15527311232U, 15535699072U,
|
||||
15544089472U, 15552478336U, 15560866688U, 15569254528U, 15577642624U,
|
||||
15586031488U, 15594419072U, 15602809472U, 15611199104U, 15619586432U,
|
||||
15627975296U, 15636364928U, 15644753792U, 15653141888U, 15661529216U,
|
||||
15669918848U, 15678305152U, 15686696576U, 15695083136U, 15703474048U,
|
||||
15711861632U, 15720251264U, 15728636288U, 15737027456U, 15745417088U,
|
||||
15753804928U, 15762194048U, 15770582656U, 15778971008U, 15787358336U,
|
||||
15795747712U, 15804132224U, 15812523392U, 15820909696U, 15829300096U,
|
||||
15837691264U, 15846071936U, 15854466944U, 15862855808U, 15871244672U,
|
||||
15879634816U, 15888020608U, 15896409728U, 15904799104U, 15913185152U,
|
||||
15921577088U, 15929966464U, 15938354816U, 15946743424U, 15955129472U,
|
||||
15963519872U, 15971907968U, 15980296064U, 15988684928U, 15997073024U,
|
||||
16005460864U, 16013851264U, 16022241152U, 16030629248U, 16039012736U,
|
||||
16047406976U, 16055794816U, 16064181376U, 16072571264U, 16080957824U,
|
||||
16089346688U, 16097737856U, 16106125184U, 16114514816U, 16122904192U,
|
||||
16131292544U, 16139678848U, 16148066944U, 16156453504U, 16164839552U,
|
||||
16173236096U, 16181623424U, 16190012032U, 16198401152U, 16206790528U,
|
||||
16215177344U, 16223567744U, 16231956352U, 16240344704U, 16248731008U,
|
||||
16257117824U, 16265504384U, 16273898624U, 16282281856U, 16290668672U,
|
||||
16299064192U, 16307449216U, 16315842176U, 16324230016U, 16332613504U,
|
||||
16341006464U, 16349394304U, 16357783168U, 16366172288U, 16374561664U,
|
||||
16382951296U, 16391337856U, 16399726208U, 16408116352U, 16416505472U,
|
||||
16424892032U, 16433282176U, 16441668224U, 16450058624U, 16458448768U,
|
||||
16466836864U, 16475224448U, 16483613056U, 16492001408U, 16500391808U,
|
||||
16508779648U, 16517166976U, 16525555328U, 16533944192U, 16542330752U,
|
||||
16550719616U, 16559110528U, 16567497088U, 16575888512U, 16584274816U,
|
||||
16592665472U, 16601051008U, 16609442944U, 16617832064U, 16626218624U,
|
||||
16634607488U, 16642996096U, 16651385728U, 16659773824U, 16668163712U,
|
||||
16676552576U, 16684938112U, 16693328768U, 16701718144U, 16710095488U,
|
||||
16718492288U, 16726883968U, 16735272832U, 16743661184U, 16752049792U,
|
||||
16760436608U, 16768827008U, 16777214336U, 16785599104U, 16793992832U,
|
||||
16802381696U, 16810768768U, 16819151744U, 16827542656U, 16835934848U,
|
||||
16844323712U, 16852711552U, 16861101952U, 16869489536U, 16877876864U,
|
||||
16886265728U, 16894653056U, 16903044736U, 16911431296U, 16919821696U,
|
||||
16928207488U, 16936592768U, 16944987776U, 16953375616U, 16961763968U,
|
||||
16970152832U, 16978540928U, 16986929536U, 16995319168U, 17003704448U,
|
||||
17012096896U, 17020481152U, 17028870784U, 17037262208U, 17045649536U,
|
||||
17054039936U, 17062426496U, 17070814336U, 17079205504U, 17087592064U,
|
||||
17095978112U, 17104369024U, 17112759424U, 17121147776U, 17129536384U,
|
||||
17137926016U, 17146314368U, 17154700928U, 17163089792U, 17171480192U,
|
||||
17179864192U, 17188256896U, 17196644992U, 17205033856U, 17213423488U,
|
||||
17221811072U, 17230198912U, 17238588032U, 17246976896U, 17255360384U,
|
||||
17263754624U, 17272143232U, 17280530048U, 17288918912U, 17297309312U,
|
||||
17305696384U, 17314085504U, 17322475136U, 17330863744U, 17339252096U,
|
||||
17347640192U, 17356026496U, 17364413824U, 17372796544U, 17381190016U,
|
||||
17389583488U, 17397972608U, 17406360704U, 17414748544U, 17423135872U,
|
||||
17431527296U, 17439915904U, 17448303232U, 17456691584U, 17465081728U,
|
||||
17473468288U, 17481857408U, 17490247552U, 17498635904U, 17507022464U,
|
||||
17515409024U, 17523801728U, 17532189824U, 17540577664U, 17548966016U,
|
||||
17557353344U, 17565741184U, 17574131584U, 17582519168U, 17590907008U,
|
||||
17599296128U, 17607687808U, 17616076672U, 17624455808U, 17632852352U,
|
||||
17641238656U, 17649630848U, 17658018944U, 17666403968U, 17674794112U,
|
||||
17683178368U, 17691573376U, 17699962496U, 17708350592U, 17716739968U,
|
||||
17725126528U, 17733517184U, 17741898112U, 17750293888U, 17758673024U,
|
||||
17767070336U, 17775458432U, 17783848832U, 17792236928U, 17800625536U,
|
||||
17809012352U, 17817402752U, 17825785984U, 17834178944U, 17842563968U,
|
||||
17850955648U, 17859344512U, 17867732864U, 17876119424U, 17884511872U,
|
||||
17892900224U, 17901287296U, 17909677696U, 17918058112U, 17926451072U,
|
||||
17934843776U, 17943230848U, 17951609216U, 17960008576U, 17968397696U,
|
||||
17976784256U, 17985175424U, 17993564032U, 18001952128U, 18010339712U,
|
||||
18018728576U, 18027116672U, 18035503232U, 18043894144U, 18052283264U,
|
||||
18060672128U, 18069056384U, 18077449856U, 18085837184U, 18094225792U,
|
||||
18102613376U, 18111004544U, 18119388544U, 18127781248U, 18136170368U,
|
||||
18144558976U, 18152947328U, 18161336192U, 18169724288U, 18178108544U,
|
||||
18186498944U, 18194886784U, 18203275648U, 18211666048U, 18220048768U,
|
||||
18228444544U, 18236833408U, 18245220736U
|
||||
};
|
||||
|
||||
|
||||
// Generated with the following Mathematica Code:
|
||||
|
||||
// GetCacheSizes[n_] := Module[{
|
||||
// DataSetSizeBytesInit = 2^30,
|
||||
// MixBytes = 128,
|
||||
// DataSetGrowth = 2^23,
|
||||
// HashBytes = 64,
|
||||
// CacheMultiplier = 1024,
|
||||
// j = 0},
|
||||
// Reap[
|
||||
// While[j < n,
|
||||
// Module[{i = Floor[(DataSetSizeBytesInit + DataSetGrowth * j) / (CacheMultiplier * HashBytes)]},
|
||||
// While[! PrimeQ[i], i--];
|
||||
// Sow[i*HashBytes]; j++]]]][[2]][[1]]
|
||||
|
||||
const uint64_t cache_sizes[2048] = {
|
||||
16776896U, 16907456U, 17039296U, 17170112U, 17301056U, 17432512U, 17563072U,
|
||||
17693888U, 17824192U, 17955904U, 18087488U, 18218176U, 18349504U, 18481088U,
|
||||
18611392U, 18742336U, 18874304U, 19004224U, 19135936U, 19267264U, 19398208U,
|
||||
19529408U, 19660096U, 19791424U, 19922752U, 20053952U, 20184896U, 20315968U,
|
||||
20446912U, 20576576U, 20709184U, 20840384U, 20971072U, 21102272U, 21233216U,
|
||||
21364544U, 21494848U, 21626816U, 21757376U, 21887552U, 22019392U, 22151104U,
|
||||
22281536U, 22412224U, 22543936U, 22675264U, 22806464U, 22935872U, 23068096U,
|
||||
23198272U, 23330752U, 23459008U, 23592512U, 23723968U, 23854912U, 23986112U,
|
||||
24116672U, 24247616U, 24378688U, 24509504U, 24640832U, 24772544U, 24903488U,
|
||||
25034432U, 25165376U, 25296704U, 25427392U, 25558592U, 25690048U, 25820096U,
|
||||
25951936U, 26081728U, 26214208U, 26345024U, 26476096U, 26606656U, 26737472U,
|
||||
26869184U, 26998208U, 27131584U, 27262528U, 27393728U, 27523904U, 27655744U,
|
||||
27786688U, 27917888U, 28049344U, 28179904U, 28311488U, 28441792U, 28573504U,
|
||||
28700864U, 28835648U, 28966208U, 29096768U, 29228608U, 29359808U, 29490752U,
|
||||
29621824U, 29752256U, 29882816U, 30014912U, 30144448U, 30273728U, 30406976U,
|
||||
30538432U, 30670784U, 30799936U, 30932672U, 31063744U, 31195072U, 31325248U,
|
||||
31456192U, 31588288U, 31719232U, 31850432U, 31981504U, 32110784U, 32243392U,
|
||||
32372672U, 32505664U, 32636608U, 32767808U, 32897344U, 33029824U, 33160768U,
|
||||
33289664U, 33423296U, 33554368U, 33683648U, 33816512U, 33947456U, 34076992U,
|
||||
34208704U, 34340032U, 34471744U, 34600256U, 34734016U, 34864576U, 34993984U,
|
||||
35127104U, 35258176U, 35386688U, 35518528U, 35650624U, 35782336U, 35910976U,
|
||||
36044608U, 36175808U, 36305728U, 36436672U, 36568384U, 36699968U, 36830656U,
|
||||
36961984U, 37093312U, 37223488U, 37355072U, 37486528U, 37617472U, 37747904U,
|
||||
37879232U, 38009792U, 38141888U, 38272448U, 38403392U, 38535104U, 38660672U,
|
||||
38795584U, 38925632U, 39059264U, 39190336U, 39320768U, 39452096U, 39581632U,
|
||||
39713984U, 39844928U, 39974848U, 40107968U, 40238144U, 40367168U, 40500032U,
|
||||
40631744U, 40762816U, 40894144U, 41023552U, 41155904U, 41286208U, 41418304U,
|
||||
41547712U, 41680448U, 41811904U, 41942848U, 42073792U, 42204992U, 42334912U,
|
||||
42467008U, 42597824U, 42729152U, 42860096U, 42991552U, 43122368U, 43253696U,
|
||||
43382848U, 43515712U, 43646912U, 43777088U, 43907648U, 44039104U, 44170432U,
|
||||
44302144U, 44433344U, 44564288U, 44694976U, 44825152U, 44956864U, 45088448U,
|
||||
45219008U, 45350464U, 45481024U, 45612608U, 45744064U, 45874496U, 46006208U,
|
||||
46136768U, 46267712U, 46399424U, 46529344U, 46660672U, 46791488U, 46923328U,
|
||||
47053504U, 47185856U, 47316928U, 47447872U, 47579072U, 47710144U, 47839936U,
|
||||
47971648U, 48103232U, 48234176U, 48365248U, 48496192U, 48627136U, 48757312U,
|
||||
48889664U, 49020736U, 49149248U, 49283008U, 49413824U, 49545152U, 49675712U,
|
||||
49807168U, 49938368U, 50069056U, 50200256U, 50331584U, 50462656U, 50593472U,
|
||||
50724032U, 50853952U, 50986048U, 51117632U, 51248576U, 51379904U, 51510848U,
|
||||
51641792U, 51773248U, 51903296U, 52035136U, 52164032U, 52297664U, 52427968U,
|
||||
52557376U, 52690112U, 52821952U, 52952896U, 53081536U, 53213504U, 53344576U,
|
||||
53475776U, 53608384U, 53738816U, 53870528U, 54000832U, 54131776U, 54263744U,
|
||||
54394688U, 54525248U, 54655936U, 54787904U, 54918592U, 55049152U, 55181248U,
|
||||
55312064U, 55442752U, 55574336U, 55705024U, 55836224U, 55967168U, 56097856U,
|
||||
56228672U, 56358592U, 56490176U, 56621888U, 56753728U, 56884928U, 57015488U,
|
||||
57146816U, 57278272U, 57409216U, 57540416U, 57671104U, 57802432U, 57933632U,
|
||||
58064576U, 58195264U, 58326976U, 58457408U, 58588864U, 58720192U, 58849984U,
|
||||
58981696U, 59113024U, 59243456U, 59375552U, 59506624U, 59637568U, 59768512U,
|
||||
59897792U, 60030016U, 60161984U, 60293056U, 60423872U, 60554432U, 60683968U,
|
||||
60817216U, 60948032U, 61079488U, 61209664U, 61341376U, 61471936U, 61602752U,
|
||||
61733696U, 61865792U, 61996736U, 62127808U, 62259136U, 62389568U, 62520512U,
|
||||
62651584U, 62781632U, 62910784U, 63045056U, 63176128U, 63307072U, 63438656U,
|
||||
63569216U, 63700928U, 63831616U, 63960896U, 64093888U, 64225088U, 64355392U,
|
||||
64486976U, 64617664U, 64748608U, 64879424U, 65009216U, 65142464U, 65273792U,
|
||||
65402816U, 65535424U, 65666752U, 65797696U, 65927744U, 66060224U, 66191296U,
|
||||
66321344U, 66453056U, 66584384U, 66715328U, 66846656U, 66977728U, 67108672U,
|
||||
67239104U, 67370432U, 67501888U, 67631296U, 67763776U, 67895104U, 68026304U,
|
||||
68157248U, 68287936U, 68419264U, 68548288U, 68681408U, 68811968U, 68942912U,
|
||||
69074624U, 69205568U, 69337024U, 69467584U, 69599168U, 69729472U, 69861184U,
|
||||
69989824U, 70122944U, 70253888U, 70385344U, 70515904U, 70647232U, 70778816U,
|
||||
70907968U, 71040832U, 71171648U, 71303104U, 71432512U, 71564992U, 71695168U,
|
||||
71826368U, 71958464U, 72089536U, 72219712U, 72350144U, 72482624U, 72613568U,
|
||||
72744512U, 72875584U, 73006144U, 73138112U, 73268672U, 73400128U, 73530944U,
|
||||
73662272U, 73793344U, 73924544U, 74055104U, 74185792U, 74316992U, 74448832U,
|
||||
74579392U, 74710976U, 74841664U, 74972864U, 75102784U, 75233344U, 75364544U,
|
||||
75497024U, 75627584U, 75759296U, 75890624U, 76021696U, 76152256U, 76283072U,
|
||||
76414144U, 76545856U, 76676672U, 76806976U, 76937792U, 77070016U, 77200832U,
|
||||
77331392U, 77462464U, 77593664U, 77725376U, 77856448U, 77987776U, 78118336U,
|
||||
78249664U, 78380992U, 78511424U, 78642496U, 78773056U, 78905152U, 79033664U,
|
||||
79166656U, 79297472U, 79429568U, 79560512U, 79690816U, 79822784U, 79953472U,
|
||||
80084672U, 80214208U, 80346944U, 80477632U, 80608576U, 80740288U, 80870848U,
|
||||
81002048U, 81133504U, 81264448U, 81395648U, 81525952U, 81657536U, 81786304U,
|
||||
81919808U, 82050112U, 82181312U, 82311616U, 82443968U, 82573376U, 82705984U,
|
||||
82835776U, 82967744U, 83096768U, 83230528U, 83359552U, 83491264U, 83622464U,
|
||||
83753536U, 83886016U, 84015296U, 84147776U, 84277184U, 84409792U, 84540608U,
|
||||
84672064U, 84803008U, 84934336U, 85065152U, 85193792U, 85326784U, 85458496U,
|
||||
85589312U, 85721024U, 85851968U, 85982656U, 86112448U, 86244416U, 86370112U,
|
||||
86506688U, 86637632U, 86769344U, 86900672U, 87031744U, 87162304U, 87293632U,
|
||||
87424576U, 87555392U, 87687104U, 87816896U, 87947968U, 88079168U, 88211264U,
|
||||
88341824U, 88473152U, 88603712U, 88735424U, 88862912U, 88996672U, 89128384U,
|
||||
89259712U, 89390272U, 89521984U, 89652544U, 89783872U, 89914816U, 90045376U,
|
||||
90177088U, 90307904U, 90438848U, 90569152U, 90700096U, 90832832U, 90963776U,
|
||||
91093696U, 91223744U, 91356992U, 91486784U, 91618496U, 91749824U, 91880384U,
|
||||
92012224U, 92143552U, 92273344U, 92405696U, 92536768U, 92666432U, 92798912U,
|
||||
92926016U, 93060544U, 93192128U, 93322816U, 93453632U, 93583936U, 93715136U,
|
||||
93845056U, 93977792U, 94109504U, 94240448U, 94371776U, 94501184U, 94632896U,
|
||||
94764224U, 94895552U, 95023424U, 95158208U, 95287744U, 95420224U, 95550016U,
|
||||
95681216U, 95811904U, 95943872U, 96075328U, 96203584U, 96337856U, 96468544U,
|
||||
96599744U, 96731072U, 96860992U, 96992576U, 97124288U, 97254848U, 97385536U,
|
||||
97517248U, 97647808U, 97779392U, 97910464U, 98041408U, 98172608U, 98303168U,
|
||||
98434496U, 98565568U, 98696768U, 98827328U, 98958784U, 99089728U, 99220928U,
|
||||
99352384U, 99482816U, 99614272U, 99745472U, 99876416U, 100007104U,
|
||||
100138048U, 100267072U, 100401088U, 100529984U, 100662592U, 100791872U,
|
||||
100925248U, 101056064U, 101187392U, 101317952U, 101449408U, 101580608U,
|
||||
101711296U, 101841728U, 101973824U, 102104896U, 102235712U, 102366016U,
|
||||
102498112U, 102628672U, 102760384U, 102890432U, 103021888U, 103153472U,
|
||||
103284032U, 103415744U, 103545152U, 103677248U, 103808576U, 103939648U,
|
||||
104070976U, 104201792U, 104332736U, 104462528U, 104594752U, 104725952U,
|
||||
104854592U, 104988608U, 105118912U, 105247808U, 105381184U, 105511232U,
|
||||
105643072U, 105774784U, 105903296U, 106037056U, 106167872U, 106298944U,
|
||||
106429504U, 106561472U, 106691392U, 106822592U, 106954304U, 107085376U,
|
||||
107216576U, 107346368U, 107478464U, 107609792U, 107739712U, 107872192U,
|
||||
108003136U, 108131392U, 108265408U, 108396224U, 108527168U, 108657344U,
|
||||
108789568U, 108920384U, 109049792U, 109182272U, 109312576U, 109444928U,
|
||||
109572928U, 109706944U, 109837888U, 109969088U, 110099648U, 110230976U,
|
||||
110362432U, 110492992U, 110624704U, 110755264U, 110886208U, 111017408U,
|
||||
111148864U, 111279296U, 111410752U, 111541952U, 111673024U, 111803456U,
|
||||
111933632U, 112066496U, 112196416U, 112328512U, 112457792U, 112590784U,
|
||||
112715968U, 112852672U, 112983616U, 113114944U, 113244224U, 113376448U,
|
||||
113505472U, 113639104U, 113770304U, 113901376U, 114031552U, 114163264U,
|
||||
114294592U, 114425536U, 114556864U, 114687424U, 114818624U, 114948544U,
|
||||
115080512U, 115212224U, 115343296U, 115473472U, 115605184U, 115736128U,
|
||||
115867072U, 115997248U, 116128576U, 116260288U, 116391488U, 116522944U,
|
||||
116652992U, 116784704U, 116915648U, 117046208U, 117178304U, 117308608U,
|
||||
117440192U, 117569728U, 117701824U, 117833024U, 117964096U, 118094656U,
|
||||
118225984U, 118357312U, 118489024U, 118617536U, 118749632U, 118882112U,
|
||||
119012416U, 119144384U, 119275328U, 119406016U, 119537344U, 119668672U,
|
||||
119798464U, 119928896U, 120061376U, 120192832U, 120321728U, 120454336U,
|
||||
120584512U, 120716608U, 120848192U, 120979136U, 121109056U, 121241408U,
|
||||
121372352U, 121502912U, 121634752U, 121764416U, 121895744U, 122027072U,
|
||||
122157632U, 122289088U, 122421184U, 122550592U, 122682944U, 122813888U,
|
||||
122945344U, 123075776U, 123207488U, 123338048U, 123468736U, 123600704U,
|
||||
123731264U, 123861952U, 123993664U, 124124608U, 124256192U, 124386368U,
|
||||
124518208U, 124649024U, 124778048U, 124911296U, 125041088U, 125173696U,
|
||||
125303744U, 125432896U, 125566912U, 125696576U, 125829056U, 125958592U,
|
||||
126090304U, 126221248U, 126352832U, 126483776U, 126615232U, 126746432U,
|
||||
126876608U, 127008704U, 127139392U, 127270336U, 127401152U, 127532224U,
|
||||
127663552U, 127794752U, 127925696U, 128055232U, 128188096U, 128319424U,
|
||||
128449856U, 128581312U, 128712256U, 128843584U, 128973632U, 129103808U,
|
||||
129236288U, 129365696U, 129498944U, 129629888U, 129760832U, 129892288U,
|
||||
130023104U, 130154048U, 130283968U, 130416448U, 130547008U, 130678336U,
|
||||
130807616U, 130939456U, 131071552U, 131202112U, 131331776U, 131464384U,
|
||||
131594048U, 131727296U, 131858368U, 131987392U, 132120256U, 132250816U,
|
||||
132382528U, 132513728U, 132644672U, 132774976U, 132905792U, 133038016U,
|
||||
133168832U, 133299392U, 133429312U, 133562048U, 133692992U, 133823296U,
|
||||
133954624U, 134086336U, 134217152U, 134348608U, 134479808U, 134607296U,
|
||||
134741056U, 134872384U, 135002944U, 135134144U, 135265472U, 135396544U,
|
||||
135527872U, 135659072U, 135787712U, 135921472U, 136052416U, 136182848U,
|
||||
136313792U, 136444864U, 136576448U, 136707904U, 136837952U, 136970048U,
|
||||
137099584U, 137232064U, 137363392U, 137494208U, 137625536U, 137755712U,
|
||||
137887424U, 138018368U, 138149824U, 138280256U, 138411584U, 138539584U,
|
||||
138672832U, 138804928U, 138936128U, 139066688U, 139196864U, 139328704U,
|
||||
139460032U, 139590208U, 139721024U, 139852864U, 139984576U, 140115776U,
|
||||
140245696U, 140376512U, 140508352U, 140640064U, 140769856U, 140902336U,
|
||||
141032768U, 141162688U, 141294016U, 141426496U, 141556544U, 141687488U,
|
||||
141819584U, 141949888U, 142080448U, 142212544U, 142342336U, 142474432U,
|
||||
142606144U, 142736192U, 142868288U, 142997824U, 143129408U, 143258944U,
|
||||
143392448U, 143523136U, 143653696U, 143785024U, 143916992U, 144045632U,
|
||||
144177856U, 144309184U, 144440768U, 144570688U, 144701888U, 144832448U,
|
||||
144965056U, 145096384U, 145227584U, 145358656U, 145489856U, 145620928U,
|
||||
145751488U, 145883072U, 146011456U, 146144704U, 146275264U, 146407232U,
|
||||
146538176U, 146668736U, 146800448U, 146931392U, 147062336U, 147193664U,
|
||||
147324224U, 147455936U, 147586624U, 147717056U, 147848768U, 147979456U,
|
||||
148110784U, 148242368U, 148373312U, 148503232U, 148635584U, 148766144U,
|
||||
148897088U, 149028416U, 149159488U, 149290688U, 149420224U, 149551552U,
|
||||
149683136U, 149814976U, 149943616U, 150076352U, 150208064U, 150338624U,
|
||||
150470464U, 150600256U, 150732224U, 150862784U, 150993088U, 151125952U,
|
||||
151254976U, 151388096U, 151519168U, 151649728U, 151778752U, 151911104U,
|
||||
152042944U, 152174144U, 152304704U, 152435648U, 152567488U, 152698816U,
|
||||
152828992U, 152960576U, 153091648U, 153222976U, 153353792U, 153484096U,
|
||||
153616192U, 153747008U, 153878336U, 154008256U, 154139968U, 154270912U,
|
||||
154402624U, 154533824U, 154663616U, 154795712U, 154926272U, 155057984U,
|
||||
155188928U, 155319872U, 155450816U, 155580608U, 155712064U, 155843392U,
|
||||
155971136U, 156106688U, 156237376U, 156367424U, 156499264U, 156630976U,
|
||||
156761536U, 156892352U, 157024064U, 157155008U, 157284416U, 157415872U,
|
||||
157545536U, 157677248U, 157810496U, 157938112U, 158071744U, 158203328U,
|
||||
158334656U, 158464832U, 158596288U, 158727616U, 158858048U, 158988992U,
|
||||
159121216U, 159252416U, 159381568U, 159513152U, 159645632U, 159776192U,
|
||||
159906496U, 160038464U, 160169536U, 160300352U, 160430656U, 160563008U,
|
||||
160693952U, 160822208U, 160956352U, 161086784U, 161217344U, 161349184U,
|
||||
161480512U, 161611456U, 161742272U, 161873216U, 162002752U, 162135872U,
|
||||
162266432U, 162397888U, 162529216U, 162660032U, 162790976U, 162922048U,
|
||||
163052096U, 163184576U, 163314752U, 163446592U, 163577408U, 163707968U,
|
||||
163839296U, 163969984U, 164100928U, 164233024U, 164364224U, 164494912U,
|
||||
164625856U, 164756672U, 164887616U, 165019072U, 165150016U, 165280064U,
|
||||
165412672U, 165543104U, 165674944U, 165805888U, 165936832U, 166067648U,
|
||||
166198336U, 166330048U, 166461248U, 166591552U, 166722496U, 166854208U,
|
||||
166985408U, 167116736U, 167246656U, 167378368U, 167508416U, 167641024U,
|
||||
167771584U, 167903168U, 168034112U, 168164032U, 168295744U, 168427456U,
|
||||
168557632U, 168688448U, 168819136U, 168951616U, 169082176U, 169213504U,
|
||||
169344832U, 169475648U, 169605952U, 169738048U, 169866304U, 169999552U,
|
||||
170131264U, 170262464U, 170393536U, 170524352U, 170655424U, 170782016U,
|
||||
170917696U, 171048896U, 171179072U, 171310784U, 171439936U, 171573184U,
|
||||
171702976U, 171835072U, 171966272U, 172097216U, 172228288U, 172359232U,
|
||||
172489664U, 172621376U, 172747712U, 172883264U, 173014208U, 173144512U,
|
||||
173275072U, 173407424U, 173539136U, 173669696U, 173800768U, 173931712U,
|
||||
174063424U, 174193472U, 174325696U, 174455744U, 174586816U, 174718912U,
|
||||
174849728U, 174977728U, 175109696U, 175242688U, 175374272U, 175504832U,
|
||||
175636288U, 175765696U, 175898432U, 176028992U, 176159936U, 176291264U,
|
||||
176422592U, 176552512U, 176684864U, 176815424U, 176946496U, 177076544U,
|
||||
177209152U, 177340096U, 177470528U, 177600704U, 177731648U, 177864256U,
|
||||
177994816U, 178126528U, 178257472U, 178387648U, 178518464U, 178650176U,
|
||||
178781888U, 178912064U, 179044288U, 179174848U, 179305024U, 179436736U,
|
||||
179568448U, 179698496U, 179830208U, 179960512U, 180092608U, 180223808U,
|
||||
180354752U, 180485696U, 180617152U, 180748096U, 180877504U, 181009984U,
|
||||
181139264U, 181272512U, 181402688U, 181532608U, 181663168U, 181795136U,
|
||||
181926592U, 182057536U, 182190016U, 182320192U, 182451904U, 182582336U,
|
||||
182713792U, 182843072U, 182976064U, 183107264U, 183237056U, 183368384U,
|
||||
183494848U, 183631424U, 183762752U, 183893824U, 184024768U, 184154816U,
|
||||
184286656U, 184417984U, 184548928U, 184680128U, 184810816U, 184941248U,
|
||||
185072704U, 185203904U, 185335616U, 185465408U, 185596352U, 185727296U,
|
||||
185859904U, 185989696U, 186121664U, 186252992U, 186383552U, 186514112U,
|
||||
186645952U, 186777152U, 186907328U, 187037504U, 187170112U, 187301824U,
|
||||
187429184U, 187562048U, 187693504U, 187825472U, 187957184U, 188087104U,
|
||||
188218304U, 188349376U, 188481344U, 188609728U, 188743616U, 188874304U,
|
||||
189005248U, 189136448U, 189265088U, 189396544U, 189528128U, 189660992U,
|
||||
189791936U, 189923264U, 190054208U, 190182848U, 190315072U, 190447424U,
|
||||
190577984U, 190709312U, 190840768U, 190971328U, 191102656U, 191233472U,
|
||||
191364032U, 191495872U, 191626816U, 191758016U, 191888192U, 192020288U,
|
||||
192148928U, 192282176U, 192413504U, 192542528U, 192674752U, 192805952U,
|
||||
192937792U, 193068608U, 193198912U, 193330496U, 193462208U, 193592384U,
|
||||
193723456U, 193854272U, 193985984U, 194116672U, 194247232U, 194379712U,
|
||||
194508352U, 194641856U, 194772544U, 194900672U, 195035072U, 195166016U,
|
||||
195296704U, 195428032U, 195558592U, 195690304U, 195818176U, 195952576U,
|
||||
196083392U, 196214336U, 196345792U, 196476736U, 196607552U, 196739008U,
|
||||
196869952U, 197000768U, 197130688U, 197262784U, 197394368U, 197523904U,
|
||||
197656384U, 197787584U, 197916608U, 198049472U, 198180544U, 198310208U,
|
||||
198442432U, 198573632U, 198705088U, 198834368U, 198967232U, 199097792U,
|
||||
199228352U, 199360192U, 199491392U, 199621696U, 199751744U, 199883968U,
|
||||
200014016U, 200146624U, 200276672U, 200408128U, 200540096U, 200671168U,
|
||||
200801984U, 200933312U, 201062464U, 201194944U, 201326144U, 201457472U,
|
||||
201588544U, 201719744U, 201850816U, 201981632U, 202111552U, 202244032U,
|
||||
202374464U, 202505152U, 202636352U, 202767808U, 202898368U, 203030336U,
|
||||
203159872U, 203292608U, 203423296U, 203553472U, 203685824U, 203816896U,
|
||||
203947712U, 204078272U, 204208192U, 204341056U, 204472256U, 204603328U,
|
||||
204733888U, 204864448U, 204996544U, 205125568U, 205258304U, 205388864U,
|
||||
205517632U, 205650112U, 205782208U, 205913536U, 206044736U, 206176192U,
|
||||
206307008U, 206434496U, 206569024U, 206700224U, 206831168U, 206961856U,
|
||||
207093056U, 207223616U, 207355328U, 207486784U, 207616832U, 207749056U,
|
||||
207879104U, 208010048U, 208141888U, 208273216U, 208404032U, 208534336U,
|
||||
208666048U, 208796864U, 208927424U, 209059264U, 209189824U, 209321792U,
|
||||
209451584U, 209582656U, 209715136U, 209845568U, 209976896U, 210106432U,
|
||||
210239296U, 210370112U, 210501568U, 210630976U, 210763712U, 210894272U,
|
||||
211024832U, 211156672U, 211287616U, 211418176U, 211549376U, 211679296U,
|
||||
211812032U, 211942592U, 212074432U, 212204864U, 212334016U, 212467648U,
|
||||
212597824U, 212727616U, 212860352U, 212991424U, 213120832U, 213253952U,
|
||||
213385024U, 213515584U, 213645632U, 213777728U, 213909184U, 214040128U,
|
||||
214170688U, 214302656U, 214433728U, 214564544U, 214695232U, 214826048U,
|
||||
214956992U, 215089088U, 215219776U, 215350592U, 215482304U, 215613248U,
|
||||
215743552U, 215874752U, 216005312U, 216137024U, 216267328U, 216399296U,
|
||||
216530752U, 216661696U, 216790592U, 216923968U, 217054528U, 217183168U,
|
||||
217316672U, 217448128U, 217579072U, 217709504U, 217838912U, 217972672U,
|
||||
218102848U, 218233024U, 218364736U, 218496832U, 218627776U, 218759104U,
|
||||
218888896U, 219021248U, 219151936U, 219281728U, 219413056U, 219545024U,
|
||||
219675968U, 219807296U, 219938624U, 220069312U, 220200128U, 220331456U,
|
||||
220461632U, 220592704U, 220725184U, 220855744U, 220987072U, 221117888U,
|
||||
221249216U, 221378368U, 221510336U, 221642048U, 221772736U, 221904832U,
|
||||
222031808U, 222166976U, 222297536U, 222428992U, 222559936U, 222690368U,
|
||||
222820672U, 222953152U, 223083968U, 223213376U, 223345984U, 223476928U,
|
||||
223608512U, 223738688U, 223869376U, 224001472U, 224132672U, 224262848U,
|
||||
224394944U, 224524864U, 224657344U, 224788288U, 224919488U, 225050432U,
|
||||
225181504U, 225312704U, 225443776U, 225574592U, 225704768U, 225834176U,
|
||||
225966784U, 226097216U, 226229824U, 226360384U, 226491712U, 226623424U,
|
||||
226754368U, 226885312U, 227015104U, 227147456U, 227278528U, 227409472U,
|
||||
227539904U, 227669696U, 227802944U, 227932352U, 228065216U, 228196288U,
|
||||
228326464U, 228457792U, 228588736U, 228720064U, 228850112U, 228981056U,
|
||||
229113152U, 229243328U, 229375936U, 229505344U, 229636928U, 229769152U,
|
||||
229894976U, 230030272U, 230162368U, 230292416U, 230424512U, 230553152U,
|
||||
230684864U, 230816704U, 230948416U, 231079616U, 231210944U, 231342016U,
|
||||
231472448U, 231603776U, 231733952U, 231866176U, 231996736U, 232127296U,
|
||||
232259392U, 232388672U, 232521664U, 232652608U, 232782272U, 232914496U,
|
||||
233043904U, 233175616U, 233306816U, 233438528U, 233569984U, 233699776U,
|
||||
233830592U, 233962688U, 234092224U, 234221888U, 234353984U, 234485312U,
|
||||
234618304U, 234749888U, 234880832U, 235011776U, 235142464U, 235274048U,
|
||||
235403456U, 235535936U, 235667392U, 235797568U, 235928768U, 236057152U,
|
||||
236190272U, 236322752U, 236453312U, 236583616U, 236715712U, 236846528U,
|
||||
236976448U, 237108544U, 237239104U, 237371072U, 237501632U, 237630784U,
|
||||
237764416U, 237895232U, 238026688U, 238157632U, 238286912U, 238419392U,
|
||||
238548032U, 238681024U, 238812608U, 238941632U, 239075008U, 239206336U,
|
||||
239335232U, 239466944U, 239599168U, 239730496U, 239861312U, 239992384U,
|
||||
240122816U, 240254656U, 240385856U, 240516928U, 240647872U, 240779072U,
|
||||
240909632U, 241040704U, 241171904U, 241302848U, 241433408U, 241565248U,
|
||||
241696192U, 241825984U, 241958848U, 242088256U, 242220224U, 242352064U,
|
||||
242481856U, 242611648U, 242744896U, 242876224U, 243005632U, 243138496U,
|
||||
243268672U, 243400384U, 243531712U, 243662656U, 243793856U, 243924544U,
|
||||
244054592U, 244187072U, 244316608U, 244448704U, 244580032U, 244710976U,
|
||||
244841536U, 244972864U, 245104448U, 245233984U, 245365312U, 245497792U,
|
||||
245628736U, 245759936U, 245889856U, 246021056U, 246152512U, 246284224U,
|
||||
246415168U, 246545344U, 246675904U, 246808384U, 246939584U, 247070144U,
|
||||
247199552U, 247331648U, 247463872U, 247593536U, 247726016U, 247857088U,
|
||||
247987648U, 248116928U, 248249536U, 248380736U, 248512064U, 248643008U,
|
||||
248773312U, 248901056U, 249036608U, 249167552U, 249298624U, 249429184U,
|
||||
249560512U, 249692096U, 249822784U, 249954112U, 250085312U, 250215488U,
|
||||
250345792U, 250478528U, 250608704U, 250739264U, 250870976U, 251002816U,
|
||||
251133632U, 251263552U, 251395136U, 251523904U, 251657792U, 251789248U,
|
||||
251919424U, 252051392U, 252182464U, 252313408U, 252444224U, 252575552U,
|
||||
252706624U, 252836032U, 252968512U, 253099712U, 253227584U, 253361728U,
|
||||
253493056U, 253623488U, 253754432U, 253885504U, 254017216U, 254148032U,
|
||||
254279488U, 254410432U, 254541376U, 254672576U, 254803264U, 254933824U,
|
||||
255065792U, 255196736U, 255326528U, 255458752U, 255589952U, 255721408U,
|
||||
255851072U, 255983296U, 256114624U, 256244416U, 256374208U, 256507712U,
|
||||
256636096U, 256768832U, 256900544U, 257031616U, 257162176U, 257294272U,
|
||||
257424448U, 257555776U, 257686976U, 257818432U, 257949632U, 258079552U,
|
||||
258211136U, 258342464U, 258473408U, 258603712U, 258734656U, 258867008U,
|
||||
258996544U, 259127744U, 259260224U, 259391296U, 259522112U, 259651904U,
|
||||
259784384U, 259915328U, 260045888U, 260175424U, 260308544U, 260438336U,
|
||||
260570944U, 260700992U, 260832448U, 260963776U, 261092672U, 261226304U,
|
||||
261356864U, 261487936U, 261619648U, 261750592U, 261879872U, 262011968U,
|
||||
262143424U, 262274752U, 262404416U, 262537024U, 262667968U, 262799296U,
|
||||
262928704U, 263061184U, 263191744U, 263322944U, 263454656U, 263585216U,
|
||||
263716672U, 263847872U, 263978944U, 264108608U, 264241088U, 264371648U,
|
||||
264501184U, 264632768U, 264764096U, 264895936U, 265024576U, 265158464U,
|
||||
265287488U, 265418432U, 265550528U, 265681216U, 265813312U, 265943488U,
|
||||
266075968U, 266206144U, 266337728U, 266468032U, 266600384U, 266731072U,
|
||||
266862272U, 266993344U, 267124288U, 267255616U, 267386432U, 267516992U,
|
||||
267648704U, 267777728U, 267910592U, 268040512U, 268172096U, 268302784U,
|
||||
268435264U, 268566208U, 268696256U, 268828096U, 268959296U, 269090368U,
|
||||
269221312U, 269352256U, 269482688U, 269614784U, 269745856U, 269876416U,
|
||||
270007616U, 270139328U, 270270272U, 270401216U, 270531904U, 270663616U,
|
||||
270791744U, 270924736U, 271056832U, 271186112U, 271317184U, 271449536U,
|
||||
271580992U, 271711936U, 271843136U, 271973056U, 272105408U, 272236352U,
|
||||
272367296U, 272498368U, 272629568U, 272759488U, 272891456U, 273022784U,
|
||||
273153856U, 273284672U, 273415616U, 273547072U, 273677632U, 273808448U,
|
||||
273937088U, 274071488U, 274200896U, 274332992U, 274463296U, 274595392U,
|
||||
274726208U, 274857536U, 274988992U, 275118656U, 275250496U, 275382208U,
|
||||
275513024U, 275643968U, 275775296U, 275906368U, 276037184U, 276167872U,
|
||||
276297664U, 276429376U, 276560576U, 276692672U, 276822976U, 276955072U,
|
||||
277085632U, 277216832U, 277347008U, 277478848U, 277609664U, 277740992U,
|
||||
277868608U, 278002624U, 278134336U, 278265536U, 278395328U, 278526784U,
|
||||
278657728U, 278789824U, 278921152U, 279052096U, 279182912U, 279313088U,
|
||||
279443776U, 279576256U, 279706048U, 279838528U, 279969728U, 280099648U,
|
||||
280230976U, 280361408U, 280493632U, 280622528U, 280755392U, 280887104U,
|
||||
281018176U, 281147968U, 281278912U, 281411392U, 281542592U, 281673152U,
|
||||
281803712U, 281935552U, 282066496U, 282197312U, 282329024U, 282458816U,
|
||||
282590272U, 282720832U, 282853184U, 282983744U, 283115072U, 283246144U,
|
||||
283377344U, 283508416U, 283639744U, 283770304U, 283901504U, 284032576U,
|
||||
284163136U, 284294848U, 284426176U, 284556992U, 284687296U, 284819264U,
|
||||
284950208U, 285081536U
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
77
src/3rdparty/libethash/endian.h
vendored
Normal file
77
src/3rdparty/libethash/endian.h
vendored
Normal file
|
@ -0,0 +1,77 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(__MINGW32__) || defined(_WIN32)
|
||||
# define LITTLE_ENDIAN 1234
|
||||
# define BYTE_ORDER LITTLE_ENDIAN
|
||||
#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
|
||||
# include <sys/endian.h>
|
||||
#elif defined(__OpenBSD__) || defined(__SVR4)
|
||||
# include <sys/types.h>
|
||||
#elif defined(__APPLE__)
|
||||
# include <machine/endian.h>
|
||||
#elif defined( BSD ) && (BSD >= 199103)
|
||||
# include <machine/endian.h>
|
||||
#elif defined( __QNXNTO__ ) && defined( __LITTLEENDIAN__ )
|
||||
# define LITTLE_ENDIAN 1234
|
||||
# define BYTE_ORDER LITTLE_ENDIAN
|
||||
#elif defined( __QNXNTO__ ) && defined( __BIGENDIAN__ )
|
||||
# define BIG_ENDIAN 1234
|
||||
# define BYTE_ORDER BIG_ENDIAN
|
||||
#else
|
||||
# include <endian.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <stdlib.h>
|
||||
#define ethash_swap_u32(input_) _byteswap_ulong(input_)
|
||||
#define ethash_swap_u64(input_) _byteswap_uint64(input_)
|
||||
#elif defined(__APPLE__)
|
||||
#include <libkern/OSByteOrder.h>
|
||||
#define ethash_swap_u32(input_) OSSwapInt32(input_)
|
||||
#define ethash_swap_u64(input_) OSSwapInt64(input_)
|
||||
#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
|
||||
#define ethash_swap_u32(input_) bswap32(input_)
|
||||
#define ethash_swap_u64(input_) bswap64(input_)
|
||||
#elif defined(__OpenBSD__)
|
||||
#include <endian.h>
|
||||
#define ethash_swap_u32(input_) swap32(input_)
|
||||
#define ethash_swap_u64(input_) swap64(input_)
|
||||
#else // posix
|
||||
#include <byteswap.h>
|
||||
#define ethash_swap_u32(input_) bswap_32(input_)
|
||||
#define ethash_swap_u64(input_) bswap_64(input_)
|
||||
#endif
|
||||
|
||||
|
||||
#if LITTLE_ENDIAN == BYTE_ORDER
|
||||
|
||||
#define fix_endian32(dst_ ,src_) dst_ = src_
|
||||
#define fix_endian32_same(val_)
|
||||
#define fix_endian64(dst_, src_) dst_ = src_
|
||||
#define fix_endian64_same(val_)
|
||||
#define fix_endian_arr32(arr_, size_)
|
||||
#define fix_endian_arr64(arr_, size_)
|
||||
|
||||
#elif BIG_ENDIAN == BYTE_ORDER
|
||||
|
||||
#define fix_endian32(dst_, src_) dst_ = ethash_swap_u32(src_)
|
||||
#define fix_endian32_same(val_) val_ = ethash_swap_u32(val_)
|
||||
#define fix_endian64(dst_, src_) dst_ = ethash_swap_u64(src_)
|
||||
#define fix_endian64_same(val_) val_ = ethash_swap_u64(val_)
|
||||
#define fix_endian_arr32(arr_, size_) \
|
||||
do { \
|
||||
for (unsigned i_ = 0; i_ < (size_); ++i_) { \
|
||||
arr_[i_] = ethash_swap_u32(arr_[i_]); \
|
||||
} \
|
||||
} while (0)
|
||||
#define fix_endian_arr64(arr_, size_) \
|
||||
do { \
|
||||
for (unsigned i_ = 0; i_ < (size_); ++i_) { \
|
||||
arr_[i_] = ethash_swap_u64(arr_[i_]); \
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
# error "endian not supported"
|
||||
#endif // BYTE_ORDER
|
158
src/3rdparty/libethash/ethash.h
vendored
Normal file
158
src/3rdparty/libethash/ethash.h
vendored
Normal file
|
@ -0,0 +1,158 @@
|
|||
/*
|
||||
This file is part of ethash.
|
||||
|
||||
ethash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ethash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with ethash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file ethash.h
|
||||
* @date 2015
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#define ETHASH_REVISION 23
|
||||
#define ETHASH_DATASET_BYTES_INIT 1073741824U // 2**30
|
||||
#define ETHASH_DATASET_BYTES_GROWTH 8388608U // 2**23
|
||||
#define ETHASH_CACHE_BYTES_INIT 1073741824U // 2**24
|
||||
#define ETHASH_CACHE_BYTES_GROWTH 131072U // 2**17
|
||||
#define ETHASH_EPOCH_LENGTH 30000U
|
||||
#define ETHASH_MIX_BYTES 128
|
||||
#define ETHASH_HASH_BYTES 64
|
||||
#define ETHASH_DATASET_PARENTS 256
|
||||
#define ETHASH_CACHE_ROUNDS 3
|
||||
#define ETHASH_ACCESSES 64
|
||||
#define ETHASH_DAG_MAGIC_NUM_SIZE 8
|
||||
#define ETHASH_DAG_MAGIC_NUM 0xFEE1DEADBADDCAFE
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/// Type of a seedhash/blockhash e.t.c.
|
||||
typedef struct ethash_h256 { uint8_t b[32]; } ethash_h256_t;
|
||||
|
||||
// convenience macro to statically initialize an h256_t
|
||||
// usage:
|
||||
// ethash_h256_t a = ethash_h256_static_init(1, 2, 3, ... )
|
||||
// have to provide all 32 values. If you don't provide all the rest
|
||||
// will simply be unitialized (not guranteed to be 0)
|
||||
#define ethash_h256_static_init(...) \
|
||||
{ {__VA_ARGS__} }
|
||||
|
||||
struct ethash_light;
|
||||
typedef struct ethash_light* ethash_light_t;
|
||||
struct ethash_full;
|
||||
typedef struct ethash_full* ethash_full_t;
|
||||
typedef int(*ethash_callback_t)(unsigned);
|
||||
|
||||
typedef struct ethash_return_value {
|
||||
ethash_h256_t result;
|
||||
ethash_h256_t mix_hash;
|
||||
bool success;
|
||||
} ethash_return_value_t;
|
||||
|
||||
/**
|
||||
* Allocate and initialize a new ethash_light handler
|
||||
*
|
||||
* @param block_number The block number for which to create the handler
|
||||
* @return Newly allocated ethash_light handler or NULL in case of
|
||||
* ERRNOMEM or invalid parameters used for @ref ethash_compute_cache_nodes()
|
||||
*/
|
||||
ethash_light_t ethash_light_new(uint64_t block_number);
|
||||
/**
|
||||
*/
|
||||
bool ethash_compute_cache_nodes(
|
||||
void* nodes,
|
||||
uint64_t cache_size,
|
||||
ethash_h256_t const* seed
|
||||
);
|
||||
/**
|
||||
* Frees a previously allocated ethash_light handler
|
||||
* @param light The light handler to free
|
||||
*/
|
||||
void ethash_light_delete(ethash_light_t light);
|
||||
/**
|
||||
* Calculate the light client data
|
||||
*
|
||||
* @param light The light client handler
|
||||
* @param header_hash The header hash to pack into the mix
|
||||
* @param nonce The nonce to pack into the mix
|
||||
* @return an object of ethash_return_value_t holding the return values
|
||||
*/
|
||||
ethash_return_value_t ethash_light_compute(
|
||||
ethash_light_t light,
|
||||
ethash_h256_t const header_hash,
|
||||
uint64_t nonce
|
||||
);
|
||||
|
||||
/**
|
||||
* Allocate and initialize a new ethash_full handler
|
||||
*
|
||||
* @param light The light handler containing the cache.
|
||||
* @param callback A callback function with signature of @ref ethash_callback_t
|
||||
* It accepts an unsigned with which a progress of DAG calculation
|
||||
* can be displayed. If all goes well the callback should return 0.
|
||||
* If a non-zero value is returned then DAG generation will stop.
|
||||
* Be advised. A progress value of 100 means that DAG creation is
|
||||
* almost complete and that this function will soon return succesfully.
|
||||
* It does not mean that the function has already had a succesfull return.
|
||||
* @return Newly allocated ethash_full handler or NULL in case of
|
||||
* ERRNOMEM or invalid parameters used for @ref ethash_compute_full_data()
|
||||
*/
|
||||
ethash_full_t ethash_full_new(ethash_light_t light, ethash_callback_t callback);
|
||||
|
||||
/**
|
||||
* Frees a previously allocated ethash_full handler
|
||||
* @param full The light handler to free
|
||||
*/
|
||||
void ethash_full_delete(ethash_full_t full);
|
||||
/**
|
||||
* Calculate the full client data
|
||||
*
|
||||
* @param full The full client handler
|
||||
* @param header_hash The header hash to pack into the mix
|
||||
* @param nonce The nonce to pack into the mix
|
||||
* @return An object of ethash_return_value to hold the return value
|
||||
*/
|
||||
ethash_return_value_t ethash_full_compute(
|
||||
ethash_full_t full,
|
||||
ethash_h256_t const header_hash,
|
||||
uint64_t nonce
|
||||
);
|
||||
/**
|
||||
* Get a pointer to the full DAG data
|
||||
*/
|
||||
void const* ethash_full_dag(ethash_full_t full);
|
||||
/**
|
||||
* Get the size of the DAG data
|
||||
*/
|
||||
uint64_t ethash_full_dag_size(ethash_full_t full);
|
||||
|
||||
/**
|
||||
* Calculate the seedhash for a given epoch
|
||||
*/
|
||||
ethash_h256_t ethash_get_seedhash(uint64_t epoch);
|
||||
|
||||
/**
|
||||
* KeccakF800 for ProgPoW
|
||||
*/
|
||||
void ethash_keccakf800(uint32_t state[25]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
444
src/3rdparty/libethash/ethash_internal.c
vendored
Normal file
444
src/3rdparty/libethash/ethash_internal.c
vendored
Normal file
|
@ -0,0 +1,444 @@
|
|||
/*
|
||||
This file is part of ethash.
|
||||
|
||||
ethash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ethash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file internal.c
|
||||
* @author Tim Hughes <tim@twistedfury.com>
|
||||
* @author Matthew Wampler-Doty
|
||||
* @date 2015
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include "ethash.h"
|
||||
#include "fnv.h"
|
||||
#include "endian.h"
|
||||
#include "ethash_internal.h"
|
||||
#include "data_sizes.h"
|
||||
#include "base/crypto/sha3.h"
|
||||
|
||||
#define SHA3_256(a, b, c) sha3_HashBuffer(256, SHA3_FLAGS_KECCAK, b, c, a, 32)
|
||||
#define SHA3_512(a, b, c) sha3_HashBuffer(512, SHA3_FLAGS_KECCAK, b, c, a, 64)
|
||||
|
||||
uint64_t ethash_get_datasize(uint64_t const block_number)
|
||||
{
|
||||
assert(block_number / ETHASH_EPOCH_LENGTH < 2048);
|
||||
return dag_sizes[block_number / ETHASH_EPOCH_LENGTH];
|
||||
}
|
||||
|
||||
uint64_t ethash_get_cachesize(uint64_t const block_number)
|
||||
{
|
||||
assert(block_number / ETHASH_EPOCH_LENGTH < 2048);
|
||||
return cache_sizes[block_number / ETHASH_EPOCH_LENGTH];
|
||||
}
|
||||
|
||||
// Follows Sergio's "STRICT MEMORY HARD HASHING FUNCTIONS" (2014)
|
||||
// https://bitslog.files.wordpress.com/2013/12/memohash-v0-3.pdf
|
||||
// SeqMemoHash(s, R, N)
|
||||
bool ethash_compute_cache_nodes(
|
||||
void* nodes_ptr,
|
||||
uint64_t cache_size,
|
||||
ethash_h256_t const* seed
|
||||
)
|
||||
{
|
||||
if (cache_size % sizeof(node) != 0) {
|
||||
return false;
|
||||
}
|
||||
uint32_t const num_nodes = (uint32_t) (cache_size / sizeof(node));
|
||||
|
||||
node* nodes = (node*)nodes_ptr;
|
||||
SHA3_512(nodes[0].bytes, (uint8_t*)seed, 32);
|
||||
|
||||
for (uint32_t i = 1; i != num_nodes; ++i) {
|
||||
SHA3_512(nodes[i].bytes, nodes[i - 1].bytes, 64);
|
||||
}
|
||||
|
||||
for (uint32_t j = 0; j != ETHASH_CACHE_ROUNDS; j++) {
|
||||
for (uint32_t i = 0; i != num_nodes; i++) {
|
||||
uint32_t const idx = nodes[i].words[0] % num_nodes;
|
||||
node data;
|
||||
data = nodes[(num_nodes - 1 + i) % num_nodes];
|
||||
for (uint32_t w = 0; w != NODE_WORDS; ++w) {
|
||||
data.words[w] ^= nodes[idx].words[w];
|
||||
}
|
||||
SHA3_512(nodes[i].bytes, data.bytes, sizeof(data));
|
||||
}
|
||||
}
|
||||
|
||||
// now perform endian conversion
|
||||
fix_endian_arr32(nodes->words, num_nodes * NODE_WORDS);
|
||||
return true;
|
||||
}
|
||||
|
||||
void ethash_calculate_dag_item(
|
||||
node* const ret,
|
||||
uint32_t node_index,
|
||||
uint32_t num_parents,
|
||||
ethash_light_t const light
|
||||
)
|
||||
{
|
||||
uint32_t num_parent_nodes = (uint32_t) (light->cache_size / sizeof(node));
|
||||
node const* cache_nodes = (node const *) light->cache;
|
||||
node const* init = &cache_nodes[node_index % num_parent_nodes];
|
||||
memcpy(ret, init, sizeof(node));
|
||||
ret->words[0] ^= node_index;
|
||||
SHA3_512(ret->bytes, ret->bytes, sizeof(node));
|
||||
#if defined(_M_X64) && ENABLE_SSE
|
||||
__m128i const fnv_prime = _mm_set1_epi32(FNV_PRIME);
|
||||
__m128i xmm0 = ret->xmm[0];
|
||||
__m128i xmm1 = ret->xmm[1];
|
||||
__m128i xmm2 = ret->xmm[2];
|
||||
__m128i xmm3 = ret->xmm[3];
|
||||
#endif
|
||||
|
||||
for (uint32_t i = 0; i != num_parents; ++i) {
|
||||
uint32_t parent_index = fnv_hash(node_index ^ i, ret->words[i % NODE_WORDS]) % num_parent_nodes;
|
||||
node const *parent = &cache_nodes[parent_index];
|
||||
|
||||
#if defined(_M_X64) && ENABLE_SSE
|
||||
{
|
||||
xmm0 = _mm_mullo_epi32(xmm0, fnv_prime);
|
||||
xmm1 = _mm_mullo_epi32(xmm1, fnv_prime);
|
||||
xmm2 = _mm_mullo_epi32(xmm2, fnv_prime);
|
||||
xmm3 = _mm_mullo_epi32(xmm3, fnv_prime);
|
||||
xmm0 = _mm_xor_si128(xmm0, parent->xmm[0]);
|
||||
xmm1 = _mm_xor_si128(xmm1, parent->xmm[1]);
|
||||
xmm2 = _mm_xor_si128(xmm2, parent->xmm[2]);
|
||||
xmm3 = _mm_xor_si128(xmm3, parent->xmm[3]);
|
||||
|
||||
// have to write to ret as values are used to compute index
|
||||
ret->xmm[0] = xmm0;
|
||||
ret->xmm[1] = xmm1;
|
||||
ret->xmm[2] = xmm2;
|
||||
ret->xmm[3] = xmm3;
|
||||
}
|
||||
#else
|
||||
{
|
||||
for (unsigned w = 0; w != NODE_WORDS; ++w) {
|
||||
ret->words[w] = fnv_hash(ret->words[w], parent->words[w]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
SHA3_512(ret->bytes, ret->bytes, sizeof(node));
|
||||
}
|
||||
|
||||
static inline uint32_t fast_mod(uint64_t a, uint64_t d, uint64_t r, uint64_t i, uint64_t s)
|
||||
{
|
||||
const uint32_t q = ((a + i) * r) >> s;
|
||||
return a - q * d;
|
||||
}
|
||||
|
||||
void ethash_calculate_dag_item_opt(
|
||||
node* const ret,
|
||||
uint32_t node_index,
|
||||
uint32_t num_parents,
|
||||
ethash_light_t const light
|
||||
)
|
||||
{
|
||||
node const* cache_nodes = (node const*)light->cache;
|
||||
node const* init = &cache_nodes[fast_mod(node_index, light->num_parent_nodes, light->reciprocal, light->increment, light->shift)];
|
||||
memcpy(ret, init, sizeof(node));
|
||||
ret->words[0] ^= node_index;
|
||||
SHA3_512(ret->bytes, ret->bytes, sizeof(node));
|
||||
#if defined(_M_X64) && ENABLE_SSE
|
||||
__m128i const fnv_prime = _mm_set1_epi32(FNV_PRIME);
|
||||
__m128i xmm0 = ret->xmm[0];
|
||||
__m128i xmm1 = ret->xmm[1];
|
||||
__m128i xmm2 = ret->xmm[2];
|
||||
__m128i xmm3 = ret->xmm[3];
|
||||
#endif
|
||||
|
||||
for (uint32_t i = 0; i != num_parents; ++i) {
|
||||
uint32_t parent_index = fast_mod(fnv_hash(node_index ^ i, ret->words[i % NODE_WORDS]), light->num_parent_nodes, light->reciprocal, light->increment, light->shift);
|
||||
node const* parent = &cache_nodes[parent_index];
|
||||
|
||||
#if defined(_M_X64) && ENABLE_SSE
|
||||
{
|
||||
xmm0 = _mm_mullo_epi32(xmm0, fnv_prime);
|
||||
xmm1 = _mm_mullo_epi32(xmm1, fnv_prime);
|
||||
xmm2 = _mm_mullo_epi32(xmm2, fnv_prime);
|
||||
xmm3 = _mm_mullo_epi32(xmm3, fnv_prime);
|
||||
xmm0 = _mm_xor_si128(xmm0, parent->xmm[0]);
|
||||
xmm1 = _mm_xor_si128(xmm1, parent->xmm[1]);
|
||||
xmm2 = _mm_xor_si128(xmm2, parent->xmm[2]);
|
||||
xmm3 = _mm_xor_si128(xmm3, parent->xmm[3]);
|
||||
|
||||
// have to write to ret as values are used to compute index
|
||||
ret->xmm[0] = xmm0;
|
||||
ret->xmm[1] = xmm1;
|
||||
ret->xmm[2] = xmm2;
|
||||
ret->xmm[3] = xmm3;
|
||||
}
|
||||
#else
|
||||
{
|
||||
for (unsigned w = 0; w != NODE_WORDS; ++w) {
|
||||
ret->words[w] = fnv_hash(ret->words[w], parent->words[w]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
SHA3_512(ret->bytes, ret->bytes, sizeof(node));
|
||||
}
|
||||
|
||||
bool ethash_compute_full_data(
|
||||
void* mem,
|
||||
uint64_t full_size,
|
||||
ethash_light_t const light,
|
||||
ethash_callback_t callback
|
||||
)
|
||||
{
|
||||
if (full_size % (sizeof(uint32_t) * MIX_WORDS) != 0 ||
|
||||
(full_size % sizeof(node)) != 0) {
|
||||
return false;
|
||||
}
|
||||
uint32_t const max_n = (uint32_t)(full_size / sizeof(node));
|
||||
node* full_nodes = (node*) mem;
|
||||
double const progress_change = 1.0f / max_n;
|
||||
double progress = 0.0f;
|
||||
// now compute full nodes
|
||||
for (uint32_t n = 0; n != max_n; ++n) {
|
||||
if (callback &&
|
||||
n % (max_n / 100) == 0 &&
|
||||
callback((unsigned int)(ceil(progress * 100.0f))) != 0) {
|
||||
|
||||
return false;
|
||||
}
|
||||
progress += progress_change;
|
||||
ethash_calculate_dag_item(&(full_nodes[n]), n, ETHASH_DATASET_PARENTS, light);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ethash_hash(
|
||||
ethash_return_value_t* ret,
|
||||
node const* full_nodes,
|
||||
ethash_light_t const light,
|
||||
uint64_t full_size,
|
||||
ethash_h256_t const header_hash,
|
||||
uint64_t const nonce
|
||||
)
|
||||
{
|
||||
if (full_size % MIX_WORDS != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// pack hash and nonce together into first 40 bytes of s_mix
|
||||
assert(sizeof(node) * 8 == 512);
|
||||
node s_mix[MIX_NODES + 1];
|
||||
memcpy(s_mix[0].bytes, &header_hash, 32);
|
||||
fix_endian64(s_mix[0].double_words[4], nonce);
|
||||
|
||||
// compute sha3-512 hash and replicate across mix
|
||||
SHA3_512(s_mix->bytes, s_mix->bytes, 40);
|
||||
fix_endian_arr32(s_mix[0].words, 16);
|
||||
|
||||
node* const mix = s_mix + 1;
|
||||
for (uint32_t w = 0; w != MIX_WORDS; ++w) {
|
||||
mix->words[w] = s_mix[0].words[w % NODE_WORDS];
|
||||
}
|
||||
|
||||
unsigned const page_size = sizeof(uint32_t) * MIX_WORDS;
|
||||
unsigned const num_full_pages = (unsigned) (full_size / page_size);
|
||||
|
||||
for (unsigned i = 0; i != ETHASH_ACCESSES; ++i) {
|
||||
uint32_t const index = fnv_hash(s_mix->words[0] ^ i, mix->words[i % MIX_WORDS]) % num_full_pages;
|
||||
|
||||
for (unsigned n = 0; n != MIX_NODES; ++n) {
|
||||
node const* dag_node;
|
||||
node tmp_node;
|
||||
if (full_nodes) {
|
||||
dag_node = &full_nodes[MIX_NODES * index + n];
|
||||
} else {
|
||||
ethash_calculate_dag_item(&tmp_node, index * MIX_NODES + n, ETHASH_DATASET_PARENTS, light);
|
||||
dag_node = &tmp_node;
|
||||
}
|
||||
|
||||
#if defined(_M_X64) && ENABLE_SSE
|
||||
{
|
||||
__m128i fnv_prime = _mm_set1_epi32(FNV_PRIME);
|
||||
__m128i xmm0 = _mm_mullo_epi32(fnv_prime, mix[n].xmm[0]);
|
||||
__m128i xmm1 = _mm_mullo_epi32(fnv_prime, mix[n].xmm[1]);
|
||||
__m128i xmm2 = _mm_mullo_epi32(fnv_prime, mix[n].xmm[2]);
|
||||
__m128i xmm3 = _mm_mullo_epi32(fnv_prime, mix[n].xmm[3]);
|
||||
mix[n].xmm[0] = _mm_xor_si128(xmm0, dag_node->xmm[0]);
|
||||
mix[n].xmm[1] = _mm_xor_si128(xmm1, dag_node->xmm[1]);
|
||||
mix[n].xmm[2] = _mm_xor_si128(xmm2, dag_node->xmm[2]);
|
||||
mix[n].xmm[3] = _mm_xor_si128(xmm3, dag_node->xmm[3]);
|
||||
}
|
||||
#else
|
||||
{
|
||||
for (unsigned w = 0; w != NODE_WORDS; ++w) {
|
||||
mix[n].words[w] = fnv_hash(mix[n].words[w], dag_node->words[w]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// compress mix
|
||||
for (uint32_t w = 0; w != MIX_WORDS; w += 4) {
|
||||
uint32_t reduction = mix->words[w + 0];
|
||||
reduction = reduction * FNV_PRIME ^ mix->words[w + 1];
|
||||
reduction = reduction * FNV_PRIME ^ mix->words[w + 2];
|
||||
reduction = reduction * FNV_PRIME ^ mix->words[w + 3];
|
||||
mix->words[w / 4] = reduction;
|
||||
}
|
||||
|
||||
fix_endian_arr32(mix->words, MIX_WORDS / 4);
|
||||
memcpy(&ret->mix_hash, mix->bytes, 32);
|
||||
// final Keccak hash
|
||||
SHA3_256(&ret->result, s_mix->bytes, 64 + 32); // Keccak-256(s + compressed_mix)
|
||||
return true;
|
||||
}
|
||||
|
||||
void ethash_quick_hash(
|
||||
ethash_h256_t* return_hash,
|
||||
ethash_h256_t const* header_hash,
|
||||
uint64_t nonce,
|
||||
ethash_h256_t const* mix_hash
|
||||
)
|
||||
{
|
||||
uint8_t buf[64 + 32];
|
||||
memcpy(buf, header_hash, 32);
|
||||
fix_endian64_same(nonce);
|
||||
memcpy(&(buf[32]), &nonce, 8);
|
||||
SHA3_512(buf, buf, 40);
|
||||
memcpy(&(buf[64]), mix_hash, 32);
|
||||
SHA3_256(return_hash, buf, 64 + 32);
|
||||
}
|
||||
|
||||
ethash_h256_t ethash_get_seedhash(uint64_t epoch)
|
||||
{
|
||||
ethash_h256_t ret;
|
||||
ethash_h256_reset(&ret);
|
||||
for (uint32_t i = 0; i < epoch; ++i)
|
||||
SHA3_256(&ret, (uint8_t*)&ret, 32);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ethash_quick_check_difficulty(
|
||||
ethash_h256_t const* header_hash,
|
||||
uint64_t const nonce,
|
||||
ethash_h256_t const* mix_hash,
|
||||
ethash_h256_t const* boundary
|
||||
)
|
||||
{
|
||||
ethash_h256_t return_hash;
|
||||
ethash_quick_hash(&return_hash, header_hash, nonce, mix_hash);
|
||||
return ethash_check_difficulty(&return_hash, boundary);
|
||||
}
|
||||
|
||||
ethash_light_t ethash_light_new_internal(uint64_t cache_size, ethash_h256_t const* seed)
|
||||
{
|
||||
struct ethash_light *ret;
|
||||
ret = (struct ethash_light*)calloc(sizeof(*ret), 1);
|
||||
if (!ret) {
|
||||
return NULL;
|
||||
}
|
||||
ret->cache = malloc((size_t)cache_size);
|
||||
if (!ret->cache) {
|
||||
goto fail_free_light;
|
||||
}
|
||||
node* nodes = (node*)ret->cache;
|
||||
if (!ethash_compute_cache_nodes(nodes, cache_size, seed)) {
|
||||
goto fail_free_cache_mem;
|
||||
}
|
||||
ret->cache_size = cache_size;
|
||||
return ret;
|
||||
|
||||
fail_free_cache_mem:
|
||||
free(ret->cache);
|
||||
fail_free_light:
|
||||
free(ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ethash_light_t ethash_light_new(uint64_t block_number)
|
||||
{
|
||||
ethash_h256_t seedhash = ethash_get_seedhash(block_number / ETHASH_EPOCH_LENGTH);
|
||||
ethash_light_t ret;
|
||||
ret = ethash_light_new_internal(ethash_get_cachesize(block_number), &seedhash);
|
||||
ret->block_number = block_number;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ethash_light_delete(ethash_light_t light)
|
||||
{
|
||||
if (light->cache) {
|
||||
free(light->cache);
|
||||
}
|
||||
free(light);
|
||||
}
|
||||
|
||||
ethash_return_value_t ethash_light_compute_internal(
|
||||
ethash_light_t light,
|
||||
uint64_t full_size,
|
||||
ethash_h256_t const header_hash,
|
||||
uint64_t nonce
|
||||
)
|
||||
{
|
||||
ethash_return_value_t ret;
|
||||
ret.success = true;
|
||||
if (!ethash_hash(&ret, NULL, light, full_size, header_hash, nonce)) {
|
||||
ret.success = false;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
ethash_return_value_t ethash_light_compute(
|
||||
ethash_light_t light,
|
||||
ethash_h256_t const header_hash,
|
||||
uint64_t nonce
|
||||
)
|
||||
{
|
||||
uint64_t full_size = ethash_get_datasize(light->block_number);
|
||||
return ethash_light_compute_internal(light, full_size, header_hash, nonce);
|
||||
}
|
||||
|
||||
ethash_return_value_t ethash_full_compute(
|
||||
ethash_full_t full,
|
||||
ethash_h256_t const header_hash,
|
||||
uint64_t nonce
|
||||
)
|
||||
{
|
||||
ethash_return_value_t ret;
|
||||
ret.success = true;
|
||||
if (!ethash_hash(
|
||||
&ret,
|
||||
(node const*)full->data,
|
||||
NULL,
|
||||
full->file_size,
|
||||
header_hash,
|
||||
nonce)) {
|
||||
ret.success = false;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void const* ethash_full_dag(ethash_full_t full)
|
||||
{
|
||||
return full->data;
|
||||
}
|
||||
|
||||
uint64_t ethash_full_dag_size(ethash_full_t full)
|
||||
{
|
||||
return full->file_size;
|
||||
}
|
192
src/3rdparty/libethash/ethash_internal.h
vendored
Normal file
192
src/3rdparty/libethash/ethash_internal.h
vendored
Normal file
|
@ -0,0 +1,192 @@
|
|||
#pragma once
|
||||
#include "endian.h"
|
||||
#include "ethash.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#define ENABLE_SSE 0
|
||||
|
||||
#if defined(_M_X64) && ENABLE_SSE
|
||||
#include <smmintrin.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// compile time settings
|
||||
#define NODE_WORDS (64/4)
|
||||
#define MIX_WORDS (ETHASH_MIX_BYTES/4)
|
||||
#define MIX_NODES (MIX_WORDS / NODE_WORDS)
|
||||
#include <stdint.h>
|
||||
|
||||
typedef union node {
|
||||
uint8_t bytes[NODE_WORDS * 4];
|
||||
uint32_t words[NODE_WORDS];
|
||||
uint64_t double_words[NODE_WORDS / 2];
|
||||
|
||||
#if defined(_M_X64) && ENABLE_SSE
|
||||
__m128i xmm[NODE_WORDS/4];
|
||||
#endif
|
||||
|
||||
} node;
|
||||
|
||||
static inline uint8_t ethash_h256_get(ethash_h256_t const* hash, unsigned int i)
|
||||
{
|
||||
return hash->b[i];
|
||||
}
|
||||
|
||||
static inline void ethash_h256_set(ethash_h256_t* hash, unsigned int i, uint8_t v)
|
||||
{
|
||||
hash->b[i] = v;
|
||||
}
|
||||
|
||||
static inline void ethash_h256_reset(ethash_h256_t* hash)
|
||||
{
|
||||
memset(hash, 0, 32);
|
||||
}
|
||||
|
||||
// Returns if hash is less than or equal to boundary (2^256/difficulty)
|
||||
static inline bool ethash_check_difficulty(
|
||||
ethash_h256_t const* hash,
|
||||
ethash_h256_t const* boundary
|
||||
)
|
||||
{
|
||||
// Boundary is big endian
|
||||
for (int i = 0; i < 32; i++) {
|
||||
if (ethash_h256_get(hash, i) == ethash_h256_get(boundary, i)) {
|
||||
continue;
|
||||
}
|
||||
return ethash_h256_get(hash, i) < ethash_h256_get(boundary, i);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Difficulty quick check for POW preverification
|
||||
*
|
||||
* @param header_hash The hash of the header
|
||||
* @param nonce The block's nonce
|
||||
* @param mix_hash The mix digest hash
|
||||
* @param boundary The boundary is defined as (2^256 / difficulty)
|
||||
* @return true for succesful pre-verification and false otherwise
|
||||
*/
|
||||
bool ethash_quick_check_difficulty(
|
||||
ethash_h256_t const* header_hash,
|
||||
uint64_t const nonce,
|
||||
ethash_h256_t const* mix_hash,
|
||||
ethash_h256_t const* boundary
|
||||
);
|
||||
|
||||
struct ethash_light {
|
||||
void* cache;
|
||||
uint64_t cache_size;
|
||||
uint64_t block_number;
|
||||
|
||||
// Used for fast division
|
||||
uint32_t num_parent_nodes;
|
||||
uint32_t reciprocal;
|
||||
uint32_t increment;
|
||||
uint32_t shift;
|
||||
};
|
||||
|
||||
/**
|
||||
* Allocate and initialize a new ethash_light handler. Internal version
|
||||
*
|
||||
* @param cache_size The size of the cache in bytes
|
||||
* @param seed Block seedhash to be used during the computation of the
|
||||
* cache nodes
|
||||
* @return Newly allocated ethash_light handler or NULL in case of
|
||||
* ERRNOMEM or invalid parameters used for @ref ethash_compute_cache_nodes()
|
||||
*/
|
||||
ethash_light_t ethash_light_new_internal(uint64_t cache_size, ethash_h256_t const* seed);
|
||||
|
||||
/**
|
||||
* Calculate the light client data. Internal version.
|
||||
*
|
||||
* @param light The light client handler
|
||||
* @param full_size The size of the full data in bytes.
|
||||
* @param header_hash The header hash to pack into the mix
|
||||
* @param nonce The nonce to pack into the mix
|
||||
* @return The resulting hash.
|
||||
*/
|
||||
ethash_return_value_t ethash_light_compute_internal(
|
||||
ethash_light_t light,
|
||||
uint64_t full_size,
|
||||
ethash_h256_t const header_hash,
|
||||
uint64_t nonce
|
||||
);
|
||||
|
||||
struct ethash_full {
|
||||
FILE* file;
|
||||
uint64_t file_size;
|
||||
node* data;
|
||||
};
|
||||
|
||||
/**
|
||||
* Allocate and initialize a new ethash_full handler. Internal version.
|
||||
*
|
||||
* @param dirname The directory in which to put the DAG file.
|
||||
* @param seedhash The seed hash of the block. Used in the DAG file naming.
|
||||
* @param full_size The size of the full data in bytes.
|
||||
* @param cache A cache object to use that was allocated with @ref ethash_cache_new().
|
||||
* Iff this function succeeds the ethash_full_t will take memory
|
||||
* memory ownership of the cache and free it at deletion. If
|
||||
* not then the user still has to handle freeing of the cache himself.
|
||||
* @param callback A callback function with signature of @ref ethash_callback_t
|
||||
* It accepts an unsigned with which a progress of DAG calculation
|
||||
* can be displayed. If all goes well the callback should return 0.
|
||||
* If a non-zero value is returned then DAG generation will stop.
|
||||
* @return Newly allocated ethash_full handler or NULL in case of
|
||||
* ERRNOMEM or invalid parameters used for @ref ethash_compute_full_data()
|
||||
*/
|
||||
ethash_full_t ethash_full_new_internal(
|
||||
char const* dirname,
|
||||
ethash_h256_t const seed_hash,
|
||||
uint64_t full_size,
|
||||
ethash_light_t const light,
|
||||
ethash_callback_t callback
|
||||
);
|
||||
|
||||
void ethash_calculate_dag_item(
|
||||
node* const ret,
|
||||
uint32_t node_index,
|
||||
uint32_t num_parents,
|
||||
ethash_light_t const cache
|
||||
);
|
||||
|
||||
void ethash_calculate_dag_item_opt(
|
||||
node* const ret,
|
||||
uint32_t node_index,
|
||||
uint32_t num_parents,
|
||||
ethash_light_t const cache
|
||||
);
|
||||
|
||||
void ethash_quick_hash(
|
||||
ethash_h256_t* return_hash,
|
||||
ethash_h256_t const* header_hash,
|
||||
const uint64_t nonce,
|
||||
ethash_h256_t const* mix_hash
|
||||
);
|
||||
|
||||
uint64_t ethash_get_datasize(uint64_t const block_number);
|
||||
uint64_t ethash_get_cachesize(uint64_t const block_number);
|
||||
|
||||
/**
|
||||
* Compute the memory data for a full node's memory
|
||||
*
|
||||
* @param mem A pointer to an ethash full's memory
|
||||
* @param full_size The size of the full data in bytes
|
||||
* @param cache A cache object to use in the calculation
|
||||
* @param callback The callback function. Check @ref ethash_full_new() for details.
|
||||
* @return true if all went fine and false for invalid parameters
|
||||
*/
|
||||
bool ethash_compute_full_data(
|
||||
void* mem,
|
||||
uint64_t full_size,
|
||||
ethash_light_t const light,
|
||||
ethash_callback_t callback
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
42
src/3rdparty/libethash/fnv.h
vendored
Normal file
42
src/3rdparty/libethash/fnv.h
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
This file is part of cpp-ethereum.
|
||||
|
||||
cpp-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
cpp-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file fnv.h
|
||||
* @author Matthew Wampler-Doty <negacthulhu@gmail.com>
|
||||
* @date 2015
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define FNV_PRIME 0x01000193
|
||||
|
||||
/* The FNV-1 spec multiplies the prime with the input one byte (octet) in turn.
|
||||
We instead multiply it with the full 32-bit input.
|
||||
This gives a different result compared to a canonical FNV-1 implementation.
|
||||
*/
|
||||
static inline uint32_t fnv_hash(uint32_t const x, uint32_t const y)
|
||||
{
|
||||
return x * FNV_PRIME ^ y;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
253
src/3rdparty/libethash/keccakf800.c
vendored
Normal file
253
src/3rdparty/libethash/keccakf800.c
vendored
Normal file
|
@ -0,0 +1,253 @@
|
|||
/* ethash: C/C++ implementation of Ethash, the Ethereum Proof of Work algorithm.
|
||||
* Copyright 2018-2019 Pawel Bylica.
|
||||
* Licensed under the Apache License, Version 2.0.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
static uint32_t rol(uint32_t x, unsigned s)
|
||||
{
|
||||
return (x << s) | (x >> (32 - s));
|
||||
}
|
||||
|
||||
static const uint32_t round_constants[22] = {
|
||||
0x00000001,
|
||||
0x00008082,
|
||||
0x0000808A,
|
||||
0x80008000,
|
||||
0x0000808B,
|
||||
0x80000001,
|
||||
0x80008081,
|
||||
0x00008009,
|
||||
0x0000008A,
|
||||
0x00000088,
|
||||
0x80008009,
|
||||
0x8000000A,
|
||||
0x8000808B,
|
||||
0x0000008B,
|
||||
0x00008089,
|
||||
0x00008003,
|
||||
0x00008002,
|
||||
0x00000080,
|
||||
0x0000800A,
|
||||
0x8000000A,
|
||||
0x80008081,
|
||||
0x00008080,
|
||||
};
|
||||
|
||||
void ethash_keccakf800(uint32_t state[25])
|
||||
{
|
||||
/* The implementation directly translated from ethash_keccakf1600. */
|
||||
|
||||
int round;
|
||||
|
||||
uint32_t Aba, Abe, Abi, Abo, Abu;
|
||||
uint32_t Aga, Age, Agi, Ago, Agu;
|
||||
uint32_t Aka, Ake, Aki, Ako, Aku;
|
||||
uint32_t Ama, Ame, Ami, Amo, Amu;
|
||||
uint32_t Asa, Ase, Asi, Aso, Asu;
|
||||
|
||||
uint32_t Eba, Ebe, Ebi, Ebo, Ebu;
|
||||
uint32_t Ega, Ege, Egi, Ego, Egu;
|
||||
uint32_t Eka, Eke, Eki, Eko, Eku;
|
||||
uint32_t Ema, Eme, Emi, Emo, Emu;
|
||||
uint32_t Esa, Ese, Esi, Eso, Esu;
|
||||
|
||||
uint32_t Ba, Be, Bi, Bo, Bu;
|
||||
|
||||
uint32_t Da, De, Di, Do, Du;
|
||||
|
||||
Aba = state[0];
|
||||
Abe = state[1];
|
||||
Abi = state[2];
|
||||
Abo = state[3];
|
||||
Abu = state[4];
|
||||
Aga = state[5];
|
||||
Age = state[6];
|
||||
Agi = state[7];
|
||||
Ago = state[8];
|
||||
Agu = state[9];
|
||||
Aka = state[10];
|
||||
Ake = state[11];
|
||||
Aki = state[12];
|
||||
Ako = state[13];
|
||||
Aku = state[14];
|
||||
Ama = state[15];
|
||||
Ame = state[16];
|
||||
Ami = state[17];
|
||||
Amo = state[18];
|
||||
Amu = state[19];
|
||||
Asa = state[20];
|
||||
Ase = state[21];
|
||||
Asi = state[22];
|
||||
Aso = state[23];
|
||||
Asu = state[24];
|
||||
|
||||
for (round = 0; round < 22; round += 2)
|
||||
{
|
||||
/* Round (round + 0): Axx -> Exx */
|
||||
|
||||
Ba = Aba ^ Aga ^ Aka ^ Ama ^ Asa;
|
||||
Be = Abe ^ Age ^ Ake ^ Ame ^ Ase;
|
||||
Bi = Abi ^ Agi ^ Aki ^ Ami ^ Asi;
|
||||
Bo = Abo ^ Ago ^ Ako ^ Amo ^ Aso;
|
||||
Bu = Abu ^ Agu ^ Aku ^ Amu ^ Asu;
|
||||
|
||||
Da = Bu ^ rol(Be, 1);
|
||||
De = Ba ^ rol(Bi, 1);
|
||||
Di = Be ^ rol(Bo, 1);
|
||||
Do = Bi ^ rol(Bu, 1);
|
||||
Du = Bo ^ rol(Ba, 1);
|
||||
|
||||
Ba = Aba ^ Da;
|
||||
Be = rol(Age ^ De, 12);
|
||||
Bi = rol(Aki ^ Di, 11);
|
||||
Bo = rol(Amo ^ Do, 21);
|
||||
Bu = rol(Asu ^ Du, 14);
|
||||
Eba = Ba ^ (~Be & Bi) ^ round_constants[round];
|
||||
Ebe = Be ^ (~Bi & Bo);
|
||||
Ebi = Bi ^ (~Bo & Bu);
|
||||
Ebo = Bo ^ (~Bu & Ba);
|
||||
Ebu = Bu ^ (~Ba & Be);
|
||||
|
||||
Ba = rol(Abo ^ Do, 28);
|
||||
Be = rol(Agu ^ Du, 20);
|
||||
Bi = rol(Aka ^ Da, 3);
|
||||
Bo = rol(Ame ^ De, 13);
|
||||
Bu = rol(Asi ^ Di, 29);
|
||||
Ega = Ba ^ (~Be & Bi);
|
||||
Ege = Be ^ (~Bi & Bo);
|
||||
Egi = Bi ^ (~Bo & Bu);
|
||||
Ego = Bo ^ (~Bu & Ba);
|
||||
Egu = Bu ^ (~Ba & Be);
|
||||
|
||||
Ba = rol(Abe ^ De, 1);
|
||||
Be = rol(Agi ^ Di, 6);
|
||||
Bi = rol(Ako ^ Do, 25);
|
||||
Bo = rol(Amu ^ Du, 8);
|
||||
Bu = rol(Asa ^ Da, 18);
|
||||
Eka = Ba ^ (~Be & Bi);
|
||||
Eke = Be ^ (~Bi & Bo);
|
||||
Eki = Bi ^ (~Bo & Bu);
|
||||
Eko = Bo ^ (~Bu & Ba);
|
||||
Eku = Bu ^ (~Ba & Be);
|
||||
|
||||
Ba = rol(Abu ^ Du, 27);
|
||||
Be = rol(Aga ^ Da, 4);
|
||||
Bi = rol(Ake ^ De, 10);
|
||||
Bo = rol(Ami ^ Di, 15);
|
||||
Bu = rol(Aso ^ Do, 24);
|
||||
Ema = Ba ^ (~Be & Bi);
|
||||
Eme = Be ^ (~Bi & Bo);
|
||||
Emi = Bi ^ (~Bo & Bu);
|
||||
Emo = Bo ^ (~Bu & Ba);
|
||||
Emu = Bu ^ (~Ba & Be);
|
||||
|
||||
Ba = rol(Abi ^ Di, 30);
|
||||
Be = rol(Ago ^ Do, 23);
|
||||
Bi = rol(Aku ^ Du, 7);
|
||||
Bo = rol(Ama ^ Da, 9);
|
||||
Bu = rol(Ase ^ De, 2);
|
||||
Esa = Ba ^ (~Be & Bi);
|
||||
Ese = Be ^ (~Bi & Bo);
|
||||
Esi = Bi ^ (~Bo & Bu);
|
||||
Eso = Bo ^ (~Bu & Ba);
|
||||
Esu = Bu ^ (~Ba & Be);
|
||||
|
||||
|
||||
/* Round (round + 1): Exx -> Axx */
|
||||
|
||||
Ba = Eba ^ Ega ^ Eka ^ Ema ^ Esa;
|
||||
Be = Ebe ^ Ege ^ Eke ^ Eme ^ Ese;
|
||||
Bi = Ebi ^ Egi ^ Eki ^ Emi ^ Esi;
|
||||
Bo = Ebo ^ Ego ^ Eko ^ Emo ^ Eso;
|
||||
Bu = Ebu ^ Egu ^ Eku ^ Emu ^ Esu;
|
||||
|
||||
Da = Bu ^ rol(Be, 1);
|
||||
De = Ba ^ rol(Bi, 1);
|
||||
Di = Be ^ rol(Bo, 1);
|
||||
Do = Bi ^ rol(Bu, 1);
|
||||
Du = Bo ^ rol(Ba, 1);
|
||||
|
||||
Ba = Eba ^ Da;
|
||||
Be = rol(Ege ^ De, 12);
|
||||
Bi = rol(Eki ^ Di, 11);
|
||||
Bo = rol(Emo ^ Do, 21);
|
||||
Bu = rol(Esu ^ Du, 14);
|
||||
Aba = Ba ^ (~Be & Bi) ^ round_constants[round + 1];
|
||||
Abe = Be ^ (~Bi & Bo);
|
||||
Abi = Bi ^ (~Bo & Bu);
|
||||
Abo = Bo ^ (~Bu & Ba);
|
||||
Abu = Bu ^ (~Ba & Be);
|
||||
|
||||
Ba = rol(Ebo ^ Do, 28);
|
||||
Be = rol(Egu ^ Du, 20);
|
||||
Bi = rol(Eka ^ Da, 3);
|
||||
Bo = rol(Eme ^ De, 13);
|
||||
Bu = rol(Esi ^ Di, 29);
|
||||
Aga = Ba ^ (~Be & Bi);
|
||||
Age = Be ^ (~Bi & Bo);
|
||||
Agi = Bi ^ (~Bo & Bu);
|
||||
Ago = Bo ^ (~Bu & Ba);
|
||||
Agu = Bu ^ (~Ba & Be);
|
||||
|
||||
Ba = rol(Ebe ^ De, 1);
|
||||
Be = rol(Egi ^ Di, 6);
|
||||
Bi = rol(Eko ^ Do, 25);
|
||||
Bo = rol(Emu ^ Du, 8);
|
||||
Bu = rol(Esa ^ Da, 18);
|
||||
Aka = Ba ^ (~Be & Bi);
|
||||
Ake = Be ^ (~Bi & Bo);
|
||||
Aki = Bi ^ (~Bo & Bu);
|
||||
Ako = Bo ^ (~Bu & Ba);
|
||||
Aku = Bu ^ (~Ba & Be);
|
||||
|
||||
Ba = rol(Ebu ^ Du, 27);
|
||||
Be = rol(Ega ^ Da, 4);
|
||||
Bi = rol(Eke ^ De, 10);
|
||||
Bo = rol(Emi ^ Di, 15);
|
||||
Bu = rol(Eso ^ Do, 24);
|
||||
Ama = Ba ^ (~Be & Bi);
|
||||
Ame = Be ^ (~Bi & Bo);
|
||||
Ami = Bi ^ (~Bo & Bu);
|
||||
Amo = Bo ^ (~Bu & Ba);
|
||||
Amu = Bu ^ (~Ba & Be);
|
||||
|
||||
Ba = rol(Ebi ^ Di, 30);
|
||||
Be = rol(Ego ^ Do, 23);
|
||||
Bi = rol(Eku ^ Du, 7);
|
||||
Bo = rol(Ema ^ Da, 9);
|
||||
Bu = rol(Ese ^ De, 2);
|
||||
Asa = Ba ^ (~Be & Bi);
|
||||
Ase = Be ^ (~Bi & Bo);
|
||||
Asi = Bi ^ (~Bo & Bu);
|
||||
Aso = Bo ^ (~Bu & Ba);
|
||||
Asu = Bu ^ (~Ba & Be);
|
||||
}
|
||||
|
||||
state[0] = Aba;
|
||||
state[1] = Abe;
|
||||
state[2] = Abi;
|
||||
state[3] = Abo;
|
||||
state[4] = Abu;
|
||||
state[5] = Aga;
|
||||
state[6] = Age;
|
||||
state[7] = Agi;
|
||||
state[8] = Ago;
|
||||
state[9] = Agu;
|
||||
state[10] = Aka;
|
||||
state[11] = Ake;
|
||||
state[12] = Aki;
|
||||
state[13] = Ako;
|
||||
state[14] = Aku;
|
||||
state[15] = Ama;
|
||||
state[16] = Ame;
|
||||
state[17] = Ami;
|
||||
state[18] = Amo;
|
||||
state[19] = Amu;
|
||||
state[20] = Asa;
|
||||
state[21] = Ase;
|
||||
state[22] = Asi;
|
||||
state[23] = Aso;
|
||||
state[24] = Asu;
|
||||
}
|
22
src/App.cpp
22
src/App.cpp
|
@ -6,8 +6,8 @@
|
|||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -32,7 +32,9 @@
|
|||
#include "backend/cpu/Cpu.h"
|
||||
#include "base/io/Console.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/kernel/Signals.h"
|
||||
#include "base/io/log/Tags.h"
|
||||
#include "base/io/Signals.h"
|
||||
#include "base/kernel/Platform.h"
|
||||
#include "core/config/Config.h"
|
||||
#include "core/Controller.h"
|
||||
#include "core/Miner.h"
|
||||
|
@ -49,6 +51,8 @@ xmrig::App::App(Process *process)
|
|||
|
||||
xmrig::App::~App()
|
||||
{
|
||||
Cpu::release();
|
||||
|
||||
delete m_signals;
|
||||
delete m_console;
|
||||
delete m_controller;
|
||||
|
@ -58,7 +62,7 @@ xmrig::App::~App()
|
|||
int xmrig::App::exec()
|
||||
{
|
||||
if (!m_controller->isReady()) {
|
||||
LOG_EMERG("no valid configuration found.");
|
||||
LOG_EMERG("no valid configuration found, try https://xmrig.com/wizard");
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
@ -82,7 +86,7 @@ int xmrig::App::exec()
|
|||
Summary::print(m_controller);
|
||||
|
||||
if (m_controller->config()->isDryRun()) {
|
||||
LOG_NOTICE("OK");
|
||||
LOG_NOTICE("%s " WHITE_BOLD("OK"), Tags::config());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -99,7 +103,7 @@ int xmrig::App::exec()
|
|||
void xmrig::App::onConsoleCommand(char command)
|
||||
{
|
||||
if (command == 3) {
|
||||
LOG_WARN("Ctrl+C received, exiting");
|
||||
LOG_WARN("%s " YELLOW("Ctrl+C received, exiting"), Tags::signal());
|
||||
close();
|
||||
}
|
||||
else {
|
||||
|
@ -113,15 +117,15 @@ void xmrig::App::onSignal(int signum)
|
|||
switch (signum)
|
||||
{
|
||||
case SIGHUP:
|
||||
LOG_WARN("SIGHUP received, exiting");
|
||||
LOG_WARN("%s " YELLOW("SIGHUP received, exiting"), Tags::signal());
|
||||
break;
|
||||
|
||||
case SIGTERM:
|
||||
LOG_WARN("SIGTERM received, exiting");
|
||||
LOG_WARN("%s " YELLOW("SIGTERM received, exiting"), Tags::signal());
|
||||
break;
|
||||
|
||||
case SIGINT:
|
||||
LOG_WARN("SIGINT received, exiting");
|
||||
LOG_WARN("%s " YELLOW("SIGINT received, exiting"), Tags::signal());
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -39,6 +39,11 @@
|
|||
#include "version.h"
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_RANDOMX
|
||||
# include "crypto/rx/RxConfig.h"
|
||||
#endif
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
|
@ -59,24 +64,36 @@ inline static const char *asmName(Assembly::Id assembly)
|
|||
#endif
|
||||
|
||||
|
||||
static void print_memory(Config *config) {
|
||||
# ifdef _WIN32
|
||||
static void print_memory(Config *config)
|
||||
{
|
||||
# ifdef XMRIG_OS_WIN
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") "%s",
|
||||
"HUGE PAGES", config->cpu().isHugePages() ? (VirtualMemory::isHugepagesAvailable() ? GREEN_BOLD("permission granted") : RED_BOLD("unavailable")) : RED_BOLD("disabled"));
|
||||
# else
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") "%s", "HUGE PAGES", config->cpu().isHugePages() ? GREEN_BOLD("supported") : RED_BOLD("disabled"));
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
# ifdef XMRIG_OS_LINUX
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") "%s",
|
||||
"1GB PAGES", (VirtualMemory::isOneGbPagesAvailable() ? (config->rx().isOneGbPages() ? GREEN_BOLD("supported") : YELLOW_BOLD("disabled")) : YELLOW_BOLD("unavailable")));
|
||||
# else
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") "%s", "1GB PAGES", YELLOW_BOLD("unavailable"));
|
||||
# endif
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
static void print_cpu(Config *)
|
||||
{
|
||||
const ICpuInfo *info = Cpu::info();
|
||||
const auto info = Cpu::info();
|
||||
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s%s (%zu)") " %sx64 %sAES",
|
||||
"CPU",
|
||||
info->brand(),
|
||||
info->packages(),
|
||||
info->isX64() ? GREEN_BOLD_S : RED_BOLD_S "-",
|
||||
info->hasAES() ? GREEN_BOLD_S : RED_BOLD_S "-"
|
||||
info->isX64() ? GREEN_BOLD_S : RED_BOLD_S "-",
|
||||
info->hasAES() ? GREEN_BOLD_S : RED_BOLD_S "-"
|
||||
);
|
||||
# if defined(XMRIG_FEATURE_LIBCPUID) || defined (XMRIG_FEATURE_HWLOC)
|
||||
Log::print(WHITE_BOLD(" %-13s") BLACK_BOLD("L2:") WHITE_BOLD("%.1f MB") BLACK_BOLD(" L3:") WHITE_BOLD("%.1f MB")
|
||||
|
@ -102,6 +119,23 @@ static void print_cpu(Config *)
|
|||
}
|
||||
|
||||
|
||||
static void print_memory()
|
||||
{
|
||||
constexpr size_t oneGiB = 1024U * 1024U * 1024U;
|
||||
const auto freeMem = static_cast<double>(uv_get_free_memory());
|
||||
const auto totalMem = static_cast<double>(uv_get_total_memory());
|
||||
|
||||
const double percent = freeMem > 0 ? ((totalMem - freeMem) / totalMem * 100.0) : 100.0;
|
||||
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("%.1f/%.1f GB") BLACK_BOLD(" (%.0f%%)"),
|
||||
"MEMORY",
|
||||
(totalMem - freeMem) / oneGiB,
|
||||
totalMem / oneGiB,
|
||||
percent
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
static void print_threads(Config *config)
|
||||
{
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") WHITE_BOLD("%s%d%%"),
|
||||
|
@ -125,7 +159,7 @@ static void print_threads(Config *config)
|
|||
|
||||
static void print_commands(Config *)
|
||||
{
|
||||
if (Log::colors) {
|
||||
if (Log::isColors()) {
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("COMMANDS ") MAGENTA_BG(WHITE_BOLD_S "h") WHITE_BOLD("ashrate, ")
|
||||
MAGENTA_BG(WHITE_BOLD_S "p") WHITE_BOLD("ause, ")
|
||||
MAGENTA_BG(WHITE_BOLD_S "r") WHITE_BOLD("esume"));
|
||||
|
@ -144,6 +178,7 @@ void xmrig::Summary::print(Controller *controller)
|
|||
controller->config()->printVersions();
|
||||
print_memory(controller->config());
|
||||
print_cpu(controller->config());
|
||||
print_memory();
|
||||
print_threads(controller->config());
|
||||
controller->config()->pools().print();
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -30,15 +30,16 @@
|
|||
|
||||
|
||||
#include "backend/common/Hashrate.h"
|
||||
#include "3rdparty/rapidjson/document.h"
|
||||
#include "base/io/json/Json.h"
|
||||
#include "base/tools/Chrono.h"
|
||||
#include "base/tools/Handle.h"
|
||||
#include "rapidjson/document.h"
|
||||
|
||||
|
||||
inline static const char *format(double h, char *buf, size_t size)
|
||||
{
|
||||
if (std::isnormal(h)) {
|
||||
snprintf(buf, size, "%03.1f", h);
|
||||
snprintf(buf, size, (h < 100.0) ? "%04.2f" : "%03.1f", h);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
@ -157,13 +158,7 @@ const char *xmrig::Hashrate::format(double h, char *buf, size_t size)
|
|||
|
||||
rapidjson::Value xmrig::Hashrate::normalize(double d)
|
||||
{
|
||||
using namespace rapidjson;
|
||||
|
||||
if (!std::isnormal(d)) {
|
||||
return Value(kNullType);
|
||||
}
|
||||
|
||||
return Value(floor(d * 100.0) / 100.0);
|
||||
return Json::normalize(d, false);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -30,8 +30,8 @@
|
|||
#include <cstdint>
|
||||
|
||||
|
||||
#include "3rdparty/rapidjson/fwd.h"
|
||||
#include "base/tools/Object.h"
|
||||
#include "rapidjson/fwd.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -23,8 +23,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_TAGS_H
|
||||
#define XMRIG_TAGS_H
|
||||
#ifndef XMRIG_BACKEND_TAGS_H
|
||||
#define XMRIG_BACKEND_TAGS_H
|
||||
|
||||
|
||||
#include <cstdint>
|
||||
|
@ -35,7 +35,6 @@ namespace xmrig {
|
|||
|
||||
const char *backend_tag(uint32_t backend);
|
||||
const char *cpu_tag();
|
||||
const char *net_tag();
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_OPENCL
|
||||
|
@ -48,7 +47,6 @@ const char *cuda_tag();
|
|||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_RANDOMX
|
||||
const char *rx_tag();
|
||||
#endif
|
||||
|
@ -57,4 +55,4 @@ const char *rx_tag();
|
|||
} // namespace xmrig
|
||||
|
||||
|
||||
#endif /* XMRIG_TAGS_H */
|
||||
#endif /* XMRIG_BACKEND_TAGS_H */
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -24,9 +24,9 @@
|
|||
|
||||
|
||||
#include "backend/common/Threads.h"
|
||||
#include "3rdparty/rapidjson/document.h"
|
||||
#include "backend/cpu/CpuThreads.h"
|
||||
#include "crypto/cn/CnAlgo.h"
|
||||
#include "rapidjson/document.h"
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_OPENCL
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -30,9 +30,9 @@
|
|||
#include <set>
|
||||
|
||||
|
||||
#include "3rdparty/rapidjson/fwd.h"
|
||||
#include "base/crypto/Algorithm.h"
|
||||
#include "base/tools/String.h"
|
||||
#include "crypto/common/Algorithm.h"
|
||||
#include "rapidjson/fwd.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
|
|
@ -42,10 +42,11 @@ class Worker : public IWorker
|
|||
public:
|
||||
Worker(size_t id, int64_t affinity, int priority);
|
||||
|
||||
inline const VirtualMemory *memory() const override { return nullptr; }
|
||||
inline size_t id() const override { return m_id; }
|
||||
inline uint64_t hashCount() const override { return m_hashCount.load(std::memory_order_relaxed); }
|
||||
inline uint64_t timestamp() const override { return m_timestamp.load(std::memory_order_relaxed); }
|
||||
inline const VirtualMemory *memory() const override { return nullptr; }
|
||||
inline size_t id() const override { return m_id; }
|
||||
inline uint64_t hashCount() const override { return m_hashCount.load(std::memory_order_relaxed); }
|
||||
inline uint64_t timestamp() const override { return m_timestamp.load(std::memory_order_relaxed); }
|
||||
inline void jobEarlyNotification(const Job&) override {}
|
||||
|
||||
protected:
|
||||
void storeStats();
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -41,7 +41,7 @@ class WorkerJob
|
|||
{
|
||||
public:
|
||||
inline const Job ¤tJob() const { return m_jobs[index()]; }
|
||||
inline uint32_t *nonce(size_t i = 0) { return reinterpret_cast<uint32_t*>(blob() + (i * currentJob().size()) + 39); }
|
||||
inline uint32_t *nonce(size_t i = 0) { return reinterpret_cast<uint32_t*>(blob() + (i * currentJob().size()) + nonceOffset()); }
|
||||
inline uint64_t sequence() const { return m_sequence; }
|
||||
inline uint8_t *blob() { return m_blobs[index()]; }
|
||||
inline uint8_t index() const { return m_index; }
|
||||
|
@ -64,13 +64,17 @@ public:
|
|||
}
|
||||
|
||||
|
||||
inline void nextRound(uint32_t rounds, uint32_t roundSize)
|
||||
inline bool nextRound(uint32_t rounds, uint32_t roundSize)
|
||||
{
|
||||
bool ok = true;
|
||||
m_rounds[index()]++;
|
||||
|
||||
if ((m_rounds[index()] % rounds) == 0) {
|
||||
for (size_t i = 0; i < N; ++i) {
|
||||
*nonce(i) = Nonce::next(index(), *nonce(i), rounds * roundSize, currentJob().isNicehash());
|
||||
*nonce(i) = Nonce::next(index(), *nonce(i), rounds * roundSize, currentJob().isNicehash(), &ok);
|
||||
if (!ok) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -78,10 +82,15 @@ public:
|
|||
*nonce(i) += roundSize;
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
inline int32_t nonceOffset() const { return currentJob().nonceOffset(); }
|
||||
inline size_t nonceSize() const { return currentJob().nonceSize(); }
|
||||
|
||||
inline void save(const Job &job, uint32_t reserveCount, Nonce::Backend backend)
|
||||
{
|
||||
m_index = job.index();
|
||||
|
@ -109,21 +118,35 @@ private:
|
|||
template<>
|
||||
inline uint32_t *xmrig::WorkerJob<1>::nonce(size_t)
|
||||
{
|
||||
return reinterpret_cast<uint32_t*>(blob() + 39);
|
||||
return reinterpret_cast<uint32_t*>(blob() + nonceOffset());
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
inline void xmrig::WorkerJob<1>::nextRound(uint32_t rounds, uint32_t roundSize)
|
||||
inline bool xmrig::WorkerJob<1>::nextRound(uint32_t rounds, uint32_t roundSize)
|
||||
{
|
||||
bool ok = true;
|
||||
m_rounds[index()]++;
|
||||
|
||||
uint32_t* n = nonce();
|
||||
const uint32_t prev_nonce = *n;
|
||||
|
||||
if ((m_rounds[index()] % rounds) == 0) {
|
||||
*nonce() = Nonce::next(index(), *nonce(), rounds * roundSize, currentJob().isNicehash());
|
||||
*n = Nonce::next(index(), *n, rounds * roundSize, currentJob().isNicehash(), &ok);
|
||||
}
|
||||
else {
|
||||
*nonce() += roundSize;
|
||||
*n += roundSize;
|
||||
}
|
||||
|
||||
// Increment higher 32 bits of a 64-bit nonce when lower 32 bits overflow
|
||||
if (!currentJob().isNicehash() && (nonceSize() == sizeof(uint64_t)) && (*n < prev_nonce)) {
|
||||
++n[1];
|
||||
|
||||
Job& job = m_jobs[index()];
|
||||
memcpy(job.blob(), blob(), job.size());
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -109,6 +109,11 @@ void xmrig::Workers<T>::start(const std::vector<T> &data)
|
|||
|
||||
for (Thread<T> *worker : m_workers) {
|
||||
worker->start(Workers<T>::onReady);
|
||||
|
||||
// This sleep is important for optimal caching!
|
||||
// Threads must allocate scratchpads in order so that adjacent cores will use adjacent scratchpads
|
||||
// Sub-optimal caching can result in up to 0.5% hashrate penalty
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,7 +168,7 @@ void xmrig::Workers<T>::onReady(void *arg)
|
|||
assert(worker != nullptr);
|
||||
|
||||
if (!worker || !worker->selfTest()) {
|
||||
LOG_ERR("%s " RED("thread ") RED_BOLD("#%zu") RED(" self-test failed"), T::tag(), worker->id());
|
||||
LOG_ERR("%s " RED("thread ") RED_BOLD("#%zu") RED(" self-test failed"), T::tag(), worker ? worker->id() : 0);
|
||||
|
||||
handle->backend()->start(worker, false);
|
||||
delete worker;
|
||||
|
|
|
@ -47,6 +47,7 @@ namespace xmrig {
|
|||
|
||||
class Hashrate;
|
||||
class WorkersPrivate;
|
||||
class Job;
|
||||
|
||||
|
||||
template<class T>
|
||||
|
@ -63,6 +64,7 @@ public:
|
|||
void start(const std::vector<T> &data);
|
||||
void stop();
|
||||
void tick(uint64_t ticks);
|
||||
void jobEarlyNotification(const Job&);
|
||||
|
||||
private:
|
||||
static IWorker *create(Thread<T> *handle);
|
||||
|
@ -73,6 +75,17 @@ private:
|
|||
};
|
||||
|
||||
|
||||
template<class T>
|
||||
void xmrig::Workers<T>::jobEarlyNotification(const Job& job)
|
||||
{
|
||||
for (Thread<T>* t : m_workers) {
|
||||
if (t->worker()) {
|
||||
t->worker()->jobEarlyNotification(job);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
IWorker *Workers<CpuLaunchData>::create(Thread<CpuLaunchData> *handle);
|
||||
extern template class Workers<CpuLaunchData>;
|
||||
|
|
|
@ -4,7 +4,6 @@ set(HEADERS_BACKEND_COMMON
|
|||
src/backend/common/interfaces/IBackend.h
|
||||
src/backend/common/interfaces/IRxListener.h
|
||||
src/backend/common/interfaces/IRxStorage.h
|
||||
src/backend/common/interfaces/IThread.h
|
||||
src/backend/common/interfaces/IWorker.h
|
||||
src/backend/common/misc/PciTopology.h
|
||||
src/backend/common/Thread.h
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -29,7 +29,7 @@
|
|||
#include <cstdint>
|
||||
|
||||
|
||||
#include "rapidjson/fwd.h"
|
||||
#include "3rdparty/rapidjson/fwd.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
@ -56,6 +56,7 @@ public:
|
|||
virtual void execCommand(char command) = 0;
|
||||
virtual void prepare(const Job &nextJob) = 0;
|
||||
virtual void printHashrate(bool details) = 0;
|
||||
virtual void printHealth() = 0;
|
||||
virtual void setJob(const Job &job) = 0;
|
||||
virtual void start(IWorker *worker, bool ready) = 0;
|
||||
virtual void stop() = 0;
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
#define XMRIG_IRXSTORAGE_H
|
||||
|
||||
|
||||
#include "crypto/rx/RxConfig.h"
|
||||
#include "crypto/common/HugePagesInfo.h"
|
||||
|
||||
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
|
@ -41,9 +45,10 @@ class IRxStorage
|
|||
public:
|
||||
virtual ~IRxStorage() = default;
|
||||
|
||||
virtual RxDataset *dataset(const Job &job, uint32_t nodeId) const = 0;
|
||||
virtual std::pair<uint32_t, uint32_t> hugePages() const = 0;
|
||||
virtual void init(const RxSeed &seed, uint32_t threads, bool hugePages) = 0;
|
||||
virtual bool isAllocated() const = 0;
|
||||
virtual HugePagesInfo hugePages() const = 0;
|
||||
virtual RxDataset *dataset(const Job &job, uint32_t nodeId) const = 0;
|
||||
virtual void init(const RxSeed &seed, uint32_t threads, bool hugePages, bool oneGbPages, RxConfig::Mode mode, int priority) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2016-2018 XMRig <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_ITHREAD_H
|
||||
#define XMRIG_ITHREAD_H
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#include "crypto/common/Algorithm.h"
|
||||
#include "rapidjson/fwd.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class IThread
|
||||
{
|
||||
public:
|
||||
enum Type {
|
||||
CPU,
|
||||
OpenCL,
|
||||
CUDA
|
||||
};
|
||||
|
||||
enum Multiway {
|
||||
SingleWay = 1,
|
||||
DoubleWay,
|
||||
TripleWay,
|
||||
QuadWay,
|
||||
PentaWay
|
||||
};
|
||||
|
||||
virtual ~IThread() = default;
|
||||
|
||||
virtual Algorithm algorithm() const = 0;
|
||||
virtual int priority() const = 0;
|
||||
virtual int64_t affinity() const = 0;
|
||||
virtual Multiway multiway() const = 0;
|
||||
virtual rapidjson::Value toConfig(rapidjson::Document &doc) const = 0;
|
||||
virtual size_t index() const = 0;
|
||||
virtual Type type() const = 0;
|
||||
|
||||
# ifdef XMRIG_FEATURE_API
|
||||
virtual rapidjson::Value toAPI(rapidjson::Document &doc) const = 0;
|
||||
# endif
|
||||
|
||||
# ifdef APP_DEBUG
|
||||
virtual void print() const = 0;
|
||||
# endif
|
||||
};
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif // XMRIG_ITHREAD_H
|
|
@ -34,6 +34,7 @@ namespace xmrig {
|
|||
|
||||
|
||||
class VirtualMemory;
|
||||
class Job;
|
||||
|
||||
|
||||
class IWorker
|
||||
|
@ -48,6 +49,7 @@ public:
|
|||
virtual uint64_t hashCount() const = 0;
|
||||
virtual uint64_t timestamp() const = 0;
|
||||
virtual void start() = 0;
|
||||
virtual void jobEarlyNotification(const Job&) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -27,7 +27,7 @@
|
|||
|
||||
|
||||
#include "backend/cpu/Cpu.h"
|
||||
#include "rapidjson/document.h"
|
||||
#include "3rdparty/rapidjson/document.h"
|
||||
|
||||
|
||||
#if defined(XMRIG_FEATURE_HWLOC)
|
||||
|
@ -60,39 +60,12 @@ xmrig::ICpuInfo *xmrig::Cpu::info()
|
|||
|
||||
rapidjson::Value xmrig::Cpu::toJSON(rapidjson::Document &doc)
|
||||
{
|
||||
using namespace rapidjson;
|
||||
auto &allocator = doc.GetAllocator();
|
||||
|
||||
ICpuInfo *i = info();
|
||||
Value cpu(kObjectType);
|
||||
Assembly assembly(i->assembly());
|
||||
|
||||
cpu.AddMember("brand", StringRef(i->brand()), allocator);
|
||||
cpu.AddMember("aes", i->hasAES(), allocator);
|
||||
cpu.AddMember("avx2", i->hasAVX2(), allocator);
|
||||
cpu.AddMember("x64", ICpuInfo::isX64(), allocator);
|
||||
cpu.AddMember("l2", static_cast<uint64_t>(i->L2()), allocator);
|
||||
cpu.AddMember("l3", static_cast<uint64_t>(i->L3()), allocator);
|
||||
cpu.AddMember("cores", static_cast<uint64_t>(i->cores()), allocator);
|
||||
cpu.AddMember("threads", static_cast<uint64_t>(i->threads()), allocator);
|
||||
cpu.AddMember("packages", static_cast<uint64_t>(i->packages()), allocator);
|
||||
cpu.AddMember("nodes", static_cast<uint64_t>(i->nodes()), allocator);
|
||||
cpu.AddMember("backend", StringRef(i->backend()), allocator);
|
||||
|
||||
# ifdef XMRIG_FEATURE_ASM
|
||||
cpu.AddMember("assembly", StringRef(assembly.toString()), allocator);
|
||||
# else
|
||||
cpu.AddMember("assembly", "none", allocator);
|
||||
# endif
|
||||
|
||||
return cpu;
|
||||
return info()->toJSON(doc);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Cpu::release()
|
||||
{
|
||||
assert(cpuInfo != nullptr);
|
||||
|
||||
delete cpuInfo;
|
||||
cpuInfo = nullptr;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue