Blame test/run_alloc_benchmark.sh

Packit Service 724aca
#!/bin/bash
Packit Service 724aca
#
Packit Service 724aca
#  Copyright (C) 2014 - 2018 Intel Corporation.
Packit Service 724aca
#  All rights reserved.
Packit Service 724aca
#
Packit Service 724aca
#  Redistribution and use in source and binary forms, with or without
Packit Service 724aca
#  modification, are permitted provided that the following conditions are met:
Packit Service 724aca
#  1. Redistributions of source code must retain the above copyright notice(s),
Packit Service 724aca
#     this list of conditions and the following disclaimer.
Packit Service 724aca
#  2. Redistributions in binary form must reproduce the above copyright notice(s),
Packit Service 724aca
#     this list of conditions and the following disclaimer in the documentation
Packit Service 724aca
#     and/or other materials provided with the distribution.
Packit Service 724aca
#
Packit Service 724aca
#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS
Packit Service 724aca
#  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
Packit Service 724aca
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
Packit Service 724aca
#  EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
Packit Service 724aca
#  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Packit Service 724aca
#  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Packit Service 724aca
#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
Packit Service 724aca
#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
Packit Service 724aca
#  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
Packit Service 724aca
#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit Service 724aca
#
Packit Service 724aca
Packit Service 724aca
# Allocator
Packit Service 724aca
ALLOCATOR="glibc tbb hbw pmem"
Packit Service 724aca
# Thread configuration
Packit Service 724aca
THREADS=(1 2 4 8 16 18 36)
Packit Service 724aca
# Memory configuration (in kB) / iterations
Packit Service 724aca
MEMORY=(1 4 16 64 256 1024 4096 16384)
Packit Service 724aca
# Iterations
Packit Service 724aca
ITERS=1000
Packit Service 724aca
Packit Service 724aca
export KMP_AFFINITY=scatter,granularity=fine
Packit Service 724aca
Packit Service 724aca
# For each algorithm
Packit Service 724aca
for alloc in $ALLOCATOR
Packit Service 724aca
do
Packit Service 724aca
    rm -f alloctest_$alloc.txt
Packit Service 724aca
    echo "# Number of threads, allocation size [kB], average malloc and free time [ms], average allocation time [ms], \
Packit Service 724aca
average free time [ms], first allocation time [ms], first free time [ms]" >> alloctest_$alloc.txt
Packit Service 724aca
    # For each number of threads
Packit Service 724aca
    for nthr in ${THREADS[*]}
Packit Service 724aca
    do
Packit Service 724aca
        # For each amount of memory
Packit Service 724aca
        for mem in ${MEMORY[*]}
Packit Service 724aca
        do
Packit Service 724aca
            echo "OMP_NUM_THREADS=$nthr ./alloc_benchmark_$alloc $ITERS $mem >> alloctest_$alloc.txt"
Packit Service 724aca
            OMP_NUM_THREADS=$nthr ./alloc_benchmark_$alloc $ITERS $mem >> alloctest_$alloc.txt
Packit Service 724aca
            ret=$?
Packit Service 724aca
            if [ $ret -ne 0 ]; then
Packit Service 724aca
                echo "Error: alloc_benchmark_$alloc returned $ret"
Packit Service 724aca
                exit
Packit Service 724aca
            fi
Packit Service 724aca
        done
Packit Service 724aca
    done
Packit Service 724aca
done
Packit Service 724aca
Packit Service 724aca
echo "Data collected. You can draw performance plots using python draw_plots.py."