<commit_before>#! /bin/sh
#
# Create a snabbswitch loadgen and nfv instance which connect to the
# selected NICs and one guest. The selected NICs should be physically
# wired in order to route traffic from loadgen to the guest.
#
# Consult NIC wiring table for connections.
#
# Topology:
# snabbswitch loadgen -> NIC_0 = NIC_1 <- snabbswitch nfv <- guest
#

GUESTS="1"
. $(dirname $0)/include_checks.sh

# Execute snabbswitch loadgen instance
numactl --cpunodebind=$NODE_BIND1 --membind=$NODE_BIND1 \
    $SNABB $LOADGEN $PCAP $NFV_PCI1 > $SNABB_LOG1 2>&1 &
SNABB_PID1=$!

# Execute QEMU on the same node
numactl --cpunodebind=$NODE_BIND0 --membind=$NODE_BIND0 \
    $QEMU \
        -M pc -cpu kvm64 -smp 1 -cpu host --enable-kvm \
        -m $GUEST_MEM -numa node,memdev=mem \
        -object memory-file,id=mem,size=$GUEST_MEM"M",mem-path=$HUGETLBFS,share=on \
        -chardev socket,id=char0,path=$NFV_SOCKET0,server \
        -netdev type=vhost-user,id=net0,chardev=char0 \
        -serial telnet:localhost:$TELNET_PORT0,server,nowait \
        -device virtio-net-pci,netdev=net0,mac=$GUEST_MAC0 \
        -kernel $KERNEL -append "$BOOTARGS0" \
        -drive if=virtio,file=$IMAGE0 \
        -nographic > /dev/null 2>&1 &
QEMU_PID0=$!

printf "Connect to guests with:\n"
printf "telnet localhost $TELNET_PORT0\n"

# Execute snabbswitch and pin it to a proper node (CPU and memory)
export NFV_PCI=$NFV_PCI0 NFV_SOCKET=$NFV_SOCKET0
numactl --cpunodebind=$NODE_BIND1 --membind=$NODE_BIND0 \
    $SNABB $NFV $NFV_PACKETS

{ echo "poweroff"; sleep 1; } | telnet localhost $TELNET_PORT0 > /dev/null 2>&1<commit_msg>bench: bind snabbswitch to NUMA node 0<commit_after>#! /bin/sh
#
# Create a snabbswitch loadgen and nfv instance which connect to the
# selected NICs and one guest. The selected NICs should be physically
# wired in order to route traffic from loadgen to the guest.
#
# Consult NIC wiring table for connections.
#
# Topology:
# snabbswitch loadgen -> NIC_0 = NIC_1 <- snabbswitch nfv <- guest
#

GUESTS="1"
. $(dirname $0)/include_checks.sh

# Execute snabbswitch loadgen instance
numactl --cpunodebind=$NODE_BIND1 --membind=$NODE_BIND1 \
    $SNABB $LOADGEN $PCAP $NFV_PCI1 > $SNABB_LOG1 2>&1 &
SNABB_PID1=$!

# Execute QEMU on the same node
numactl --cpunodebind=$NODE_BIND0 --membind=$NODE_BIND0 \
    $QEMU \
        -M pc -cpu kvm64 -smp 1 -cpu host --enable-kvm \
        -m $GUEST_MEM -numa node,memdev=mem \
        -object memory-file,id=mem,size=$GUEST_MEM"M",mem-path=$HUGETLBFS,share=on \
        -chardev socket,id=char0,path=$NFV_SOCKET0,server \
        -netdev type=vhost-user,id=net0,chardev=char0 \
        -serial telnet:localhost:$TELNET_PORT0,server,nowait \
        -device virtio-net-pci,netdev=net0,mac=$GUEST_MAC0 \
        -kernel $KERNEL -append "$BOOTARGS0" \
        -drive if=virtio,file=$IMAGE0 \
        -nographic > /dev/null 2>&1 &
QEMU_PID0=$!

printf "Connect to guests with:\n"
printf "telnet localhost $TELNET_PORT0\n"

# Execute snabbswitch and pin it to a proper node (CPU and memory)
export NFV_PCI=$NFV_PCI0 NFV_SOCKET=$NFV_SOCKET0
numactl --cpunodebind=$NODE_BIND0 --membind=$NODE_BIND0 \
    $SNABB $NFV $NFV_PACKETS

{ echo "poweroff"; sleep 1; } | telnet localhost $TELNET_PORT0 > /dev/null 2>&1
{'fraction_non_alphanumeric': 0.12135176651305683, 'fraction_numerical': 0.02304147465437788, 'mean_word_length': 3.6184397163120567, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4548216', 'n_tokens_mistral': 1283, 'n_tokens_neox': 1261, 'n_words': 301}