Re: Small improvements to run_spec_clang_asan.sh

2014-10-02 Thread 'Evgeniy Stepanov' via address-sanitizer
Done.

On Wed, Oct 1, 2014 at 8:18 PM, Yuri Gribov  wrote:
> Cool! Could someone apply this then?
>
> On Wed, Oct 1, 2014 at 2:18 PM, 'Evgeniy Stepanov' via
> address-sanitizer  wrote:
>> Sorry, my bad, missed the "$" sign.
>>
>>
>> On Wed, Oct 1, 2014 at 2:03 PM, Yuri Gribov  wrote:
>>> On Wed, Oct 1, 2014 at 1:56 PM, 'Evgeniy Stepanov' via
>>> address-sanitizer  wrote:
> CLANGXX=${CLANGXX:-$(echo $CLANG | sed -e 's/gcc$/g++/')}
 What if there is more than one "gcc" in the compiler path?
>>>
>>> Sorry, don't understand... I'm just replacing trailing gcc with g++ so
>>> e.g. path/to/my/cross-gcc becomes path/to/my/cross-g++.
>>>
>>> -Y
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "address-sanitizer" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>> email to address-sanitizer+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "address-sanitizer" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to address-sanitizer+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "address-sanitizer" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to address-sanitizer+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to address-sanitizer+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Small improvements to run_spec_clang_asan.sh

2014-10-01 Thread Yuri Gribov
Cool! Could someone apply this then?

On Wed, Oct 1, 2014 at 2:18 PM, 'Evgeniy Stepanov' via
address-sanitizer  wrote:
> Sorry, my bad, missed the "$" sign.
>
>
> On Wed, Oct 1, 2014 at 2:03 PM, Yuri Gribov  wrote:
>> On Wed, Oct 1, 2014 at 1:56 PM, 'Evgeniy Stepanov' via
>> address-sanitizer  wrote:
 CLANGXX=${CLANGXX:-$(echo $CLANG | sed -e 's/gcc$/g++/')}
>>> What if there is more than one "gcc" in the compiler path?
>>
>> Sorry, don't understand... I'm just replacing trailing gcc with g++ so
>> e.g. path/to/my/cross-gcc becomes path/to/my/cross-g++.
>>
>> -Y
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "address-sanitizer" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to address-sanitizer+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "address-sanitizer" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to address-sanitizer+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to address-sanitizer+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Small improvements to run_spec_clang_asan.sh

2014-10-01 Thread 'Evgeniy Stepanov' via address-sanitizer
Sorry, my bad, missed the "$" sign.


On Wed, Oct 1, 2014 at 2:03 PM, Yuri Gribov  wrote:
> On Wed, Oct 1, 2014 at 1:56 PM, 'Evgeniy Stepanov' via
> address-sanitizer  wrote:
>>> CLANGXX=${CLANGXX:-$(echo $CLANG | sed -e 's/gcc$/g++/')}
>> What if there is more than one "gcc" in the compiler path?
>
> Sorry, don't understand... I'm just replacing trailing gcc with g++ so
> e.g. path/to/my/cross-gcc becomes path/to/my/cross-g++.
>
> -Y
>
> --
> You received this message because you are subscribed to the Google Groups 
> "address-sanitizer" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to address-sanitizer+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to address-sanitizer+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Small improvements to run_spec_clang_asan.sh

2014-10-01 Thread Yuri Gribov
On Wed, Oct 1, 2014 at 1:56 PM, 'Evgeniy Stepanov' via
address-sanitizer  wrote:
>> CLANGXX=${CLANGXX:-$(echo $CLANG | sed -e 's/gcc$/g++/')}
> What if there is more than one "gcc" in the compiler path?

Sorry, don't understand... I'm just replacing trailing gcc with g++ so
e.g. path/to/my/cross-gcc becomes path/to/my/cross-g++.

-Y

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to address-sanitizer+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Small improvements to run_spec_clang_asan.sh

2014-10-01 Thread 'Evgeniy Stepanov' via address-sanitizer
> CLANGXX=${CLANGXX:-$(echo $CLANG | sed -e 's/gcc$/g++/')}
What if there is more than one "gcc" in the compiler path?

Otherwise LGTM.


On Wed, Oct 1, 2014 at 1:35 PM, Yuri Gribov  wrote:
> On Fri, Sep 19, 2014 at 11:13 PM, Yuri Gribov  wrote:
>> Will test and resend on Monday.
>
> Ok, I've fallen ill and then completely forgot about this. Here's an
> updated version.
>
>>> CLANG=${CLANG:-clang}
>> You probably need the same for CLANGXX
>
> I'm doing this below depending on whether CLANG is really clang or gcc.
>
>> Why are you disabling leak detection? It is on by default, which means
>> you are benchmarking not the same thing that users run.
>> At least make it an option.
>
> I've kept the detect_leaks=0 because as kcc mentioned lots of tests
> have leaks. If you desperately want this cluttered stderr you can
> remove the detect_leaks=0 part from final patch (or I can do it
> myself).
>
>> I don't understand this LD_LIBRARY_PATH magic, what's its for?
>
> Fixed. This now allows user to override default script's ASAN_OPTIONS.
>
> @Evgeniy: you can just remove detect_leaks=0 if you desperately want
> this stderr clutter in runner's output.
>
> -Y
>
> --
> You received this message because you are subscribed to the Google Groups 
> "address-sanitizer" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to address-sanitizer+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to address-sanitizer+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Small improvements to run_spec_clang_asan.sh

