Building Android using GPU

4,161 views
Skip to first unread message

Keith

unread,
Mar 19, 2012, 9:53:19 PM3/19/12
to Android Building
I had a question that I have found no real helpful information with. I
was wondering if I could use my GPU to speed up the building process.
I am currently using an Nvidia GTX 560 Ti which has capabilities such
as CUDA that I thought maybe could be taken advantage of and make it
possible to do quicker building with even cheaper PCs. Any thoughts or
help on where to start would be great, thank you!

Conley Owens

unread,
Mar 20, 2012, 11:51:51 AM3/20/12
to android-...@googlegroups.com
Hi Keith,

This sounds like a discussion that would need to be taken upstream to
gcc, etc. As far as I'm aware there's no way currently for the tools
used in the build process to take advantage of your GPU.

~cco3

> --
> You received this message because you are subscribed to the "Android Building" mailing list.
> To post to this group, send email to android-...@googlegroups.com
> To unsubscribe from this group, send email to
> android-buildi...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-building?hl=en

Keith Nason

unread,
Mar 20, 2012, 4:57:43 PM3/20/12
to android-...@googlegroups.com
I figured that I probably would need get into this further. I just wasn't sure where exactly to start so I tried asking here and sending an email to Nvidia (not sure how helpful their support would be though.).

Jean-Baptiste Queru

unread,
Mar 20, 2012, 5:53:36 PM3/20/12
to android-...@googlegroups.com
Well, building Android involves 3 kinds of tools, really:

-There are tools provided by the host OS (e.g. make, host gcc, python,
javac). For those tools, really, whether the tools use the CPU or the
GPU is an implementation detail of the tools (or of the compilers used
to compile those tools).

-There are tools provided as source by Android (e.g. aapt, aidl),
which then get compiled by the host tools mentioned above. For those
tools, really, the key is to get the various compilers and runtimes to
create an output that can use the GPU. At most, the involvement in the
Android build system is to pass the relevant flags to those tools.

-Finally, there are tools provided as binaries by Android (e.g. the
cross compiler). For those tools, really, using the GPU would mean
re-compiling those tools with toolchains that can output binaries that
can use the GPU.

So, really, the key point here is really to get a version of gcc that
can output binaries that can run on the GPU. From there, that gcc can
be used to re-compile gcc (on the host), make, python, javac, as well
as the Android tools and cross-compilers.

My gut feeling: not gonna happen anytime soon.

JBQ

> --
> You received this message because you are subscribed to the "Android
> Building" mailing list.
> To post to this group, send email to android-...@googlegroups.com
> To unsubscribe from this group, send email to
> android-buildi...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-building?hl=en

--
Jean-Baptiste M. "JBQ" Queru
Software Engineer, Android Open-Source Project, Google.

Questions sent directly to me that have no reason for being private
will likely get ignored or forwarded to a public forum with no further
warning.

Nathaniel Husted

unread,
Mar 22, 2012, 9:22:16 AM3/22/12
to android-...@googlegroups.com
Compilation is also something that the GPU won't provide great
benefits on anyway. Besides the slowdown you're going to get from
constantly transferring things across the bus, SIMD architectures
don't do well with branching instructions. When you run make -j32 on
your desktop, it's great, because our desktop processors can easily
handle the hugely different tasks that are running on each core. If
you try that on a GPU, well, you'll be able to run about one thread
per multiprocessor on the GPU, tops. As much as GPGPU marketing folks
are spinning their products, GPU's are very good for certain tasks.
Compilation isn't one of them.

Cheers,
Nathaniel

Mitesh Patel

unread,
Mar 22, 2012, 12:37:53 AM3/22/12
to android-...@googlegroups.com
GPUs are designed to do specific tasks which would take longer if performed in conventional CPUs.
Hence, GPUs are designed with different instruction sets than conventional CPUs.

Theoretically speaking, GPU oriented tasks if performed on a CPU would take longer time, and reverse should also hold true.

As per my understanding, even if all the amendments informed by JBQ are done (and somehow android build works on GPU), I doubt whether it would achieve the objective of making a build faster.

However, it looks cost effective if it works.

Thanks,
Mitesh

Kcilorak

unread,
Mar 22, 2012, 4:07:42 PM3/22/12
to Android Building
I found this which looks pretty interesting.

http://forums.nvidia.com/index.php?showtopic=220686

I have been toying around with this idea for some time myself but the
more I read about it the less beneficial it appears. But still fun as
a proof of concept!
Reply all
Reply to author
Forward
0 new messages