Csound Csound-dev Csound-tekno Search About

[Cs-dev] Android compiler flag benchmarks

Date2012-10-11 15:08
From"c.m.bryan"
Subject[Cs-dev] Android compiler flag benchmarks
AttachmentsNone  None  
Hi everyone, in the interest of trying to contribute something rather than just asking questions, here is some benchmark data that I gathered while messing with C compiler flags, both for the csoundandroid library and linsndfile. The orchestra instrument simply reads in audio from the sdcard, runs it through pvanal, and writes the output to the app's data folder.

The results seemed to vary quite a lot on multiple runs, I suppose because of whatever else Android is doing in the background, and I don't know how to control this. Anyway, I ran each test several times and picked the best, assuming that to be the most accurate. As you can see, I had some success which seems to be related to the floating-point optimizations and the "release" setting in Application.mk.

Any suggestions, recommendations, etc. are most welcome!

-Chris Bryan


Results
=======
Default compile from git
(pulled on 10/10/12):     60.543

Compiled to arm code:     [compiles, but does not run]

+= -ffast-math            67.324

+= -mfloat-abi=softfp
-mfpu=vfp
-fno-strict-aliasing      61.923

+= -march=armv6 -marm
-mfloat-abi=softfp
-mfpu=vfp
-fno-strict-aliasing      35.793

+= -march=armv6 -marm
-mfloat-abi=softfp
-mfpu=vfp
-fno-strict-aliasing
(and added
"APP_OPTIM := release"
to Application.mk):       33.642

+= -ffast-math
-march=armv6 -marm
-mfloat-abi=softfp
-mfpu=vfp
(and added
"APP_OPTIM := release"
to Application.mk):       30.511

+= -ffast-math
-march=armv6 -marm
-mfloat-abi=softfp
-mfpu=vfp
-fno-strict-aliasing
(and added
"APP_OPTIM := release"
to Application.mk):       31.060

+= -ffast-math
-mfloat-abi=softfp
-mfpu=vfp
-fno-strict-aliasing
(and added
"APP_OPTIM := release"
to Application.mk):       31.060


Hardware ('cat /proc/cpuinfo'):
========
Processor : ARMv6-compatible processor rev 5 (v6l)
BogoMIPS : 805.93
Features : swp half thumb fastmult vfp edsp java
CPU implementer : 0x41
CPU architecture: 6TEJ
CPU variant : 0x1
CPU part : 0xb36
CPU revision : 5

Input
=====
"noise.wav", 60s of stereo white noise.

.csd
====
<CsoundSynthesizer>
<CsOptions>
-n
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 128
nchnls = 2
0dbfs = 1

instr 1
ifftsize = 4096
iwtype = 1
kwidth = 1

al,ar soundin p4

fl pvsanal al, ifftsize, ifftsize/4, ifftsize, iwtype
fr pvsanal ar, ifftsize, ifftsize/4, ifftsize, iwtype

pvsfwrite fl,"/data/data/com.cmbryan.android.pvanaltest/left.pvx"
pvsfwrite fr,"/data/data/com.cmbryan.android.pvanaltest/right.pvx"
endin

</CsInstruments>
<CsScore>
i1 0 30 "/sdcard/noise.wav"
</CsScore>

Date2012-10-11 15:45
FromVictor Lazzarini
SubjectRe: [Cs-dev] Android compiler flag benchmarks
AttachmentsNone  None  
Thanks, Chris, this should be useful. I

What do you mean by 'compiles but not run'?

Also, did you derive the timings from Csound's own timing messages?

Regards

Victor
On 11 Oct 2012, at 15:08, c.m.bryan wrote:

Hi everyone, in the interest of trying to contribute something rather than just asking questions, here is some benchmark data that I gathered while messing with C compiler flags, both for the csoundandroid library and linsndfile. The orches tra instrument simply reads in audio from the sdcard, runs it through pvanal, and writes the output to the app's data folder.

The results seemed to vary quite a lot on multiple runs, I suppose because of whatever else Android is doing in the background, and I don't know how to control this. Anyway, I ran each test several times and picked the best, assuming that to be the most accurate. As you can see, I had some success which seems to be related to the floating-point optimizations and the "release" setting in Application.mk.

Any suggestions, recommendations, etc. are most welcome!

-Chris Bryan


Results
=======
Default compile from git
(pulled on 10/10/12):     60.543

Compiled to arm code:     [compiles, but does not run]

+= -ffast-math            67.324

+= -mfloat-abi=softfp
-mfpu=vfp
-fno-strict-aliasing      61.923

+= -march=armv6 -marm
-mfloat-abi=softfp
-mfpu=vfp
-fno-strict-aliasing      35.793

+= -march=armv6 -marm
-mfloat-abi=softfp
-mfpu=vfp
-fno-strict-aliasing
(and added
"APP_OPTIM := release"
to Application.mk):       33.642

