uwplse / herbgrind

A Valgrind tool for Herbie
GNU General Public License v3.0
90 stars 7 forks source link

Options for Herbgring #53

Closed jtarango closed 4 years ago

jtarango commented 4 years ago

Hello,

I have been using large machine learning and artificial intelligence programs.

(1) A common problem I have been encountering are stack and heap issues. (Solution) I have been able to resolve these with the following: --main-stacksize=99999999 --max-stackframe=99999999 --valgrind-stacksize=10485760 --num-callers=500

(2) When attempting to add additional options to herbgrind; I am getting these options do not exist (options) --detailed-ranges --follow-real-execution --print-object-files --expr-colors --ignore-pure-zeroes --no-sound-simplify --shortmark-all-exprs

The question I have are: (A) Do you all support stack split? (B) How do we pass variables flags for herbgrind?

Example Script

!/usr/bin/env bash

exit on error

set -e

determine physical directory of this script

src="${BASH_SOURCE[0]}" while [ -L "$src" ]; do dir="$(cd -P "$(dirname "$src")" && pwd)" src="$(readlink "$src")" [[ $src != /* ]] && src="$dir/$src" done MYDIR="$(cd -P "$(dirname "$src")" && pwd)" PDIR="/home/jtarango/" PGM="$PDIR/dp $PDIR/data $PDIR/query" TODAY=date +%Y-%m-%d.%H:%M:%S REDIRECT="2>&1 | tee $PDIR/dpLog-$HOSTNAME-$TODAY.txt"

HG="$MYDIR/valgrind/herbgrind-install/bin/valgrind --tool=herbgrind --detailed-ranges --follow-real-execution --print-object-files --expr-colors --ignore-pure-zeroes --no-sound-simplify --shortmark-all-exprs --error-threshold=1 --precision=1000 --main-stacksize=99999999 --max-stackframe=99999999 --valgrind-stacksize=10485760 --num-callers=500 --verbose $PGM $REDIRECT"

$HG "$@"

jtarango commented 4 years ago

Fixed the issue by the following:

!/usr/bin/env bash

determine physical directory of this script

src="${BASH_SOURCE[0]}" while [ -L "$src" ]; do dir="$(cd -P "$(dirname "$src")" && pwd)" src="$(readlink "$src")" [[ $src != /* ]] && src="$dir/$src" done MYDIR="$(cd -P "$(dirname "$src")" && pwd)" PDIR="/home/jtarango/dp" PGM="$PDIR/dp $PDIR/data $PDIR/query" TODAY=date +%Y-%m-%d.%H:%M:%S REDIRECT="2>&1 | tee $PDIR/Log-$HOSTNAME-$TODAY.txt" EXTRAPARAM="--detailed-ranges --follow-real-exeuction --print-object-files --expr-colors --ignore-pure-zeroes --no-sound-simplify --shortmark-all-exprs"

HG="$MYDIR/valgrind/herbgrind-install/bin/valgrind --tool=herbgrind --error-threshold=1 --precision=1000 --main-stacksize=99999999 --max-stackframe=99999999 --valgrind-stacksize=10485760 --num-callers=500 --verbose $PGM $REDIRECT"

$HG "$@" $EXTRAPARAM

HazardousPeach commented 4 years ago

Hey @jtarango , I'm not quite sure, what you meant by "stack split" or "variable flags", but it looks like you figured out your particular issue. I think the reason you were getting "these options don't exist" is because Valgrind has two types of options: there are the Valgrind-core options, like --main-stacksize, and then there are tool options (in this case, Herbgrind options), like --detailed-ranges. I think you can't interleave these options (although your solution seems to do so... maybe I don't know), it's safest to do core options, then the tool specifier, then tool options. Anyway, since you've closed the issue I hope things are going smoothly, but please let me know if you have any other questions! It looks like you're using Herbgrind in an interesting domain, I'd love to hear more about your work over email.

-Alex

jtarango commented 4 years ago

For sure, as soon as I have these next few conference papers submitted. I have interesting ideas to integrate some work to accelerate ML and AI.

Stack split is a GCC feature for large programs so that when it runs out of space it will create a new split for the stack to build again. https://gcc.gnu.org/wiki/SplitStacks