[dpdk-dev] [PATCH v4] build: optional NUMA and cpu counts detection
Stephen Hemminger
stephen at networkplumber.org
Tue Jun 29 20:00:15 CEST 2021
On Tue, 29 Jun 2021 12:55:05 +0200
Juraj Linkeš <juraj.linkes at pantheon.tech> wrote:
> diff --git a/buildtools/get-numa-count.py b/buildtools/get-numa-count.py
> new file mode 100644
> index 0000000000..3b67564fd4
> --- /dev/null
> +++ b/buildtools/get-numa-count.py
> @@ -0,0 +1,24 @@
> +#!/usr/bin/env python3
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright (c) 2021 PANTHEON.tech s.r.o.
> +
> +import ctypes
> +import glob
> +import os
> +import subprocess
> +
> +if os.name == 'posix':
> + if os.path.isdir('/sys/devices/system/node'):
> + numa_nodes = glob.glob('/sys/devices/system/node/node*')
> + numa_nodes.sort()
> + print(os.path.basename(numa_nodes[-1])[4:])
> + else:
> + subprocess.run(['sysctl', '-n', 'vm.ndomains'])
> +
python lint has warning here
buildtools/get-numa-count.py:16:8: W1510: Using subprocess.run without explicitly set `check` is not recommended. (subprocess-run-check)
More information about the dev
mailing list