2014-10-01 Thread Yuri Gribov
On Fri, Sep 19, 2014 at 11:13 PM, Yuri Gribov  wrote:
> Will test and resend on Monday.

Ok, I've fallen ill and then completely forgot about this. Here's an
updated version.

>> CLANG=${CLANG:-clang}
> You probably need the same for CLANGXX

I'm doing this below depending on whether CLANG is really clang or gcc.

> Why are you disabling leak detection? It is on by default, which means
> you are benchmarking not the same thing that users run.
> At least make it an option.

I've kept the detect_leaks=0 because as kcc mentioned lots of tests
have leaks. If you desperately want this cluttered stderr you can
remove the detect_leaks=0 part from final patch (or I can do it
myself).

> I don't understand this LD_LIBRARY_PATH magic, what's its for?

Fixed. This now allows user to override default script's ASAN_OPTIONS.

@Evgeniy: you can just remove detect_leaks=0 if you desperately want
this stderr clutter in runner's output.

-Y

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to address-sanitizer+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Index: run_spec_clang_asan.sh
===
--- run_spec_clang_asan.sh  (revision 2196)
+++ run_spec_clang_asan.sh  (working copy)
@@ -3,31 +3,63 @@
 # Simple script to run CPU2006 with AddressSanitizer.
 # Make sure to use spec version 1.2 (SPEC_CPU2006v1.2).
 # Run this script like this:
-# $./run_spec_clang_asan.sh TAG [test|train|ref] benchmarks
+# $./run_spec_clang_asan.sh TAG size benchmarks...
 # TAG is any word. If you use different TAGS you can runs several builds in
 # parallel.
-# test is a small data set, train is medium, ref is large.
-# To run all C use all_c, for C++ use all_cpp
+# size can be test, train or ref. test is a small data set, train is medium,
+# ref is large.
+# To run all C tests use all_c, for C++ use all_cpp. To run integer tests
+# use int, for floating point use fp.
 
 name=$1
 shift
 size=$1
 shift
 
+me=$(basename $0)
+
+usage() {
+  echo >&2 "Usage: $me TAG size bmarks"
+  exit 1
+}
+
+if test -z "$name"; then
+  usage
+fi
+
+case "$size" in
+  test|train|ref)
+;;
+  *)
+echo >&2 "$me: unexpected size: $size"
+usage
+;;
+esac
+
+if [ ! -f ./shrc ]; then
+  echo >&2 "$me: script must be run from SPEC2006 folder"
+  exit 1
+fi
+
 ulimit -s 8092  # stack
 
 SPEC_J=${SPEC_J:-20}
 NUM_RUNS=${NUM_RUNS:-1}
-F_ASAN=-fsanitize=address
 CLANG=${CLANG:-clang}
 BIT=${BIT:-64}
 OPT_LEVEL=${OPT_LEVEL:-"-O2"}
-
+if $CLANG --version 2>&1 | grep -q clang; then
+  F_ASAN=-fsanitize=address
+  CLANGXX=${CLANGXX:-$CLANG++}
+else
+  F_ASAN='-fsanitize=address -static-libasan'
+  CLANGXX=${CLANGXX:-$(echo $CLANG | sed -e 's/gcc$/g++/')}
+fi
 rm -rf config/$name.*
 
 COMMON_FLAGS="$F_ASAN -m$BIT -g"
-CC="$CLANG -std=gnu89 $COMMON_FLAGS"
-CXX="${CLANG}++   $COMMON_FLAGS"
+CC="$CLANG-std=gnu89 $COMMON_FLAGS"
+CXX="$CLANGXX$COMMON_FLAGS"
 
 cat << EOF > config/$name.cfg
 monitor_wrapper = $SPEC_WRAPPER  \$command
@@ -48,8 +80,8 @@
 FC = echo
 
 default=base=default=default:
-COPTIMIZE = $OPT_LEVEL
-CXXOPTIMIZE  =  $OPT_LEVEL
+COPTIMIZE   = $OPT_LEVEL
+CXXOPTIMIZE = $OPT_LEVEL
 
 default=base=default=default:
 PORTABILITY = -DSPEC_CPU_LP64
@@ -67,7 +99,7 @@
 CXXPORTABILITY= -include string.h -include stdlib.h -include cstddef
 EOF
 
-# Don't report alloc-dealloc-mismatch bugs (there is on in 471.omnetpp)
-export ASAN_OPTIONS=alloc_dealloc_mismatch=0
+# Don't report alloc-dealloc-mismatch bugs (there is on in 471.omnetpp) and 
leaks
+export 
ASAN_OPTIONS=alloc_dealloc_mismatch=0:detect_leaks=0${ASAN_OPTIONS:+:$ASAN_OPTIONS}
 . shrc
 runspec -c $name -a run -I -l --size $size -n $NUM_RUNS $@


