#!/bin/bash

if [[ $(basename $(pwd)) == "bin" ]]; then
    cd ..
fi

if [[ $HOSTNAME == "tuxedi" ]]; then
    sudo performance.sh
fi

export MPLBACKEND=qt5agg

# instead of 8, use the number of fast CPU cores you have
GCT="--gcthreads=7,1"

julia_version=$(julia --version | awk '{print($3)}')
julia_major=${julia_version:0:3} 
branch=$(git rev-parse --abbrev-ref HEAD)

if test -f "bin/kps-image-${julia_major}-${branch}.so"; then
    echo "Found system image!"
    julia -J  bin/kps-image-${julia_major}-${branch}.so -t 8,1 $GCT --project
else
    julia --project -t 7,1 $GCT
    # julia --project
fi
