Intel NDK x86A few Benchmarks
Francesca Tosi - Alberto Mancini13 Febbraio 2013
?!?● Ma che ci fanno
Alberto e Francesca!??!?!
?!?● Ma che ci fanno
Alberto e Francesca!??!?!
● Ma non erano quelli fissati con le app web!??!?!
Inte
l
Francesco BaldassarriItalian Community ManagerIntel Software and Services Group
email: [email protected]: @francesco_1985facebook: www.facebook.com/francesco1985linkedin: it.linkedin.com/in/fbaldassarri/
Inte
l Dev
ices I devices Intel sono compatibili con l’
ecosistema Android*.
- Android* Dalvik* apps
- These will directly work, Dalvik has beenoptimized for Intel® platforms.
- Android NDK apps
- Most will run without any recompilation on consumer platforms.
- Android NDK provides an x86 toolchain since 2011
- A simple recompile using the Android NDK yields the best performance
- If there is specific processor dependent code, porting may be necessary
Inte
l Dev
ices Intel Investe molto in tool di sviluppo per
Android
- Faster Android Emulator on Intel (Intel HAXM)
- Intel Threading Building Blocks (TBB)
- Intel Graphics Performance Analyzer (GPA)
- Intel Integrated Performance Primitives (IPP)
- Intel Optimizing Compiler (C++)
- Intel Beacon Mountain
- Project Anarchy
Inte
l Dev
ices Cosa sta facendo intel per Android
Inte
l Dev
ices Intel devices on the market with Intel Inside
Libr
erie
nat
ive
3rd party Libraries with x86 support
???
Ma voi due che c’entrate con le app
native !?!?
ND
KA noi interessa sperimentare la
rapidità/potenzialità della NDK
App NDK
Applicazione Android che usa librerie native
Ben
chm
arks
e testarne le performance
Benchmark
C/Java/Javascript
AR
on
mob
ile Nei lavori che facciamo una operazione semplice ma costosa è fare il grayscale sulle immagini
picshare.jooink.com
GW
T-B
oofc
vGWT-Boofcv sample at:http://goo.gl/3IJQgs
Ben
chm
arks -
Test
are
na Galaxy Tab3
Intel Atom CPU Z25602 core - 1.60 GHz Android 4.4.2Architettura i686
Rul
es RGB jbyte[1024*1024*3]
Average on 1000 runs
grayjbyte[1024*1024]
1
0.299*R+0.587*G+0.114*B → Y2
3
Com
petit
ors Benchmarks on:
Chrome <Uint8Array>Firefox <Uint8Array>Aurora <Uint8Array>Java <byte> NDK <jbyte>IPP <Ipp8u>
Det
ails
(HA
XM) Bundled in BeaconMountain
http://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager
cambia la vita con le immagini x86
Attenzione pianta OSX, maverickinstallare lo hotfix
Cod
ice
(Jav
a) Java:
void compute(byte[] in, byte[] out) { for(int i=0, j=0; i< out.length; i++, j+=3) out[i] =
(byte)(0.299 * in[j] + 0.587 * in[j+1] + 0.114 * in[j+2]); }
Det
ails
(ND
K) https://developer.android.com/tools/sdk/ndk/index.html
La documentazione non e’ il suo forte ...
https://github.com/jooink/ndk-cpuid
● start the (intel) avd (url)● enter in the jni folder & execute 'ndk-build'● from the CPUIDApp root dir execute 'ant debug'● adb install -r bin/CPUIdApp-debug.apk
Cod
ice
(C, j
ni) void JNICALL … jbyteArray in, jbyteArray out) {
jsize len_out = (*env)->GetArrayLength(env, out); ... jbyte *body_out = (*env)->GetByteArrayElements(env, out, 0); for(i=0, j=0; i< len_out; i++, j+=3) body_out[i] = (jbyte)(0.299 * body_in[j] + … );
(*env)->ReleaseByteArrayElements(env, in, body_in, 0); ... }
Det
ails
(IPP
) Bundled in BeaconMountain beh … la ‘preview’
http://software.intel.com/en-us/intel-ipp
… ed avete la IPP per android x86 !!!
Scaricate la versione per linux ( la evaluation, or 199$ :( )
Installatela ( vi serve una macchina linux )
Copiate le librerie (*.a) e gli include (*.h) (32bit statici non-threaded)
Cod
ice
(IPP)
… jni ...
IppiSize srcRoi = { 1024, 1024 }; Ipp8u* pSrc = body_in; Ipp8u* pDst = body_out; ippiRGBToGray_8u_C3C1R(pSrc ,1024, pDst, 1024, srcRoi);
… jni ...
Res
ults
nat
ive
Res
ults
nat
ive
minmaxavg
Cod
ice
(js) var len_out = outb.length;
var i,j;for(i=0, j=0; i< len_out; i++, j+=3)
outb[i] = (0.299 * inb[j] + 0.587 * inb[j+1] + 0.114 *inb[j+2]);
var buffer_in = new ArrayBuffer(size*3);var buffer_out = new ArrayBuffer(size);
var inb = new Uint8Array(buffer_in);var out = new Uint8Array(buffer_out);
Res
ults
jsminmaxavg
Gra
zie Francesca Tosi
Alberto Mancini [email protected]
Github: github.com/jooink/
www.jooink.comjooink.blogspot.com
Top Related