Re: Small improvements to run_spec_clang_asan.sh

2014-09-19 Thread Yuri Gribov
On Fri, Sep 19, 2014 at 9:02 PM, Yuri Gribov  wrote:
>> I don't understand this LD_LIBRARY_PATH magic, what's its for?
>
> Snap, believe it or not but that's a typo. It should be ASAN_OPTIONS
> and the weird expression optionally inserts : in front of added
> options (so that user can provide his own ASAN_OPTIONS).

I meant to say

export 
ASAN_OPTIONS=alloc_dealloc_mismatch=0:detect_leaks=0${ASAN_OPTIONS:+:$ASAN_OPTIONS}

Will test and resend on Monday.

-Y

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to address-sanitizer+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Small improvements to run_spec_clang_asan.sh

2014-09-19 Thread Yuri Gribov
On Fri, Sep 19, 2014 at 4:13 PM, 'Evgeniy Stepanov' via
address-sanitizer  wrote:
>> CLANG=${CLANG:-clang}
> You probably need the same for CLANGXX

I do this in the next block (autodetection is different clang and gcc
are different).

> Why are you disabling leak detection? It is on by default, which means
> you are benchmarking not the same thing that users run.
> At least make it an option.

As Kostya mentioned there are numerous leaks in benchmarks which make
analysis harder. I can remove it if necessary.

> I don't understand this LD_LIBRARY_PATH magic, what's its for?

Snap, believe it or not but that's a typo. It should be ASAN_OPTIONS
and the weird expression optionally inserts : in front of added
options (so that user can provide his own ASAN_OPTIONS).

-Y

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to address-sanitizer+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Small improvements to run_spec_clang_asan.sh

2014-09-19 Thread Konstantin Serebryany
On Fri, Sep 19, 2014 at 5:13 AM, 'Evgeniy Stepanov' via
address-sanitizer  wrote:
>> CLANG=${CLANG:-clang}
> You probably need the same for CLANGXX
>
> Why are you disabling leak detection? It is on by default, which means
> you are benchmarking not the same thing that users run.
> At least make it an option.

i disable lsan in my local copy of this script because there are leaks
in several benchmarks :)

>
> I don't understand this LD_LIBRARY_PATH magic, what's its for?
>
>
>
> On Fri, Sep 19, 2014 at 3:26 PM, Alexander Potapenko  
> wrote:
>> CC kcc, eugenis
>>
>> On Thu, Sep 18, 2014 at 7:25 PM, Yuri Gribov  wrote:
>>> Hi all,
>>>
>>> Here is a small patch for
>>> https://code.google.com/p/address-sanitizer/source/browse/trunk/spec/run_spec_clang_asan.sh
>>> which
>>> * updates docs
>>> * adds some option verification
>>> * adds GCC support
>>> * disables leak detection
>>>
>>> Does the change look sane?
>>>
>>> -Y
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "address-sanitizer" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>> email to address-sanitizer+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> Alexander Potapenko
>> Software Engineer
>> Google Moscow
>
> --
> You received this message because you are subscribed to the Google Groups 
> "address-sanitizer" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to address-sanitizer+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to address-sanitizer+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Small improvements to run_spec_clang_asan.sh

2014-09-19 Thread 'Evgeniy Stepanov' via address-sanitizer
> CLANG=${CLANG:-clang}
You probably need the same for CLANGXX

Why are you disabling leak detection? It is on by default, which means
you are benchmarking not the same thing that users run.
At least make it an option.

I don't understand this LD_LIBRARY_PATH magic, what's its for?



On Fri, Sep 19, 2014 at 3:26 PM, Alexander Potapenko  wrote:
> CC kcc, eugenis
>
> On Thu, Sep 18, 2014 at 7:25 PM, Yuri Gribov  wrote:
>> Hi all,
>>
>> Here is a small patch for
>> https://code.google.com/p/address-sanitizer/source/browse/trunk/spec/run_spec_clang_asan.sh
>> which
>> * updates docs
>> * adds some option verification
>> * adds GCC support
>> * disables leak detection
>>
>> Does the change look sane?
>>
>> -Y
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "address-sanitizer" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to address-sanitizer+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Alexander Potapenko
> Software Engineer
> Google Moscow

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to address-sanitizer+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Small improvements to run_spec_clang_asan.sh

2014-09-19 Thread 'Alexander Potapenko' via address-sanitizer
CC kcc, eugenis

On Thu, Sep 18, 2014 at 7:25 PM, Yuri Gribov  wrote:
> Hi all,
>
> Here is a small patch for
> https://code.google.com/p/address-sanitizer/source/browse/trunk/spec/run_spec_clang_asan.sh
> which
> * updates docs
> * adds some option verification
> * adds GCC support
> * disables leak detection
>
> Does the change look sane?
>
> -Y
>
> --
> You received this message because you are subscribed to the Google Groups 
> "address-sanitizer" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to address-sanitizer+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Alexander Potapenko
Software Engineer
Google Moscow

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to address-sanitizer+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.