22
Android* on Intel platforms And what it means for you, developers. Xavier Hallade, Technical Marketing Engineer, Intel

Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

  • Upload
    vanphuc

  • View
    225

  • Download
    4

Embed Size (px)

Citation preview

Page 1: Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

Android* on Intel platformsAnd what it means for you, developers.

Xavier Hallade, Technical Marketing Engineer, Intel

Page 2: Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

Our devices are already fully compatible with

established Android* ecosystemAndroid* Dalvik* apps

These will directly work, Dalvik has been

optimized 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

Android Runtime

Core Libraries

Dalvik Virtual

Machine

Most of the time, it just works !

Page 3: Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

What’s a NDK app ?

It’s an Android* application that uses native libraries.

Native libraries are .so files, usually found inside libs/CPU_ABI/.

An application can use some calls to these native libraries, or rely almost exclusively on these.

These libs can be generated from native sources inside jni folder, game engines, or required by other 3rd party libraries.

There is no 100% native application. Even an application purely written in C/C++, using native_app_glue.h, will be executed in the context of the Dalvik Virtual Machine.

Page 4: Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

What we are working on for Android*

Key AOSP and Kernel Contributor

Optimized Drivers & Firmware

Highly Tuned Dalvik Runtime

Porting and Optimizing

Browser and Apps

NDK Apps Bridging Technology

64-Bit

64bit

Page 5: Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

Intel® devices on the market

Page 6: Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

Smartphones with Intel Inside - 2012

Motorola* RAZR i ZTE* Grand X IN

Lava* Xolo X900 Megafon* Mint

Lenovo* K800

Orange* San Diego (UK)

Orange* avec Intel Inside (FR)

Z2460

Page 7: Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

Smartphones with Intel Inside - 2013

Intel® Yolo

Acer* Liquid C1

Z2420 Z2580

Lenovo* K900 – 5.5”

ASUS Fonepad™ Note FHD - 6”

ZTE* Geek – 5”

Etisalat E-20*

Page 8: Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

Tablets with Intel Inside - 2013

ASUS* MeMO Pad FHD 10”

(Z2560)

ASUS* Fonepad™ 7”

(Z2420/Z2560)

Dell* Venue 7/8

(Z2560)

Samsung* Galaxy™ Tab 3 10.1”

(Z2560)

LTE version now available

Page 9: Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

Future Android* platforms based on Intel*

Silvermont microarchitecture

New 22nm tri-gate microarchitecture

~3X more peak performance or ~5X lower power than previous Atom microarchitecture

Intel® Atom™ Processor Z3000 Series

(Bay Trail) Next Generation Tablets

Merrifield

Next Generation Smartphones

Page 10: Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

How to target multiple platforms (incl. x86)

from NDK apps ?

Page 11: Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

If you have the source code of your native libraries, you can compile it for several CPU architectures by setting APP_ABI to all in the Makefile “jni/Application.mk”:

APP_ABI=all

The NDK will generate optimized code for all target ABIs

You can also pass APP_ABI variable directly to ndk-build, and specify each ABI:

ndk-build APP_ABI=x86

Configuring NDK Target ABIs

ARM v7a libs are built

ARM v5 libs are built

x86 libs are built

mips libs are built

Put APP_ABI=all inside

Application.mk

Run ndk-build…

Page 12: Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

Fat Binaries

By default, an APK contains libraries for every supported ABIs.

Use lib/armeabi libraries

Use lib/armeabi-v7a

libraries

Use lib/x86

libraries

libs/armeabi-v7a

libs/x86

libs/armeabi

APK file

The application will be filtered during installation (after download)

Page 13: Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

Multiple APKs

Google Play* supports multiple APKs for the same application.

What compatible APK will be chosen for a device entirely depends on the android:VersionCode

If you have multiple APKs for multiple ABIs, best is to simply prefix your current version code with a digit representing the ABI:

2310 6310

You can have more options for multiple APKs, here is a convention that will work

if you’re using all of these:

x86ARMv7

Page 14: Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

3rd party libraries x86 support

Game engines/libraries with x86 support:

• Havok Anarchy SDK: android x86 target available

