File: get-knl-modes.c

package info (click to toggle)
hwloc 2.12.0-4~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 23,576 kB
  • sloc: ansic: 60,875; xml: 13,559; sh: 7,332; makefile: 2,154; javascript: 879; cpp: 93; php: 8; sed: 5
file content (37 lines) | stat: -rw-r--r-- 908 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* This example program shows how to retrieve Knights Landing
 * memory and cluster modes.
 * See "Custom string infos" in the documentation for details
 * about these attributes.
 *
 * Copyright © 2015-2016, 2015 Intel
 * Copyright © 2016 Inria.  All rights reserved.
 * See COPYING in top-level directory.
 */

#include <stdio.h>
#include <stdlib.h>

#include "hwloc.h"

int main(void)
{
	hwloc_topology_t topology;
	hwloc_obj_t root;
	const char *cluster_mode;
	const char *memory_mode;

	hwloc_topology_init(&topology);
	hwloc_topology_load(topology);

	root = hwloc_get_root_obj(topology);

	cluster_mode = hwloc_obj_get_info_by_name(root, "ClusterMode");
	memory_mode = hwloc_obj_get_info_by_name(root, "MemoryMode");

	printf ("ClusterMode is '%s' MemoryMode is '%s'\n",
		cluster_mode ? cluster_mode : "NULL",
		memory_mode ? memory_mode : "NULL");

	hwloc_topology_destroy(topology);
	return 0;
}