Эмулируйте машину NUMA с virt-менеджером

Я должен разработать программу C, которая пользуется libnuma библиотекой. Но у меня нет машины NUMA дома, и функция numa_avaiable () возвращается 0.

Я хотел бы эмулировать машину NUMA. Так, я установил qemu и virt-менеджера. Но, в мастере для создания виртуальной машины я не нашел опции создать машину NUMA.

Возможно сделать это? Существуют другие альтернативы?

Заранее спасибо,

1
задан 1 October 2018 в 04:40

1 ответ

От QEMU 3.0.0 документации

qemu-system-XXXyour_machineXXX [options] [disk_image]

Option:
-numa node[,mem=size][,cpus=firstcpu[-lastcpu]][,nodeid=node]
-numa node[,memdev=id][,cpus=firstcpu[-lastcpu]][,nodeid=node]
-numa dist,src=source,dst=destination,val=distance
-numa cpu,node-id=node[,socket-id=x][,core-id=y][,thread-id=z] 

Define a NUMA node and assign RAM and VCPUs to it. Set the NUMA distance from 
a source node to a destination node.

Legacy VCPU assignment uses ‘cpus’ option where firstcpu and lastcpu are CPU
indexes. Each ‘cpus’ option represent a contiguous range of CPU indexes (or a
single VCPU if lastcpu is omitted). A non-contiguous set of VCPUs can be
represented by providing multiple ‘cpus’ options. If ‘cpus’ is omitted on all 
nodes, VCPUs are automatically split between them.

For example, the following option assigns VCPUs 0, 1, 2 and 5 to a NUMA node:

    -numa node,cpus=0-2,cpus=5 

‘cpu’ option is a new alternative to ‘cpus’ option which uses ‘socket-
id|core-id|thread-id’ properties to assign CPU objects to a node using 
topology layout properties of CPU. The set of properties is machine specific,
and depends on used machine type/‘smp’ options. It could be queried with 
‘hotpluggable-cpus’ monitor command. ‘node-id’ property specifies node to which
CPU object will be assigned, it’s required for node to be declared with
‘node’ option before it’s used with ‘cpu’ option.

For example:

-M pc \
-smp 1,sockets=2,maxcpus=2 \
-numa node,nodeid=0 -numa node,nodeid=1 \
-numa cpu,node-id=0,socket-id=0 -numa cpu,node-id=1,socket-id=1 

‘mem’ assigns a given RAM amount to a node. ‘memdev’ assigns RAM from a given 
memory backend device to a node. If ‘mem’ and ‘memdev’ are omitted in all 
nodes, RAM is split equally between them.

‘mem’ and ‘memdev’ are mutually exclusive. Furthermore, if one node uses
‘memdev’, all of them have to use it.

source and destination are NUMA node IDs. distance is the NUMA distance from
source to destination. The distance from a node to itself is always 10. If 
any pair of nodes is given a distance, then all pairs must be given 
distances. Although, when distances are only given in one direction for each 
pair of nodes, then the distances in the opposite directions are assumed to
be the same. If, however, an asymmetrical pair of distances is given for even 
one node pair, then all node pairs must be provided distance values for both
directions, even when they are symmetrical. When a node is unreachable from 
another node, set the pair’s distance to 255.

Note that the -numa option doesn’t allocate any of the specified resources, 
it just assigns existing resources to NUMA nodes. This means that one still
has to use the -m, -smp options to allocate RAM and VCPUs respectively.

Можно смотреть на это учебное руководство, как настроить машину VM.

0
ответ дан 12 November 2019 в 03:57

Другие вопросы по тегам:

Похожие вопросы: