Slashdot Mirror


Android ICS Will Require 16GB RAM To Compile

ozmanjusri writes "New smartphones may be lightweight, compact objects, but their OSs are anything but. Ice Cream Sandwich will need workstations with no less than 16 GB RAM to build the source code, twice the amount Gingerbread needed. It will take 5 hours to compile on a dual quad-core 2+GHz workstation, and need 80GB disk space for all AOSP configs. Android developers are also being warned to be cautious of undocumented APIs: 'In almost every case, there's only one reason for leaving APIs undocumented: We're not sure that what we have now is the best solution, and we think we might have to improve it, and we're not prepared to make those commitments to testing and preservation. We're not claiming that they're "Private" or "Secret" — How could they be, when anyone in the world can discover them? We're also not claiming they're forbidden: If you use them, your code will compile and probably run.'"

39 of 357 comments (clear)

  1. Of Course. by Frosty+Piss · · Score: 4, Funny

    Nobody will ever need more than 16GB...

    --
    If you want news from today, you have to come back tomorrow.
    1. Re:Of Course. by lolcutusofbong · · Score: 3, Informative

      probably using the -pipe CFLAG.

    2. Re:Of Course. by fuzzyfuzzyfungus · · Score: 4, Interesting

      I have to wonder if the 16GB "requirement" is more of a recommendation and/or a bunch of default settings that deliberately avoid the disk as much as possible, and keep as many cores as you can throw at the job busy by compiling every little bit and piece in parallel...

      On the one hand, with 16GB of RAM in the desktop/light workstation 4x4GB only running around $100(with the more workstation-friendly 2x8GB with ECC only twice that), it seems rather pointless to burn any developer time on trying to optimize the RAM needs of building the entire OS. RAM is cheap.

      On the other hand, I have to wonder what they could possibly be doing to the process of compiling what is basically a weird-but-not-unrecognizable linux distro to make it that RAM hungry.

    3. Re:Of Course. by mjwx · · Score: 5, Interesting

      I have to wonder if the 16GB "requirement" is more of a recommendation and/or a bunch of default settings that deliberately avoid the disk as much as possible

      I have to wonder if the 16 GB requirement is real.

      Reading the blog linked to in the summary, there is no source mentioned. The author completely fails to mention how they came across this information. Even ignoring their bad English (obviously not their first language).

      I think I'll wait for a more trustworthy source to confirm or deny this.

      --
      Calling someone a "hater" only means you can not rationally rebut their argument.
    4. Re:Of Course. by a_n_d_e_r_s · · Score: 2

      Looking at the article; the 16GB is because they compile the code in parallell so need lots of memory. They get the 5 hours of build time down to 25 min.

      --
      Just saying it like it are.
    5. Re:Of Course. by kidgenius · · Score: 3, Informative
    6. Re:Of Course. by PopeRatzo · · Score: 5, Informative

      And if you read that original source, you'll see that they are recommendations for building future development machines:

      -6GB of download.
      -25GB disk space to do a single build.
      -80GB disk space to build all AOSP configs at the same time.
      -16GB RAM recommended, more preferred, anything less will measurably
      benefit from using an SSD.
      -5+ hours of CPU time for a single build, 25+ minutes of wall time, as
      measured on my workstation (dual-E5620 i.e. 2x quad-core 2.4GHz HT,
      with 24GB of RAM, no SSD),

      --
      You are welcome on my lawn.
    7. Re:Of Course. by evilviper · · Score: 5, Informative

      To me, that sounds like it takes 5 hours after compiling the code in parallel. So if it was a single threaded compilation job, in theory, the task would take much much longer.

      Yes, it does SOUND that way... It's very "truthy" that way...

      Relying on /. summaries just makes you look like an idiot, when you're just one quick and easy click away from the source. Surely, if you cant be bothered to put that much effort in, then you must not have enough time to write-up a response, either...

      Verbatim quote from TFA:
          "5+ hours of CPU time for a single build, 25+ minutes of wall time"

      --
      Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
    8. Re:Of Course. by chrb · · Score: 2

      If I remember correctly, you could build OpenOffice on Gentoo with -pipe and various other performance tuning flags, and the hardware requirement was only a minimum of 512MB. And every other package, including big stuff like the kernel and KDE, could be built with only 64MB... though 256MB was recommended.

      I would guess the default Android build is optimized for the Google Android team, and so speed is the most important factor; they probably use a build server with multiple processors and big memory and don't waste engineering time on optimizing for anything else. I would also guess that there probably aren't that many people outside of Google who build their own Android images.

    9. Re:Of Course. by Calos · · Score: 4, Informative

      Mmm, no. Third party modders do a lot of work, and make some really awesome builds, with all kinds of customizations and new features. Cyanogenmod, for instance. Quite the opposite of working for a large company with resources, their developer are now actually being hired by big companies because of their freelance work.

      --
      I vote based on politicians' actions, unless contrary to my preconceptions. Often wrong, never uncertain. #iamthe99%
    10. Re:Of Course. by RCGodward · · Score: 2

      Hyperthreading. Best base is 25 * 16 = 400, so getting 300 doesn't seem so unlikely.

  2. Recommended, not required, right? by BeforeCoffee · · Score: 2

    16GB recommended, or else you'll be waiting quite awhile. But, you could build the thing in less RAM than that, right?

  3. 16GB RAM and GCC optimization by Zan+Lynx · · Score: 2

    This is a guess as to the reason.

    One of the better ways to optimize C++ code for building with GCC is to put all of the source code into one big code file. Or you can build it as a few independent modules, but the code is still quite large. Then you build it with the O3 flags. In GCC, the amount of RAM and CPU used in an O3 compile goes up by quite a lot as the code size in a single module increases. I am not sure what the exact equation is but I think it's an exponential function.

    This would easily explain the RAM and CPU usage.

    1. Re:16GB RAM and GCC optimization by Rich0 · · Score: 2

      I run Gentoo and usually run make with -j5 on a tmpfs, and I've never managed to use even half of my 8GB RAM building anything from chromium to firefox to openoffice. And I certainly don't skimp on my CFLAGS.

      Maybe if you build this thing on a tmpfs and run -j50 or something you'd need that kind of RAM, but seriously...

      Plus, since parallel make tends to limit itself to a single module at a time in most build systems it is hard to get the parallelism to be all that high anyway.

      I'll take them at their word, but I suspect that you'd be able to build android with a lot less than 16GB if you aren't running so highly parallelized. For starters I certainly don't have 8 cores to throw at it...

    2. Re:16GB RAM and GCC optimization by bucky0 · · Score: 3, Informative

      No, you can perform better optimizations if you know, for instance, that a function can be inlined. You can't get that if some of the uses are in other compilation units.

      --

      -Bucky
    3. Re:16GB RAM and GCC optimization by exomondo · · Score: 2

      I can't think of any good reason that it would take 16 GB to compile anything.

      Well how much RAM would you think should be needed to compile Android? If you're taking 5 hours of CPU time to ~25mins wall time then obviously your parallel compiles are going to be chewing up a lot of RAM. If you reduced the amount of parallel builds it would reduce the amount of RAM required - and also take a lot longer.

    4. Re:16GB RAM and GCC optimization by Intropy · · Score: 5, Informative
      Yes, there certainly are. The most obvious reason is code optimization. If your target device is something relatively light on resources like a mobile phone, then you probably want to optimize very aggressively. All forms of optimization require context. For something like "false && statement" all the required context for optimizing away the statement is very nearby. Something like the return value optimization needs to know about the entire function. So far we're considering the easy stuff. If you want to go all out and get into whole program optimization then some optimizations cannot be guaranteed to be safe without knowing the entire program.

      Now if "compile" refers to the entire build process, then we're also probably talking about some serious static analysis. Checking for things like "can this function ever throw?" or "is this code reachable?" or "is the memory allocated here always eventually freed?" also requires an awful lot of context to check. In the worst case each of these questions requires knowing all of the code to answer.

    5. Re:16GB RAM and GCC optimization by tyrione · · Score: 2

      This is a guess as to the reason.

      One of the better ways to optimize C++ code for building with GCC is to put all of the source code into one big code file. Or you can build it as a few independent modules, but the code is still quite large. Then you build it with the O3 flags. In GCC, the amount of RAM and CPU used in an O3 compile goes up by quite a lot as the code size in a single module increases. I am not sure what the exact equation is but I think it's an exponential function.

      This would easily explain the RAM and CPU usage.

      And when LLVM/Clang gets full Concurrency in 3.1 you can bet Google will be put GCC in the rear of the bus with LLVM/Clang taking over the wheel.

    6. Re:16GB RAM and GCC optimization by t2t10 · · Score: 2

      The most obvious reason is code optimization. If your target device is something relatively light on resources like a mobile phone, then you probably want to optimize very aggressively.

      And that's why they program the phone in Java???

      All forms of optimization require context. For something like "false && statement" all the required context for optimizing away the statement is very nearby.

      Whole program optimization is useful for large computational codes. It is useless for something as dynamic as a mobile phone operating system. If you attempt to run such optimizations on something like Android, you get a bloated memory footprint and a miniscule performance improvement, leaving you worse off than you would otherwise have been.

      JIT was supposed to fix this (since it obviates the need for whole program analysis; you just compile the hotspots), but obviously that didn't work out so well either.

    7. Re:16GB RAM and GCC optimization by smash · · Score: 2

      maybe they should switch to clang.

      --
      I run: Windows, OS X, Linux, FreeBSD. Just because you have a hammer, doesn't mean everything is a nail.
  4. Re:16 Gigabytes RAM costs $100 by Anonymous Coward · · Score: 5, Funny

    ...and a computer that can take 16 gigs of RAM.

    I mean, you can spend $100 and buy a 16-inch horse cock dildo, but that doesn't mean you can shove the whole thing up your ass.

  5. So that's Google's master plan by Anonymous Coward · · Score: 5, Funny

    While Android will remain open-source, eventually it will require so much RAM/processing power/etc. to compile that only Google will have the computational resources available to compile it.

    Clever!

  6. Rookie question on debugging monster code bases by Twinbee · · Score: 3, Interesting

    Quick question for those with giant codebases such as this. How the heck do you test, and debug the software with those kind of lag times? Do you split everything up into smaller pieces or something? If so, then surely there are cases where you need to test something that requires EVERYTHING to be compiled. I can imagine such shot in the dark scenarios to be the stuff of pure nightmares.

    --
    Why OpalCalc is the best Windows calc
    1. Re:Rookie question on debugging monster code bases by tchuladdiass · · Score: 2

      Back in my college days we had to submit a compilation job on the mainframe, and then wait around for a couple hours for someone to put the printout containing the results (or more likely a crash dump) into the appropriate mail box slot. Then you had to wait your turn to submit a revised copy. (No, this wasn't that long ago -- 89, 90, something like that -- but the community college I went to still taught their Cobol & assembly classes on an older mainframe -- 3270 terminals though, no punch cards).

      But in the case of Android, remember that all the components are still separate -- you have the Dalvik VM, the Linux kernel, and libraries as probably the large components. So you can still debug any particular program module independently.

    2. Re:Rookie question on debugging monster code bases by Osgeld · · Score: 2

      As others have said, you dont recompile the entire thing cause you changed one integer, but as others have not said you really should be testing in smaller chunks, you are not perfect enough to vomit out something that takes 5 hours of CPU time (which on the given systems is about a half hour of real time) perfectly the first time you try.

      Its much easier to write a chunk and make sure it works than to write a freeking monster blob and go hunting for a chain reaction.

  7. not true by MrCrassic · · Score: 4, Informative
    Here's what the article *actually* says:

    16GB RAM recommended, more preferred, anything less will measurably benefit from using an SSD.

    Emphasis mine. Still pretty beast, though.

  8. Re:16 Gigabytes RAM costs $100 by Anonymous Coward · · Score: 3, Funny

    I mean, you can spend $100 and buy a 16-inch horse cock dildo

    I'll leave that to you. Interesting that you knew the price off the top of your head, though.

  9. Recompile *should* be much, much faster by dwheeler · · Score: 3, Informative

    Unless the build system is screwed up, recompiling after a change should be relatively fast. Usually source code is stored as lots of smaller files, and each file is compiled separately to produce a separate object file (e.g., .o). Then next time a rebuild is requested, the system should notice what changed, and only rebuild the needed parts. Some parts take the same time each time (e.g., a final link), but it shouldn't take anywhere near the same amount of time. There are lots of build tools, including make, cmake, and so on. If you use the venerable "make" tool, you might want to read Miller's "Recursive Make Considered Harmful": http://aegis.sourceforge.net/auug97.pdf Cue the lovers and haters of "make", here :-).

    --
    - David A. Wheeler (see my Secure Programming HOWTO)
  10. shitty /. summary by petermgreen · · Score: 5, Informative

    TFA: "5+ hours of CPU time for a single build, 25+ minutes of wall time, as measured on a workstation (dual-E5620 i.e. 2x quad-core 2.4GHz HT, with 24GB of RAM, no SSD)."
    /. Summary: "It will take 5 hours to compile on a dual quad-core 2+GHz workstation"

    --
    note: i'm known as plugwash most places but i screwd up registering that here somehow in the past and now can't register
  11. Depends on how you look at it by Sycraft-fu · · Score: 5, Informative

    While it is a lot of RAM compared to what many system have, it really isn't a big deal these days. 4GB DDR3 sticks are $25 or less each, and that is for high quality RAM. Regular, consumer grade, LGA1155 boards support 4 of them. So for $100 you can have 16GB on a normal desktop system. My home system I type this on has 16GB for that reason. It was so cheap I decided "Why not?"

    They actually can support more, with 8GB chips you can have 32GB on a standard desktop, but those are still expensive.

    The enthusiast X79 LGA2011 boards coming out will have 8 sockets and thus handle 64GB. Of course beyond that there's workstation which cost a lot more, but not as much as you might first think.

    At any rate, 16GB is now a "regular desktop" amount of RAM. Standard boards the likes of which you get in cheap ($1000 or less) towers support that much, and it only costs $100 to get. It is quite a realistic thing to require, for something high end.

  12. Hmmm... by damn_registrars · · Score: 2

    I was looking for something else to do on my old 16-cpu Itanium cluster with 64gbs of shared ram. I think I just found it...

    --
    Damn_registrars has no butt-hole. Damn_registrars has no use for a butt-hole.
  13. Re:16 Gigabytes RAM costs $100 by izomiac · · Score: 2

    16 GB is far more than any desktop user should need, and most laptops simply cannot hold that much, so it's creating a sharp demarcation between user and developer. This is bad. You want your advance users to naturally transition into becoming developers, and making your codebase inaccessible for them prevents that.

    IOW, most people have suggestions for improvement for any tool they use. Ideally, it would be trivial for someone to download the source, modify it, recompile, test, and submit improvements. People start with simple things (e.g. misspelled words) and move to more advanced tasks as they gain familiarity. By requiring several hundred dollars of hardware and massive time investments, you are ensuring that users never become developers, just needy consumers whining about feature requests.

  14. Build battle scars? by ben_kelley · · Score: 5, Funny

    Unless the build system is screwed up, recompiling after a change should be relatively fast. Usually source code is stored as lots of smaller files [...] Then next time a rebuild is requested, the system should notice what changed, and only rebuild the needed parts.

    I feel your pain brother.

  15. Re:Have I heard this before? by darkonc · · Score: 2
    If the undocumented API changes or disappears, be ready to either (1) change your code, or (2) emulate the old API. Nothing nefarious -- just too damned lazy to document something that might be unstable.

    Human nature -- If you document it, people will expect it to be stable (no matter what you may say to the contrary). Undocumented API's have a built-in "we told you so" flavour to them.

    --
    Sometimes boldness is in fashion. Sometimes only the brave will be bold.
  16. Windows by file_reaper · · Score: 2

    I wonder how long a full compile of that takes...

  17. Why? by wisnoskij · · Score: 2

    Unless the entire program is in 1 gigantic 8 billion billion billion line file why would it need that many resources or even be able to use 16 GB of RAM?
    Assuming it is like a normal program would it not just be a large collection of relatively small files that are compiled one after the other (theoretically number of CPUs + 1 threads running at a time with that many files being compiled concurrently being the optimal solution)?
    And I just do not see how you could ever use up 16 GB at any one time.

    --
    Troll is not a replacement for I disagree.
  18. If memory were still expensive... by JackAxe · · Score: 3, Insightful

    This article would be shocking, but considering that 16 GB of memory -- especially the dual-channel DDR3 used for the i5 and consumer i7's -- is so cheap, less than $100, this article doesn't have any shock value. It's just informative. It's letting us know the 'recommended' memory and giving more nerds an excuse to add more RAM. That is the NERDS that don't already have 24 gigs for their virtual machines. :P

  19. Re:A good reason to look at D instead of C++ by Guy+Harris · · Score: 2

    The D programming language compiles much faster than C++. It was designed to be easier to lex & parse

    So how much of the compile time for C/C++ code is spent processing the characters in the source code and how much is spent processing the intermediate representation and turning it into machine code? If the answer is "most of the time is spent doing the latter", then "designed to be easier to lex and parse" doesn't help much.

    (And how much of Android is C/C++ and how much of it is in their Java dialect? How much of that time is spent translating C/C++ to machine code and how much of it is spent translating Java to Dalvik bytecode?)

  20. Re:Show me your work! by canajin56 · · Score: 2

    Hyperthreading! With 8 physical cores, the OS sees 16 logical cores. 16 threads can be running at once. Though technically only 8 are running because there aren't extra copies of the adders, multipliers, etc, whenever one is waiting on memory, or stalled because a branch miss-prediction emptied the pipeline, etc. then the other thread can run instantly. Normally it's stupid to context switch due to a branch error or cache miss, since probably that will be resolved before you can finish the very expensive context switch operation. Having two sets of registers and such allows for instant switching between which of the two logical cores is being handled by the physical core, so any time either thread is waiting on memory, the other thread can get some work done. And whenever it's stalled on something that actually would require a context switch normally, it can be handed off to the other one while that switch is occurring. It's not nearly as good as having 16 physical cores, but usually you get about 30% more CPU time squeezed in be doing this. 4 hours * 1.30 = 5.2 hours. Seems consistent to me.

    --
    ASCII stupid question, get a stupid ANSI