+= -ffast-math
-march=armv6 -marm
-mfloat-abi=softfp
-mfpu=vfp
(and added
"APP_OPTIM := release"
to Application.mk):       30.511

+= -ffast-math
-march=armv6 -marm
-mfloat-abi=softfp
-mfpu=vfp
-fno-strict-aliasing
(and added
"APP_OPTIM := release"
to Application.mk):       31.060

+= -ffast-math
-mfloat-abi=softfp
-mfpu=vfp
-fno-strict-aliasing
(and added
"APP_OPTIM := release"
to Application.mk):       31.060


Hardware ('cat /proc/cpuinfo'):
========
Processor : ARMv6-compatible processor rev 5 (v6l)
BogoMIPS : 805.93
Features : swp half thumb fastmult vfp edsp java
CPU implementer : 0x41
CPU architecture: 6TEJ
CPU variant : 0x1
CPU part : 0xb36
CPU revision : 5

Input
=====
"noise.wav", 60s of stereo white noise.

.csd
====
<CsoundSynthesizer>
<CsOptions>
-n
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 128
nchnls = 2
0dbfs = 1

instr 1
ifftsize = 4096
iwtype = 1
kwidth = 1

al,ar soundin p4

fl pvsanal al, ifftsize, ifftsize/4, ifftsize, iwtype
fr pvsanal ar, ifftsize, ifftsize/4, ifftsize, iwtype

pvsfwrite fl,"/data/data/com.cmbryan.android.pvanaltest/left.pvx"
pvsfwrite fr,"/data/data/com.cmbryan.android.pvanaltest/right.pvx"
endin

</CsInstruments>
<CsScore>
i1 0 30 "/sdcard/noise.wav"
</CsScore>
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2012-10-11 16:46
From"c.m.bryan"
SubjectRe: [Cs-dev] Android compiler flag benchmarks
AttachmentsNone  None  
Went back and tried again, and the arm compile worked this time!

Yes, the times came from the csound log output.

-Chris



On 11 October 2012 15:45, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
Thanks, Chris, this should be useful. I

What do you mean by 'compiles but not run'?

Also, did you derive the timings from Csound's own timing messages?

Regards

Victor
On 11 Oct 2012, at 15:08, c.m.bryan wrote:

Hi everyone, in the interest of trying to contribute something rather than just asking questions, here is some benchmark data that I gathered while messing with C compiler flags, both for the csoundandroid library and linsndfile. The orchestra instrument simply reads in audio from the sdcard, runs it through pvanal, and writes the output to the app's data folder.

The results seemed to vary quite a lot on multiple runs, I suppose because of whatever else Android is doing in the background, and I don't know how to control this. Anyway, I ran each test several times and picked the best, assuming that to be the most accurate. As you can see, I had some success which seems to be related to the floating-point optimizations and the "release" setting in Application.mk.

Any suggestions, recommendations, etc. are most welcome!

-Chris Bryan


Results
=======
Default compile from git
(pulled on 10/10/12):     60.543

Compiled to arm code:     [compiles, but does not run]

+= -ffast-math            67.324

+= -mfloat-abi=softfp
-mfpu=vfp
-fno-strict-aliasing      61.923

+= -march=armv6 -marm
-mfloat-abi=softfp
-mfpu=vfp
-fno-strict-aliasing      35.793

+= -march=armv6 -marm
-mfloat-abi=softfp
-mfpu=vfp
-fno-strict-aliasing
(and added
"APP_OPTIM := release"
to Application.mk):       33.642

+= -ffast-math
-march=armv6 -marm
-mfloat-abi=softfp
-mfpu=vfp
(and added
"APP_OPTIM := release"
to Application.mk):       30.511

+= -ffast-math
-march=armv6 -marm
-mfloat-abi=softfp
-mfpu=vfp
-fno-strict-aliasing
(and added
"APP_OPTIM := release"
to Application.mk):       31.060

+= -ffast-math
-mfloat-abi=softfp
-mfpu=vfp
-fno-strict-aliasing
(and added
"APP_OPTIM := release"
to Application.mk):       31.060


Hardware ('cat /proc/cpuinfo'):
========
Processor : ARMv6-compatible processor rev 5 (v6l)
BogoMIPS : 805.93
Features : swp half thumb fastmult vfp edsp java
CPU implementer : 0x41
CPU architecture: 6TEJ
CPU variant : 0x1
CPU part : 0xb36
CPU revision : 5

Input
=====
"noise.wav", 60s of stereo white noise.

.csd
====
<CsoundSynthesizer>
<CsOptions>
-n
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 128
nchnls = 2
0dbfs = 1

instr 1
ifftsize = 4096
iwtype = 1
kwidth = 1

al,ar soundin p4

fl pvsanal al, ifftsize, ifftsize/4, ifftsize, iwtype
fr pvsanal ar, ifftsize, ifftsize/4, ifftsize, iwtype

