#!/bin/bash

echo "create regular fio configuration and run"

echo "[global]
rw=write
size=4G
blocksize=2M
iodepth=4
fsync_on_close=1
direct=0
numjobs=1

[md0-1]
numa_cpu_nodes=0
numa_mem_policy=bind:0
filename=/mnt/array0/file1

[md0-2]
numa_cpu_nodes=0
numa_mem_policy=bind:0
filename=/mnt/array0/file2

[md0-3]
numa_cpu_nodes=0
numa_mem_policy=bind:0
filename=/mnt/array0/file3

[md0-4]
numa_cpu_nodes=0
numa_mem_policy=bind:0
filename=/mnt/array0/file4

[md0-5]
numa_cpu_nodes=0
numa_mem_policy=bind:0
filename=/mnt/array0/file5

[md0-6]
numa_cpu_nodes=0
numa_mem_policy=bind:0
filename=/mnt/array0/file6


[md1-1]
numa_cpu_nodes=1
numa_mem_policy=bind:1
#filename=/dev/md1
filename=/mnt/array1/file1

[md1-2]
numa_cpu_nodes=1
numa_mem_policy=bind:1
filename=/mnt/array1/file2

[md1-3]
numa_cpu_nodes=1
numa_mem_policy=bind:1
filename=/mnt/array1/file3

[md1-4]
numa_cpu_nodes=1
numa_mem_policy=bind:1
filename=/mnt/array1/file4

[md1-5]
numa_cpu_nodes=1
numa_mem_policy=bind:1
filename=/mnt/array1/file5

[md1-6]
numa_cpu_nodes=1
numa_mem_policy=bind:1
filename=/mnt/array1/file6

[md2-1]
numa_cpu_nodes=2
numa_mem_policy=bind:2
#filename=/dev/md2
filename=/mnt/array2/file1

[md2-2]
numa_cpu_nodes=2
numa_mem_policy=bind:2
filename=/mnt/array2/file2

[md2-3]
numa_cpu_nodes=2
numa_mem_policy=bind:2
filename=/mnt/array2/file3

[md2-4]
numa_cpu_nodes=2
numa_mem_policy=bind:2
filename=/mnt/array2/file4

[md2-5]
numa_cpu_nodes=2
numa_mem_policy=bind:2
filename=/mnt/array2/file5

[md2-6]
numa_cpu_nodes=2
numa_mem_policy=bind:2
filename=/mnt/array2/file6

[md3-1]
numa_cpu_nodes=3
numa_mem_policy=bind:3
#filename=/dev/md3
filename=/mnt/array3/file1

[md3-2]
numa_cpu_nodes=3
numa_mem_policy=bind:3
filename=/mnt/array3/file2

[md3-3]
numa_cpu_nodes=3
numa_mem_policy=bind:3
filename=/mnt/array3/file3

[md3-4]
numa_cpu_nodes=3
numa_mem_policy=bind:3
filename=/mnt/array3/file4

[md3-5]
numa_cpu_nodes=3
numa_mem_policy=bind:3
filename=/mnt/array3/file5

[md3-6]
numa_cpu_nodes=3
numa_mem_policy=bind:3
filename=/mnt/array3/file6" > regular_thread6_file6

echo "Regular, thread=6, file=6, ignore round-1 to avoid get wrong performance" 
fio regular_thread6_file6 | grep WRITE

echo "Regular, thread=6, file=6, round-2"
fio regular_thread6_file6 | grep WRITE

echo "Regular, thread=6, file=6, round-3"
fio regular_thread6_file6 | grep WRITE

echo "Regular, thread=6, file=6, round-4"
fio regular_thread6_file6 | grep WRITE

echo "create direct fio configuration and run"

echo "[global]
rw=write
size=4G
blocksize=2M
iodepth=4
fsync_on_close=1
direct=1
numjobs=1

[md0-1]
numa_cpu_nodes=0
numa_mem_policy=bind:0
filename=/mnt/array0/file1

[md0-2]
numa_cpu_nodes=0
numa_mem_policy=bind:0
filename=/mnt/array0/file2

[md0-3]
numa_cpu_nodes=0
numa_mem_policy=bind:0
filename=/mnt/array0/file3

[md0-4]
numa_cpu_nodes=0
numa_mem_policy=bind:0
filename=/mnt/array0/file4

[md0-5]
numa_cpu_nodes=0
numa_mem_policy=bind:0
filename=/mnt/array0/file5

[md0-6]
numa_cpu_nodes=0
numa_mem_policy=bind:0
filename=/mnt/array0/file6


[md1-1]
numa_cpu_nodes=1
numa_mem_policy=bind:1
#filename=/dev/md1
filename=/mnt/array1/file1

[md1-2]
numa_cpu_nodes=1
numa_mem_policy=bind:1
filename=/mnt/array1/file2

[md1-3]
numa_cpu_nodes=1
numa_mem_policy=bind:1
filename=/mnt/array1/file3

[md1-4]
numa_cpu_nodes=1
numa_mem_policy=bind:1
filename=/mnt/array1/file4

[md1-5]
numa_cpu_nodes=1
numa_mem_policy=bind:1
filename=/mnt/array1/file5

[md1-6]
numa_cpu_nodes=1
numa_mem_policy=bind:1
filename=/mnt/array1/file6

[md2-1]
numa_cpu_nodes=2
numa_mem_policy=bind:2
#filename=/dev/md2
filename=/mnt/array2/file1

[md2-2]
numa_cpu_nodes=2
numa_mem_policy=bind:2
filename=/mnt/array2/file2

[md2-3]
numa_cpu_nodes=2
numa_mem_policy=bind:2
filename=/mnt/array2/file3

[md2-4]
numa_cpu_nodes=2
numa_mem_policy=bind:2
filename=/mnt/array2/file4

[md2-5]
numa_cpu_nodes=2
numa_mem_policy=bind:2
filename=/mnt/array2/file5

[md2-6]
numa_cpu_nodes=2
numa_mem_policy=bind:2
filename=/mnt/array2/file6

[md3-1]
numa_cpu_nodes=3
numa_mem_policy=bind:3
#filename=/dev/md3
filename=/mnt/array3/file1

[md3-2]
numa_cpu_nodes=3
numa_mem_policy=bind:3
filename=/mnt/array3/file2

[md3-3]
numa_cpu_nodes=3
numa_mem_policy=bind:3
filename=/mnt/array3/file3

[md3-4]
numa_cpu_nodes=3
numa_mem_policy=bind:3
filename=/mnt/array3/file4

[md3-5]
numa_cpu_nodes=3
numa_mem_policy=bind:3
filename=/mnt/array3/file5

[md3-6]
numa_cpu_nodes=3
numa_mem_policy=bind:3
filename=/mnt/array3/file6" > direct_thread6_file6

echo "Direct, thread=6, file=6, ignore round-1 to avoid get wrong performance"
fio direct_thread6_file6 | grep WRITE

echo "Direct, thread=6, file=6, round-2"
fio direct_thread6_file6 | grep WRITE

echo "Direct, thread=6, file=6, round-3"
fio direct_thread6_file6 | grep WRITE

echo "Direct, thread=6, file=6, round-4"
fio direct_thread6_file6 | grep WRITE

echo "TEST Done"