• Unreal Engine 3: android x86 target available

• Marmalade: android x86 target available

• Cocos2Dx: set APP_ABI in Application.mk

• FMOD: x86 lib already included, set ABIs in Application.mk

• AppGameKit: x86 lib already included, set ABIs in Application.mk

• libgdx: x86 lib now available in latest releases

• …

No x86 support but works on consumer devices:

• Corona

• Unity

Page 15: Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

Intel® Tools for Android* apps

developersHAXM, TBB, GPA, XDK and others

Most of our tools are relevant even if you’re not targeting x86 platforms!

Page 16: Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

Intel x86 Emulator

Accelerator

Intel x86 Atom

System Image

Faster Android* Emulation on Intel® Architecture

Based Host PC

Pre-built Intel® Atom™ Processor Images

Android* SDK manager has x86 emulation images

built-in

To emulate an Intel Atom processor based Android

phone, install the “Intel Atom x86 System Image”

available in the Android SDK Manager

Much Faster Emulation

Intel® Hardware Accelerated Execution Manager (Intel®

HAXM) for Mac and Windows uses Intel®

Virtualization Technology (Intel® VT) to accelerate

Android emulator

Intel VT is already supported in Linux* by qemu -kvm

Page 17: Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

Intel® Threading Building Blocks (TBB)

Specify tasks instead of manipulating threads

Intel® Threading Building Blocks (Intel® TBB) maps your logical tasks onto

threads with full support for nested parallelism

Targets threading for scalable performance

Uses proven efficient parallel patterns

Uses work-stealing to support the load balance of unknown execution

time for tasks

Open source and licensed versions available on Linux*, Windows*, Mac OS

X*, Android*…

Open Source version available on: threadingbuildingblocks.org

Licensed version available on: software.intel.com/en-us/intel-tbb

Page 18: Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

Intel® TBB - Example

#include <tbb/parallel_reduce.h>

#include <tbb/blocked_range.h>

double getPi() {

const int num_steps = 10000000;

const double step = 1./num_steps;

double pi = tbb::parallel_reduce(

tbb::blocked_range<int>(0, num_steps), //Range

double(0), //Value

//function

[&](const tbb::blocked_range<int>& r, double current_sum ) ->

double {

for (size_t i=r.begin(); i!=r.end(); ++i) {

double x = (i+0.5)*step;

current_sum += 4.0/(1.0 + x*x);

}

return current_sum; // updated value of the accumulator

},

[]( double s1, double s2 ) { //Reduction

return s1+s2;

}

);

return pi*step;

}

Computes reduction

over a range

Defining a one-

dimensional range

Lambda function with

range and initial value as

parm

Calculating a part of Pi

within the range r

Defining a reduction

function

Page 19: Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

http://www.projectanarchy.com/

Project Anarchy*

• Complete mobile game engine that includes Havok Vision Engine, Physics, Animation Studio and AI

• Free to publish on Android (ARM and x86), iOS, and Tizen

• C++ development environment

• Efficient asset management system

• LUA scripting and debugging

• Extensible source code and full library of sample materials

• Remote debugging

• File serving for live asset updates

• Remote input

• Visual debugger

Page 20: Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

Intel® Graphics Performance Analyzers

• Profiles performance and Power

• Real-time charts of CPU, GPU and power metrics

• Conduct real-time experiments with OpenGL-ES* (with state overrides) to help narrow down problems

• Triage system-level performance with CPU, GPU and Power metrics

Available freely on intel.com/software/gpa

Page 21: Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

Intel® HTML5 Development Environment

(XDK NEW)

more on: html5dev-software.intel.com

• Great tools for free

• Convenient, cloud-based build tool lets you target all popular platforms

& app stores

• Write once, run anywhere; code once, debug once, publish everywhere

Page 22: Android* on Intel platforms - Lyon Android User Grouplyaug.fr/slides/presentation-intel/Android-on-x86.pdfAndroid NDK apps Most will run without any recompilation on consumer platforms

Other tools and libs for Android*

• Intel Beacon Mountain

• Intel IPP Preview

• Intel Compiler