pvsfwrite fl,"/data/data/com.cmbryan.android.pvanaltest/left.pvx"
pvsfwrite fr,"/data/data/com.cmbryan.android.pvanaltest/right.pvx"
endin

</CsInstruments>
<CsScore>
i1 0 30 "/sdcard/noise.wav"
</CsScore>
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie





Date2012-10-12 11:31
FromSteven Yi
SubjectRe: [Cs-dev] Android compiler flag benchmarks
Hi Chris,

I'm here with Victor and we've been looking at flags and things.  One
of the things I'm seeing is that you get the most significant change
when adding armv6.  I think the situation is that we're supporting
armv5 and armv7, with armv5 using software floating point.  With the
flags you're setting, I wondering if your processor has a hardware
floating point unit that gets enabled with your flags. With the
current build, for your processor, my guess is that the armv5 would
get picked up to use.

I'm trying some build things now, trying -ffast-math.  One thing to
note, I'm logging the builds by add "V=1" to the last line of the
build.sh, the calling "./build.sh &> output.txt" to capture the
complete builds.  A number of the flags mentioned are already set or
are set via the optimization flags.

Thanks for reporting this though, it'll hopefully help to find some
interesting ways to optimize!

steven


On Thu, Oct 11, 2012 at 3:08 PM, c.m.bryan  wrote:
> Hi everyone, in the interest of trying to contribute something rather than
> just asking questions, here is some benchmark data that I gathered while
> messing with C compiler flags, both for the csoundandroid library and
> linsndfile. The orchestra instrument simply reads in audio from the sdcard,
> runs it through pvanal, and writes the output to the app's data folder.
>
> The results seemed to vary quite a lot on multiple runs, I suppose because
> of whatever else Android is doing in the background, and I don't know how to
> control this. Anyway, I ran each test several times and picked the best,
> assuming that to be the most accurate. As you can see, I had some success
> which seems to be related to the floating-point optimizations and the
> "release" setting in Application.mk.
>
> Any suggestions, recommendations, etc. are most welcome!
>
> -Chris Bryan
>
>
> Results
> =======
> Default compile from git
> (pulled on 10/10/12):     60.543
>
> Compiled to arm code:     [compiles, but does not run]
>
> += -ffast-math            67.324
>
> += -mfloat-abi=softfp
> -mfpu=vfp
> -fno-strict-aliasing      61.923
>
> += -march=armv6 -marm
> -mfloat-abi=softfp
> -mfpu=vfp
> -fno-strict-aliasing      35.793
>
> += -march=armv6 -marm
> -mfloat-abi=softfp
> -mfpu=vfp
> -fno-strict-aliasing
> (and added
> "APP_OPTIM := release"
> to Application.mk):       33.642
>
> += -ffast-math
> -march=armv6 -marm
> -mfloat-abi=softfp
> -mfpu=vfp
> (and added
> "APP_OPTIM := release"
> to Application.mk):       30.511
>
> += -ffast-math
> -march=armv6 -marm
> -mfloat-abi=softfp
> -mfpu=vfp
> -fno-strict-aliasing
> (and added
> "APP_OPTIM := release"
> to Application.mk):       31.060
>
> += -ffast-math
> -mfloat-abi=softfp
> -mfpu=vfp
> -fno-strict-aliasing
> (and added
> "APP_OPTIM := release"
> to Application.mk):       31.060
>
>
> Hardware ('cat /proc/cpuinfo'):
> ========
> Processor : ARMv6-compatible processor rev 5 (v6l)
> BogoMIPS : 805.93
> Features : swp half thumb fastmult vfp edsp java
> CPU implementer : 0x41
> CPU architecture: 6TEJ
> CPU variant : 0x1
> CPU part : 0xb36
> CPU revision : 5
>
> Input
> =====
> "noise.wav", 60s of stereo white noise.
>
> .csd
> ====
> 
> 
> -n
> 
> 
>
> sr = 44100
> ksmps = 128
> nchnls = 2
> 0dbfs = 1
>
> instr 1
> ifftsize = 4096
> iwtype = 1
> kwidth = 1
>
> al,ar soundin p4
>
> fl pvsanal al, ifftsize, ifftsize/4, ifftsize, iwtype
> fr pvsanal ar, ifftsize, ifftsize/4, ifftsize, iwtype
>
> pvsfwrite fl,"/data/data/com.cmbryan.android.pvanaltest/left.pvx"
> pvsfwrite fr,"/data/data/com.cmbryan.android.pvanaltest/right.pvx"
> endin
>
> 
> 
> i1 0 30 "/sdcard/noise.wav"
> 
>
> ------------------------------------------------------------------------------
> Don't let slow site performance ruin your business. Deploy New Relic APM
> Deploy New Relic app performance management and know exactly
> what is happening inside your Ruby, Python, PHP, Java, and .NET app
> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
> http://p.sf.net/sfu/newrelic-dev2dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net