Files
compute-runtime/shared/source/os_interface/linux/numa_library.h
Yoon, Young Jin 9c7578f5f4 fix: change numa_library to read default policy
Changed NumaLibrary to read default policy instead of using
the address-based policy, and remove unnecessary argument.

Removed numaif.h from the repo as it is no longer required.

Related-To: NEO-8276
Signed-off-by: Yoon, Young Jin <young.jin.yoon@intel.com>
2024-01-19 08:31:41 +01:00

46 lines
1.5 KiB
C++

/*
* Copyright (C) 2023-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/os_interface/linux/os_library_linux.h"
#include "shared/source/os_interface/os_library.h"
#include <cstddef>
#include <cstdint>
#include <memory>
#include <vector>
namespace NEO {
namespace Linux {
class NumaLibrary {
public:
static bool init();
static bool isLoaded() { return numaLoaded; }
static bool getMemPolicy(int *mode, std::vector<unsigned long> &nodeMask);
protected:
static constexpr const char *numaLibNameStr = "libnuma.so.1";
static constexpr const char *procGetMemPolicyStr = "get_mempolicy";
static constexpr const char *procNumaAvailableStr = "numa_available";
static constexpr const char *procNumaMaxNodeStr = "numa_max_node";
using OsLibraryLoadPtr = std::add_pointer<NEO::OsLibrary *(const std::string &)>::type;
using GetMemPolicyPtr = std::add_pointer<long(int *, unsigned long[], unsigned long, void *, unsigned long)>::type;
using NumaAvailablePtr = std::add_pointer<int(void)>::type;
using NumaMaxNodePtr = std::add_pointer<int(void)>::type;
static std::unique_ptr<NEO::OsLibrary> osLibrary;
static OsLibraryLoadPtr osLibraryLoadFunction;
static GetMemPolicyPtr getMemPolicyFunction;
static NumaAvailablePtr numaAvailableFunction;
static NumaMaxNodePtr numaMaxNodeFunction;
static int maxNode;
static bool numaLoaded;
};
} // namespace Linux
} // namespace NEO