Slashdot Mirror


Can You Spare A Few Trillion Cycles?

rkeene517 writes "11 years ago I did a simulation of 29 billion photons in a room, that got published at SIGGRAPH 94. The 1994 image, called Photon Soup is here . Now computers are 3000 times faster and I am doing it again only much better, with a smaller aperature, in stereo, with 3 cameras, and with some errors fixed, and in Java. The 1994 image took 100 Sparc Station 1's a month to generate. I need volunteers to run the program for about a month in the background and/or nights. The program is pure Java." Read on for how you can participate in the project.

"The plan is to run the program on a zillion machines for a month and combine the results. All you have to do is run it and when the deadline arrives, email me a compressed file of the cache directory. So email me here and I'll send you the zip file. The deadline will be June 1st 2004.

The running program has a More CPU/Less CPU button. Every half hour it saves the current state of the film. The longer and more machines that run this, the cleaner and sharper the image gets. If you have a lot of machines, I can give instructions how to combine the results so you can send in a single cache directory.

Of course, you will get mention in the article if it gets published."

70 of 570 comments (clear)

  1. Java eh? by Anonymous Coward · · Score: 5, Funny

    Java eh? So it should run at about the same speed now on modern hardware as it did a decade ago? Chortle.

    1. Re:Java eh? by Anonymous Coward · · Score: 5, Interesting

      It depends. If you use Java Objects instead of C / C++ int, then probably yes. If you use Java int instead of C++ int, then the speed is about the same. And you will find absolutely no difference if you need floating point.

      I did quite a lot of C++ and Java programming. At one point, I thought: 'oh, I have now a beautiful and quite fast Java fractal application (mandelbrot), let's convert that to C++ and it will be even faster.'. It was even slower in C++ (probably because of the C++ compiler, Visual Studio). And that was quite a long time back. The link is: http://users.quick-line.ch/thomasm

    2. Re:Java eh? by Anonymous Coward · · Score: 4, Informative

      Ok. My assembly is a little rusty, so bear with me. Let's say we have equivalent Java and C programs. They both have to run on a 386 or higher. (Bear with me. I haven't kept up with the MMX/SSE/SSE2 instructions, so I'll have to fake this a little.) Now, your C compiler will see that you want to store a 32 bit value, but has to generate code for a 386. So, it generates the code:

      pop AX
      STOSW 0x0005
      pop AX
      STOSW 0x0005

      Even though the code may be running on a Pentium Pro (which is optmized for 32 bit code), it's still going to execute those 4 statements.

      Now, the Java Hotspot compiler will start and notice the fact that you're running on a Pentium Pro. So when it converts the bytecode to machine code, it creates the following instructions:

      pop EAX
      STOD 0x0005

      That's twice as fast as the C code!

      Real code would tend to be running on modern processors, so this example is a little contrived. However, the JVM can (and will) use SSE instructions to do multiple calculations in one instruction, while the C code will be forced to generate non-SSE instructions to support the old Pentium Is out there.

      Hotspot is also capable of analyzing the running code and regenerating even better assembly that would perform poorly in other circumstances. For example, let's say Hotspot notices that the bounds can't be exceeded on an array. Well, Hotspot will then recompile to remove the bounds checking.

      Does that explain it better?!

      --
      This post is open source, retransmit as desired.

    3. Re:Java eh? by TheLink · · Score: 4, Informative

      His argument isn't invalid.

      rkeene517 is asking for volunteers to run the program. If rkeene517 does it in C/C++ then rkeene will have to compile for the different x86 types and ensure that volunteers download the right binary. From experience you end up getting a high number of people getting the generic x86 binary instead of the optimized one because in order to avoid zillions of support queries, you have a "If you are unsure, click on i386".

      Of course you could bundle all the various binaries and add code or a binary that figures out what x86 it is and runs the relevant binary.

      But that involves a step more than what you suggest.

      --
    4. Re:Java eh? by GlynDavies · · Score: 4, Informative

      His argument is quite valid.
      Sure, you can configure compilers as narrowly as you like, but in most cases, compliation will be targeted at the lowest common denominator.
      If your compiling for yourself, you have the luxury of building for your own CPU. This isn't the case here.
      Why do you think Linux binary rpm's, for years, were compiled for 386 chips. It's only recently that some (all?) distributions have started distributing 586 based rpms.

      The point is, Java can make this decision at run-time, and hence target the actual CPU. C++ code can not (without a lot of pain, at least).

    5. Re:Java eh? by AllUsernamesAreGone · · Score: 4, Insightful

      This is true for pure number crunching where you spend a lot of time in loops.

      Java is quite good at that.

      Now, try writing a real application. One with an interface, one that does real work and spends most of its time interacting with a user rather than banging numbers. Run the test again and you'll find that C++ is significantly faster than Java in this situation because Swing is slower than arthritic snail carrying a small planet and Hotspot isn't good at optimising the sort of stuff a general program has to do.

    6. Re:Java eh? by tap · · Score: 3, Insightful

      It seems like your trying to say that the C compiler must produce 16 bit code for a 386, but the java JIT compiler will produce 32 bit code.

      The problem with that is that the 386 is 32 bit! You're comparing a C compiler making 16 bit code for a 286 to a java compiler for a 32 bit platform. Unless you know of a java runtime that works on 286 or worse processor, that's not a fair comparison.

      It's still silly anyways. Compilers can produce code tuned for different CPUs. There is no need to compile for the lowest common denominator. When I compile scientific programs at work, I sure as hell don't compile for a 286. I don't even have a compiler than can produce 16 bit code! I always tune the compile for the specific CPUs.

    7. Re:Java eh? by gauchopuro · · Score: 3, Informative

      Sure, it's hard to do by hand. But I know of at least one compiler (Intel's C++ compiler) that can generate multiple versions of assembly code and dispatch on processor type at runtime. That compiler is much better than Visual Studio for numerical computation.

    8. Re:Java eh? by BlackHawk-666 · · Score: 4, Insightful

      If this is true then why is Java so goddammed slow still? Why is it every medium sized or above Java app I've used performs like crap compared to a similar one compiled in C++ or simlilar languages? It just seems to me there is a major disconnect between what the Java adherants are claiming and the reality I am faced with every time I use a Java app.

      --
      All those moments will be lost in time, like tears in rain.
    9. Re:Java eh? by Suidae · · Score: 4, Interesting

      I don't know why Java is so slow, but I wonder if it has something to do with memory requirements/managment?

      All the Java apps I use that are not trivial tend to eat at least 100Mb of ram, and sometimes several hundred. They also tend to stomp all over my poor CPU, which, at 500-1000Mhz, really ought to be fast enough for most things (seriously, I'm not trying to crunch SETI data or crack an RC5 key here).

      I attribute most Java slowness to poor programming techniques. Its got to be, since Java programmers are always telling me how fast the code really is; it must just be that most Java coders are so crappy that they drag that blazing fast JVM to its knees.

    10. Re:Java eh? by markbthomas · · Score: 5, Informative

      Given that this was an exercise, I'm somewhat tempted to ask whether you aren't counting the JVM startup time on top of a very short problem instance.

      C: 30 seconds, Java: 8 hours. No kidding. These were running on the same laboratory machines, the Java programs using the latest Sun JVM at the time. The exercise involved calculating some statistics from a simulation run for one virtual year. Most of the people doing the Java version had to leave it running overnight. Besides, JVM startup time is a performance issue, you can't just dismiss it out of hand.

      That, or whether the exercise involved lots of dynamic creation of objects (in which case your program was by definition not doing the same thing as the Java implementations). The exercise you mention sort of sounds like that.

      In the Java version, each event was an object. In C each event was a malloc'd struct. These are analagous in that they are the correct way to solve the problem in that particular language. The fact that object creation and destruction is a lengthy process is an important reason why Java is so slow. It's an object-oriented language, its raison d'etre is to create and destroy objects. If it can't do that fast enough then what's the point in it being able to do anything else with speed?

      I know at this point the Java apologists will say "just use a pool of pre-created Objects, that'll speed it up". This misses the point in two ways: (1) Java was supposed to obviate the need to perform manual memory handling. Now I have to not only remember to de-allocate my objects when I am done with them, I have to write a Pool class within which to store my not-currently-in-use objects?! (2) I can do that in C, too, if I really want to, and it'll make the C version faster again.

      I am well aware of the forte of Haskell and its different interpreter implementations. To the degree that I wouldn't be surprised if the Haskell implementation did better than your C implementation.

      They didn't. I was told they took around 10 minutes to run, but I never actually saw them working. When I produced results from a simulation that ran for 1000 years (an overnight run for my C program), the professor was amazed. But yes, in my experience interpreted Haskell is very fast, which makes Java look even more foolish.

      I've done this four times now; written a C equivalent of a Java program and found it at least one, often several orders of magnitude faster. I've yet once to be shown a Java program that is significantly faster than its C equivalent.

      This does not mean that Java should not be used as a programming language. The language features (especially those in version 1.5) are useful for working in a collaborative environment with mediocre programmers, and where the raw performance of the application is not critical (such as a GUI front-end to a server application). Just don't bullshit about it being faster than C, or even "fast" and expect me to believe it.

      I'm willing to be proven wrong, but until someone can actually show me proof that it can be done, I'm not going to believe the hype, hand-waving and hot air.

  2. Dude, you should try out China by alphakappa · · Score: 5, Funny

    I hear they use cycles big time there. Pretty cheap too comapared to cars.

    --
    "When the only tool you own is a hammer, every problem begins to resemble a nail." - Abraham Maslow (1908-1970)
  3. More distributed processing by isugimpy · · Score: 4, Insightful

    This is a wonderful thing to see. Distributed processing is a wonderful way to spend those extra clock cycles that most of us have, while at the same time benefitting someone else. I really hope to see more projects like this in the future.

    1. Re:More distributed processing by Stween · · Score: 3, Insightful

      It's voluntary.

      If you don't want to pay however much extra it might be, you don't have to participate; nobody's forcing you.

  4. Real URL to image by FrenZon · · Score: 3, Informative

    Emailed this to the editor, but something must've gone wrong.

    The URL to the photo soup image is missing the 'www'. The image can be seen here (you may want to do a 'Save Target As', as the mime-type seems to be a bit off).

  5. Java? by Kent+Simon · · Score: 4, Insightful

    nothing against Java it has its place, but for something this CPU intensive, it seems like you'd be wasting CPU cycles. This sounds like a job for C.

    --
    Kent Simon Multitheft Auto
    1. Re:Java? by hayds · · Score: 5, Insightful

      Java can actually be quite fast and efficient for number crunching or scientific applications because of the JIT compilers and automatic optimisation. Its only painfully slow when you need a GUI. It also has a great class library so he should be able to do things like the visualisation and the networking for the clients to send the data home relatively easily, whereas it would take a lot longer to write and debug in C.

      Also with Java, he can just offer the JAR file on his site or whatever and people can d/l it and run it. I guess this isnt really important if he's aiming at geeks, but if he's trying to get others to participate, it is handy that people wont need to worry about compiling it themselves or picking the right version (like at the seti@home site).

    2. Re:Java? by Anonymous Coward · · Score: 5, Informative

      Not really that slow, depends on what you're doing. At work we're using a CPU intensive Java based "optimizer" that runs a hybrid Genetic Algorithm. We also have a very similar version that was coded in C++. Chances are that the C++ coders sorta sucked, but the end result has been pretty much the same. The only difference was that our Java application actually DOES run on many platforms, including Windows, SuSE, and MacOS X, without a problem. And I can't say it enough times, it's just as fast as the C++ version that only runs on Windows .

    3. Re:Java? by eric76 · · Score: 3, Insightful

      I think the primary reason is that there are enormous numbers of numerical routines in Fortran that are extremely well debugged and validated.

      Change to other languages and those routines must be rewritten, redebugged, and revalidated.

  6. Hi-quality pr0n by Compact+Dick · · Score: 3, Funny
    Now ... I am doing it again only much better, with a smaller aperature [sic], in stereo, with 3 cameras ...
    The world needs more dedicated releasers like you.
  7. Nah by AstrumPreliator · · Score: 4, Funny

    I don't feel like donating a few trillion cycles to produce an image that says "The page cannot be displayed". Possibly if you made it say, "The photons cannot be displayed", I would think about it.

    =P

  8. Best time is Winter by DigiShaman · · Score: 4, Funny

    The best time for these project is in the Winter time. Because, that's when I have my heater on. And if my CPU is running 100%, then the heat from it will help heat up my appartment rather then the heater needing to kick on.

    I mean, I don't mean to belittle this project. But for all grid computing projects, there is a better time and place for this in my opinion.

    --
    Life is not for the lazy.
  9. Broken link, java jab by Dominic_Mazzoni · · Score: 4, Informative

    The link to the image should be http://www.cpjava.net/raytraces/DRUN.GIF (The www is necessary and was left out of the link in the article.)

    People are already cracking jokes about how the fact that it's in Java will mean that it will run a lot slower than it could. While I love to pick on Java as much as the next person, I am curious how much it actually makes a difference for raytracing - does anyone know? My experience with numerically-intensive algorithms is that Java is 2-4x slower than C. You can get it within 2x of the speed of C if you ignore object-oriented programming and you're really good at Java optimization, but that's it. And it will run much slower on some architecetures because Java guarantees certain floating-point operation semantics at the expense of speed.

    If I were writing a new numerically-intensive program from scratch that I wanted to use for a cross-platform distributed computing project, I'd probably do it in Numerical Python (NumPy) - my experience has been that it can be within a factor of 2-3 of the speed of C, but it's much more concise, requiring half as many lines of code as Java or C to do the same thing. And these days Python is just as cross-platform as Java - it definitely runs great on Mac, Windows, and Unix.

    1. Re:Broken link, java jab by evanbd · · Score: 5, Informative
      Not so slow as that... I have no idea about raytracing, but I've done several compute-intensive applications with Java. Both of them, the Java code has run at most 20-30% slower than the C. The two that I have worked with recently are a program that plays Amazons (a modern board game; fairly nifty) and recently one that does stuff with MD5 (searching for partial collisions). Now, I consider myself competent at Java optimization, but by no means an expert. So, a couple minor pieces of advice for anyone who wants to make their java programs a bit faster, and doesn't really know how:

      1. Learn to use java -Xprof. This is a rudimentary profiler, but even the most basic data is useful. Concentrate on the parts that get the most use.

      2. If -Xprof says the garbage collector is taking more than about 1-2% of the cpu, it's a problem. If it's at 10%, it's costing you well more than 10% speed -- lots of reasons, like cache misses, thread switching, and the allocations in the first place.

      3. Don't delete objects in the main loop. Use factory methods and the like if you have to. This is how you decrease GC times.

      4. Some of the standard API pieces are very slow. I've had particular trouble with anything related to the Collections framework, and Strings are even worse. Avoid these.

      Now, all this takes work, but it's not particularly harder or easier than doing good optimization of C Code.

    2. Re:Broken link, java jab by Anonymous Coward · · Score: 4, Informative

      ...and don't forget "-server". The Sun 1.4.2VM with -server now generates SSE code, giving a nice boost to FP apps.

    3. Re:Broken link, java jab by ajs · · Score: 3, Insightful

      Yeah, tools like this are excellent. In the astro community, they use a tool called IDL (interactive data language, I think?) which is similar. High level constructs, with lots of big primatives to get you very fast computation.

      Perl has an excellent tool called PDL that does roughly the same thing, and is used by the Perl/Gimp interface, yeilding some wonderful possibilities.

      That said, Java was the right choice for this. Java may have poor systems integration and a host of issues that arise from that (i.e. Java's platform agnosticism, which actually turns into a sort of single-platform dependence on itself with little or no integration with its actual platform), but when it comes to handing thousands of people a program that is going to run mathematical calculations EXACTLY THE SAME WAY on every machine, Java has Python, Perl, Ruby, C# and a host of other high level languages beat because it allows you to enforce very specific constraints on how the math will be done. All of the others just provide you with varying degrees of abstraction on top of your native execution models.

      Once Parrot is done, I suspect that more languages, ported to run on top of Parrot, will also offer these constraints as optional features, but time will tell.

  10. Photons by richie2000 · · Score: 5, Interesting
    Thought experiment:
    Go outside (No, it won't kill you) and look up at a bright star. Now imagine that star is in the center of a sphere and your eye is on the surface of the sphere. The aperture of your eye captures enough photons to image the star constantly. Now imagine that same amount of photons reaching all points of the sphere's surface. That's a serious bunch of photons. And the star outputs them constantly, for billions of years.

    Any biology majors here care to tell me how many photons the eye needs to 'see' a reasonably bright star? With that information, you can calculate the rest (left as an exercise for the reader).

    --
    Money for nothing, pix for free
    1. Re:Photons by Kelerain · · Score: 5, Funny

      According to one of my Psych professors, under ideal conditions the human eye can detect a single photon.

      For example, when looking at a photon detector.

    2. Re:Photons by Bandwidth_ · · Score: 5, Interesting

      >Any biology majors here care to tell me how many
      >photons the eye needs to 'see' a reasonably >bright star? With that information, you can
      >calculate the rest (left as an exercise for the
      >reader).

      The rods in human eyes are incredibly efficient photoreceptors. They can reportedly be triggered by individual photons under optimal conditions. This was proven by experiment in the mid 1950s sometime in a pitch black room after 30 minutes of adaptation. A controlled light source was placed at an angle of 20 degrees or so away from the eye plane and tests were done such that the absolute minimum threshold of light intensity was found. Calculations based on angle, spread, etc were made and the area the light source would hit in the eye. It was found that, as stated above, rods could reliably detect single photons.

      It's an evolutionary limit of sorts. I may be off on the procedure as I'm recalling it from an odd psychophysics book I read back at uni but I'm fairly sure of the single photon thing.

    3. Re:Photons by Yarn · · Score: 3, Interesting

      I'm a physicist, but IIRC a rod (monochrome sensor) absorbs a photon 50% of the time, and from that absorbed photon outputs a signal about 50% of the time. Hence, about 4 photons to have a high probability of detection.

      The colour sensors (cones) are less sensitive. Whilst googling for the sensitivity of these I found a page detailing the sensitivity of the eye It needs about 500 to 900 photons/sec to actually register. However, I've already written about rods so I'm not going to delete that!

      --
      -Yarn - Rio Karma: Excellent
  11. Oh boy... by MosesJones · · Score: 5, Insightful


    He needs networking connection, a decent threading model and doesn't want to crash your box.

    So while he could spend a huge amount of time doing all these basic things in C and still have major risks for the people running it, he has chosen to use the right tool for the job.

    Also the Maths libraries are IEEE compliant in Java and not in C on the PC, so I'm assuming that also played in to his reasoning.

    --
    An Eye for an Eye will make the whole world blind - Gandhi
    1. Re:Oh boy... by pla · · Score: 4, Insightful

      He needs networking connection, a decent threading model and doesn't want to crash your box.

      False, on all of the above.

      For "networking", users will manually send him their cache directory (as the FP explicitly stated). As for threading... To do what? He wants to run a completely straightforward trajectory simulation, iterated a few "zillion" times. I'll admit that I have a bias against most uses of multithreading and consider them inappropriate 99.9% of the time, but if you can even force them onto this project, you need to go back to the drawing board.



      So while he could spend a huge amount of time doing all these basic things in C and still have major risks for the people running it, he has chosen to use the right tool for the job.

      Umm... Yeah, whatever. He wants to run a CPU-intensive background process, performing a totally straightforward set of calculations, and nothing else. No GUI (beyond a few simple controls to make it play nice), and nothing server-side - sounds like a perfect candidate for anything but Java.

      Personally, I'd say this even sounds like a good candidate for hand-tuned assembly. But then, at least from my alma-mater, they don't even require that to graduate in CS anymore. Sad... And people actually wonder why tech jobs keep heading for India. Well, the FP and you just provided a nice answer - Using Java for a tightly CPU-bound problem? Using threads for the same (Ever heard of "cache consistancy"? Yet another reason to avoid multithreading in a program of this nature)? Why not just downgrade to a 486? Same effect, less complex.

    2. Re:Oh boy... by David+Leppik · · Score: 4, Insightful
      He wants to run a CPU-intensive background process, performing a totally straightforward set of calculations, and nothing else. No GUI (beyond a few simple controls to make it play nice), and nothing server-side - sounds like a perfect candidate for anything but Java.
      Except that what makes Java slow is its do-it-yourself GUI and run-time object management. Those disadvantages mostly go away if you program Java as if it were C: use and re-use arrays of primative types in preference to short-lived objects, and cluster things together in memory (via arrays) when they are used together. The just-in-time compiler will convert the bytecode into machine instructions on the fly, using information that's not available at compile time.
      Personally, I'd say this even sounds like a good candidate for hand-tuned assembly.
      Okay, I'll bite. I've got two macs and to Linux boxes here. Each has a different processor architecture (Celeron, Athalon, G3, G4.) I don't know much about hand-tuning for x86, but on the G4 you shove your floats into 128-bit vectors and do your ray tracing in chunks of four floats. The G3 lacks the vector coprocessor, so you'd optimize it in a very different way.

      Besides, by writing in Java and not hand-written assembly, he gets to run it on machines like mine, which probably weren't the original target platform. The name of the game in distributed processing is to use as many spare processors as possible, even if some are slow. An hour of work to promote his project is more likely to pick up 10% more (or 1000% more, with \.) CPUs than an hour of hand-tuning assembly is likely to get 10% more speed out of a particular processor.

  12. Re:Java is a slow cruncher by LarsWestergren · · Score: 4, Insightful
    He sounds like a clever guy, but "pure Java" for number crunching!?! With "pure C", it'd take half the time with half the number of computers.

    ...but he would have to spend a lot more time porting it between different architectures and OSes. God, how many times do you have to explain this to people? These days, processing cycles cheap, programmer time expensive.


    FP ops in Java are incredibly slow and broken.


    Er, do you have any more recent numbers than a lecture from 2001, originally published in 1998??
    --

    Being bitter is drinking poison and hoping someone else will die

  13. Re:Java can be faster then C sometimes by Metallic+Matty · · Score: 3, Informative

    Either I'm suffering deja vu, or this has been posted nearly verbatim before in a previous discussion of Java vs. C.

    Astounding.

  14. Explain picture by miike · · Score: 5, Interesting

    I would like to know what I see in the picture before I dedicate my cycles to the project. What are those "bubbles" in the pic for example?

    1. Re:Explain picture by rkeene517 · · Score: 5, Informative

      The old 1994 picture is of a cubic room with mirrors on the near and far walls. The 'bubbles' are refletive spheres. A beam of light comes out of the left wall, hits a prism and forms a spectrum on the right wall. The depth of field is very shallow so only objects exactly on the focal plane are in focus. The black fuzzy blob is the camera aperature, out of focus, being reflected in the far mirror. There is an error in the image. The corners of the room are bright and should not be. This is due to a poorly chosen diffuse scattering model. The current project is an almost identicle setup, with 1/4 as big of aperature. I have done about 1 billion photons on my 3 computers, and the new image looks much cleaner. I expcet it will take about a trillion photons to make a realy smooth image.

      --
      Inside every complex program is a simple solution trying to get out.
  15. Trust? by wan-fu · · Score: 4, Insightful

    What's to insure the trust within this project? Call me a cynic, but what's preventing some jerk from swapping some bytes in his set of data before sending it off, thus, rendering your combined result different from what you intended?

    1. Re:Trust? by rkeene517 · · Score: 3, Informative

      I will be combining the result in a graphical tool that lets me look at each submission before it gets summed into the result. This will at least prevent some pr0n picture from getting merged in. Also a few bad submissions or duplicates will not throw off the total results.

      --
      Inside every complex program is a simple solution trying to get out.
  16. Photon Soup: Longer and Uncut by Xenoproctologist · · Score: 5, Informative

    A much larger version of the SIGGRAPH `94 image "Photon Soup", clocking in at 840x560, can be found HERE.

    1. Re:Photon Soup: Longer and Uncut by rkeene517 · · Score: 3, Informative

      That image is a photograph of the slide that was in the SIGGRAPH 95 slide set.

      --
      Inside every complex program is a simple solution trying to get out.
  17. which would you rather run? by theguywhosaid · · Score: 5, Insightful

    wow, its slower than C. i'd rather run a random java app than a random native app because you can easily sandbox it and know its not going to screw your computer. thats one less barrier to people helping the dude out. and theres no recompile for the various linux platforms, win32, solaris, macOS, etc etc. its certainly slower, but more friendly to the community.

  18. Re:Java is a slow cruncher by blinkie · · Score: 3, Insightful

    Erm, that article is more than SIX years old, and one of the guys that wrote it now works for Sun. Apparently FUD is not something Microsoft has monopolized yet..

    --
    to^2
  19. power consumption by lightray · · Score: 4, Insightful

    The fact of the matter is that a machine with 100% CPU utilization uses a lot more electricity than one with low utilization. The extra cycles aren't free.

    I measured this in 1997 on some kind of AMD K6 machine. IIRC, running dnetc doubled the power consumption of the machine.

  20. Enter applet. by Kingpin · · Score: 4, Insightful

    Applets are bad for a LOT of things. But this is one thing they would work really well for. Using an applet:

    1. The client PC runs the program in a sandbox
    2. Most client PC's don't need additional software installed (if written for JDK 1.1)
    3. The user does not need to know how to invoke a Java application
    4. There's no administrative overhead in iniating the application, just go to a URL

    --
    Unable to read configuration file '/bigassraid/htdig//conf/14229.conf'
    Geocrawler error message.
  21. Anonymous grid computing by mec · · Score: 4, Insightful

    First there are resource allocation problems. The OS has to provide a sandbox with strict limits on all resources: memory, filesystem, and networking, as well as CPU time. It's fine with me if the "background compute demon" takes 25% of my processor but I don't want to take more than 10% of my memory.

    Then there's the security issue.

    But I see another problem which is even harder to solve: the tragedy of the commons. Consider a university campus, and suppose that anyone on campus can submit jobs to the Campus Grid. You come in the next morning and see that there are 10000 jobs in your grid queue, and 9800 of them are encoding random people's MP3's.

    The problem is that if you give free resources to a large anonymous community, it takes only a few of those people to suck up all the resources. So you need some way of identifying everyone who submits a job, and some way of charging for the jobs.

  22. Re:Java can be faster then C sometimes by evanbd · · Score: 5, Informative

    Dude, is your C compiler that bad? I like Java a lot, and use it for compute intensive applications, but I think you're either pretty bad witha c compiler or trolling. if you're doing something CPU intensive in C, you need to use gcc -O2 (or -O3, depending), with -march=cputype. This will allow gcc to generate exactly the same code you just described, since it is not limited to 386 instructions. And if you need even more performance, you can just use Intel's C compiler for a lot of things (non-commercial is free as in beer), though it doesn't support some GNU extensions and I think has trouble with some things like the Linux kernel.

  23. Re:Bad link by mirko · · Score: 4, Informative

    I added "www." to the URL, it works.
    Try this...

    --
    Trolling using another account since 2005.
  24. you need to work on your java skills then... by Kunta+Kinte · · Score: 5, Informative

    My experience with numerically-intensive algorithms is that Java is 2-4x slower than C. You can get it within 2x of the speed of C if you ignore object-oriented programming and you're really good at Java optimization, but that's it. And it will run much slower on some architecetures because Java guarantees certain floating-point operation semantics at the expense of speed.

    The speed difference oft cited is about 20% on numerical apps. Check out http://www.idiom.com/~zilla/Computer/javaCbenchmar k.html. He brings up " Benchmarking Java against C and Fortran for Scientific Applications as well.

    You have to remember that Java's speed disadvantage is mainly in the JVM startup and GUI areas. Although a good Java dev team can make Swing fly ( checkout JBuilder for instance ).

    Java being Just-In-Time compiled can even take advantage make runtime optimizations that your C/C++ application may not.

    --
    Based on upvotes, Ageism is the only "-ism" Slashdotters care about and think isn't SJW
  25. Re:Java can be faster then C sometimes by Avakado · · Score: 3, Informative

    Sorry, but the 80386 has 32 bit stack and move operations. Generally, people compile their program for 80386, because almost all optimizations that can be done automatically for Pentium does not harm performance on 80386.

    If your program has a noticeable performance benefit from using SIMD instructions, you can move the relevant functionality into a shared object, and distribute the program with several versions of it, and dlopen() the correct one at runtime. The absence of programs that actually bother doing this, can serve as an indicator as to how big the performance benefit from SIMD optimizations really is.

    Does that explain it better?

    --
    The world will end in 5 minutes. Please log out.
  26. Re:Java? No wonder you need cpu cycles. by darthCodex · · Score: 4, Informative

    Eh... .NET is natively compiled when it's run for the first time. It also optimizes for the platform (even CPU) it runs on.

    --
    Supplies!
  27. There are better ways of doing this by sandwichmaker · · Score: 5, Interesting

    Two words: Photon Mapping
    The simulation you are trying to run does not the kind of compute effort that you are planning on using. I implemented a photon map based renderer for a rendering class last year and it can render a room like the one you showed in a couple of minutes.

    The reference you are looking for is:

    Realistic Image Synthesis using Photon Mapping
    By Henrik Wann Jensen

    He is the guy who got the technical oscar this year for being one of the inventors of a method to render materials which display subsurface scattering, e.g. skin and marble.

    1. Re:There are better ways of doing this by Gromer · · Score: 3, Informative
      The photon map algorithm is great for rendering realistic-looking images, but it is definitely not appropriate for a genuine, hard-core simulation like this guy wants to do. The photon map algorithm is based on physics, certainly, but it makes a lot of simplifications in order to make the rendering efficient. For one, it completely ignores diffraction and interference, treating photons as discrete particles travelling in straight lines. If you really want a physically accurate numerical simulation of the way light behaves in a given physical setting, you need to resort to these much more brute-force techniques.

      By the way, I'm going out on a limb here, but I have a feeling that someone who's been published in SIGGRAPH (THE graphics conference) is aware of the state of rendering algorithms in general, and of the existence of photon mapping in particular. Just a guess.

      --
      "Never let your sense of morals prevent you from doing what is right" -Salvor Hardin
  28. I like the Md5Crk applet model by Gollum · · Score: 4, Interesting

    MD5Crk.com has an applet on their site that does distributed calculations so long as it is visible in the browser (and assuming that you have specifically permitted it to do so). They are trying to find a collision to demonstrate that MD5 is insecure.

    This is great for a simple calculation that returns simple results (e.g.MD5), but probably wouldn't work in a situation where you have to have lots of data to work from. Of course, if you can break it down sufficiently, it might work, and I guess he has already done the work in figuring out how to break it down and recombine the results.

    See MD5Crk for the applet in question.

  29. Java has come a long way since 1998 by Avt232 · · Score: 5, Informative

    As founder of the Distributed Hardware Evolution Project which is written in Java, I'd like to remind you all that the Just-In-Time compiler coupled with the real time profiling and dynamic on-the-fly optimisation that goes on in the Server VM makes the difference between C and Java minimal for code which is in the critical region. This is specially the case for code which is executed over and over again, such as with these distributed processing projects. In fact the guys at Sun are doing such a good job at exploiting the ever more complex characteristics of different processors that Java code is expected to run faster than C in the future. Also, during the weeks that you would spend debugging and porting your C code, your Java code has gone miles ahead doing useful stuff! If you would like to start your own Java distributed processing project, DistrIT might help.

  30. I need cycles, too! for spin glasses... by dummkopf · · Score: 3, Informative

    1 Month on 100 sparcs? Peanuts! In my research simulations usually take (depending on the problem) up to 6 months on an average of 150 workstations (and some runs on large clusters). You wonder what I do? Spin glasses!

    Spin glasses are systems in with the interactions between magnetic moments are in conflict with each other. These competing interactions make these systems extremely hard to simulate at low enough temperatures. If you have a linux box sitting around idle which is fast enough, let me know and I will provide you with some samples to run. Current project: 100 - 300 samples, each takes ~ 10 days on a 2.4 GHz Xeon... For information on how to contact me, go to duamutef.ethz.ch. Of course your name will be mentioned if you compute a considerable number of samples!

  31. Re:Java is a slow cruncher by jabbadabbadoo · · Score: 3, Insightful
    "...things can actually roll on faster than c"

    And pigs _can_ fly.

    Here's the deal: when you perform fp ops in Java, operands go where? The _Java_ stack which actually resides on the heap. In C? Usually registers. The JIT register allocation algorithm cannot possibly optimize like a good C compiler can because of the purely stack-based architecture. What's worse - after each fp op, the CPU must fetch byte codes from the class pool which also resides on the heap. So farewell L1 cache line optimization (and sometimes L2 caching)

    Note that most benchmarks are too limited, the Lx cache line problems appear in non-trivial applications with a bit more more than a loop doing fp addition.

  32. Use real photons by Andy_R · · Score: 5, Funny

    You could cut your rendering time down to about 1/200th sec by employing the following hardware:

    old cookie tin
    2 marbles
    cheap disposable camera and a... ...whatever that blurry thing top right is supposed to be.

    The resultant time saving could be usefully employed learing how the gif file format works.

    --
    A pizza of radius z and thickness a has a volume of pi z z a
  33. Re:Java can be faster then C sometimes by orthogonal · · Score: 4, Insightful

    Either I'm suffering deja vu, or this has been posted nearly verbatim before in a previous discussion of Java vs. C.

    Not only that, Face the Facts (770331)'s last three or four posts are word-for-word copies of other people's posts, copied from anti-slash.org's "database tool".

    Note only that, but anti-slash.org has posted links to his posts, asking their members to mod him up, with the notation "another karma whore account" -- which implies he's karma whoring in order to get mod points in order to troll.

    (Implies but doesn't prove: anti-slash.org at one point asked its members to mod one of my posts up, why I'm not sure.)

    But whatever Face the Facts (770331)'s motivations, his posts are plagiarism and he's a plagiarist, apparently not talented enough to write his own posts.

    Mod him down.

  34. Re:Wireless or not... by orthogonal · · Score: 3, Informative

    The parent post is stolen, word-for-word from this post by SharpFang (651121).

    It was stolen via the anti-slash.org database

    Mod parent down.

  35. Photon Simulation vs Raytracing by PhunkySchtuff · · Score: 3, Insightful

    I've looked on the dude's web page, but there's nothing there that tells us what this is about.
    In what major way is photon simulation different from ray tracing?

    1. Re:Photon Simulation vs Raytracing by Anonymous Coward · · Score: 5, Informative

      Photon Simulation: "forward ray tracing". Emit photons from light sources, have them bounce off scenery, and see where they hit the eye.

      Ray tracing: "reverse ray tracing". Emit "sight rays" from the eye, have them bounce off scenery, and see where they hit light sources.

      That's simplifying, of course.

      Forward ray tracing was here first, but was quickly (all but) abandoned, since it is computationally way more intense (why, 10 years ago, it would have taken 100 Sparc Station 1's an entire month just to calculate one small image!). Imagine simulating a zillion photons just to discover that over 0.99 zillion had failed to reach the eye...

      On the other hand, it is physically more correct, since effects like caustics are very difficult to do right in "reverse" ray tracing.

  36. Re:isn't this duplicate work by elvum · · Score: 3, Informative

    Everyone works on the whole picture at once, but simulates different randomly-emitted photons. All you need is a different random seed for each client, which is trivial to manage.

  37. Re:Povray ? by imroy · · Score: 4, Interesting

    I'm just guessing here, but it sounds like he's doing forward ray-tracing on the whole scene. Conventional ray-tracing traces the light rays backwards, i.e from the camera/eye out into the scene and finally back to the light(s). The only problem is that it doesn't really do caustics or diffuse lighting well. POVray faked caustics in version 3 (IIRC), and Radiance has done excellent diffuse lighting using a monte-carlo simulation for about a decade. In recent years photon maps have also developed. These apply forward ray-tracing to selected areas, usually selected refractive and reflective surfaces. The impact points for the photons are recorded and then used in a regular renderer (either scan-line or ray-tracer) as an additional source of light.

    Again, it sounds like this guy wants to do this to the whole scene, and to a very high degree of precision. I'm not sure why. Any decent ray-tracer would get a 99% solution in a fraction of the time. Hell, in good hands even scan-line renderers can get a 90% solution even quicker, just look at all the motion-picture visual effects (and whole movies) rendered with Pixar PRman. Most effects don't even need a good ray-tracer to look realistic to most people. Unless he's rendering something more interesting than shiny balls and a mirror, or going to do something interesting with the trillions of photons (near-real-time camera-independent renders?), I really don't see the point. It's still kinda interesting though, if only because of the scale of the work. It might lead somewhere, you just never know.

  38. But HotSpot compiles and RECOMPILES on the fly by Z-MaxX · · Score: 5, Informative
    can continuously re-optimize code based on the state of the system at that exact point in time. This is the critical point.

    For instance, let's say you have an interface I, and a class X that implements I. If X is the _only_ implementation of I loaded at the moment, then all calls to methods on I can be direct, non-virtual calls because there's only one choice! In fact, HotSpot will even inline the method calls if it decides it will be beneficial.

    But then a class B is loaded. HotSpot will de-optimize the inlined and direct calls to methods on I.

    There are many more examples, such as loop bounds-checking elimination, and other things HotSpot can do because it sees the state of the running system.

    If you've used a slow Java program, it's no doubt the result of a poor design and coding job by the programmer. "I'll just pick up Java for Dummies in 24 Minutes. Now I'm a 1337 j4v4 h4x0r!!" You may also have been using an old, slow JVM. The performance increases between Java 1.2, 1.3, and 1.4 are truly awesome. Also, Sun's Java 1.5 starts up on my machine in less than half the time that 1.4.2 did, and the graphics as OpenGL accelerated now, ... the list goes on and on. For anyone who had used a Java IDE, especially NetBeans/Forte (which I like, except that it's so freakin' slow I fall asleep between operations), you must try IntelliJ IDEA. It is so responsive and just a joy to use. On the systems I've run it on, it is significantly more responsive than Eclipse.

    --
    Dr Superlove 300ml. I use my powers for awesome
    1. Re:But HotSpot compiles and RECOMPILES on the fly by Brandybuck · · Score: 4, Interesting

      Java has been out for how long now? Nine and a half years. A whole freaking decade! Yet every damn time someone mentions the poor performance of Java, the same standard excuses are trotted out, with an exhortation to use the new and improved Java:

      1) That's because you're using Java 1.x. Use Java 1.y instead, it's got all these new performance features...

      2) That's because it's using the old GUI toolkit. Use the new one instead...

      3) That was with the old JVM. Use the new one...

      4) That was with the old JIT. Use the new one...

      5) That's because you're using a slow XX Hz CPU. Don't be a tight wad and upgrade to a YY Hz CPU intead...

      Why should I believe you this time? You might actually be right, but I really don't care anymore. You had your chances, nine and a half years of them, so I'm not giving you any more.

      --
      Don't blame me, I didn't vote for either of them!
    2. Re:But HotSpot compiles and RECOMPILES on the fly by Fjord · · Score: 3, Interesting

      I've been sayign the same thing since 1996:

      That's because the programmers don't know how to program.

      I was making systems that output efficient usable applets in 96. I've taken serverside systems that could barely handle a single user to handling 1300 simulataneous users. My experience has been very few people know how to code usable Java, and when their Java is unusable, they give up and say "it's because Java is slow." Of course, I never really believed that since I played a Quake map via an applet on a 200MHz Pentium Pro. I figured if whoever did that could get 30fps, I could have my lists drop down in a timely fashion.

      --
      -no broken link
    3. Re:But HotSpot compiles and RECOMPILES on the fly by orasio · · Score: 3, Interesting

      All those are reasonable claims. If you came bitchin about Slackware 3.4 I would tell you to go use Slack 9.1. You can say that all MS software is shit, but you should bitch about XP, not about win95. Same thing happens with Java.

      The biggest problem is that Microsoft shipped a shitty 1.1 java version for many years, thus people who thought they had java, just had a 4 year old VM.

      Java is faster where it matters, debug time!! I as a programmer am very happy not having to deal anymore with alloc's and arrays out of bounds!

      As most of my current work has a web interface, I like java servlets, because it is easy to program complex systems in java, and _for_me_ it's easier to maintain than php. Servlets are real fast.

      Anyway, java graphical interfaces are very slow. But compared to what? Windows, which takes forever to load its graphical interface? or kde, which takes a looong time intializing some DCOP crap when I want to load the only kde application I use? or gnome? well, gnome is not that slow, but it is slow anyway. I think that anyway, on load times, graphical java application are not the slowest, but among the fastest loaders.

      Now it comes to the issue of hardware acceleration. Windows graphical interfaces are fast because they use some acceleration that slow graphics cards (SIS, anyone?) provide, so windows interfaces are not thaaat slow. When you have a decent graphic card (not a gforcefx5950, just a matrox g100 or a savage4, or a TNT) you start to see that maybe it was not that slow. When you get a faster card, you start to understand that mabe java is just as fast in the desktop as it is in the server, it just was slow in its old version , with old video cards, and in windows, compared to others that were optimized for that situation.

      -- End of rant. --
      Java was always fast, on the server.
      Java was slow, on the GUI, in windows, with old video cards.
      Java is fast, on the GUI too, in any platform, with "new" video cards.

      And, if you don't want to try it, well, I think it's your loss, meanwhile I am going to finish my own photon mapping renderer for java, so I can match up my times with this guy's.

  39. Sick of the clueless blasting Java performance... by Jerk+City+Troll · · Score: 3, Informative

    This thread is already full of very knowledgable people expoudning at great length as to why Java is not slower (and infact, is often faster than "native code"). Therefore, I will not waste my time writing an indepth response to those who would argue that 1 + 1 in Java is somehow slower than 1 + 1 in C/C++. This post does that quite well. What that comment does not do, however, is explain why some Java programs do, in fact, feel slower than native programs.

    I'll simplify this as much as I can without diverging from the technical truth too much. Most complaints that Java is slow come from two sources. First, you must wait for the virtual machine to load, and depending on the libraries used by the program, that can be costly in terms of IO, which is always very slow. Second, Java's GUI toolkits are fairly heavy weight--they do a lot and many programs take advantage of much of the functionality they provide. I won't embark into the details, but to those inclined to find out why should read more about Swing and what Java2D libraries offer. Because of all they do, many Java programs with GUIs feel a little sluggish. Of course, keep in mind that most software sits idle 99% of the time while the user decides what to do. So otherwise, Java code that is not bound by user response time is very fast.

    One quick post script: because the Java language is object oriented, complex software will do a great deal of memory allocation and garbage collection as objects come in and out of use. That too, is very expensive. However, there is no reason that you have to use the Java programming language to code for the virtual machine. Case in point: Jasmin. In theory, you could write compilers that generate JVM bytecode from any language (and a former professor of mine is currently in the proceess of writing a book that explains precisely how to do that).

  40. Re:Sick of the clueless blasting Java performance. by jafuser · · Score: 3, Informative

    Second, Java's GUI toolkits are fairly heavy weight

    This is probably why SWT came about (in part thanks to IBM).

    The first application to use SWT, Eclipse, doesn't feel like a java application because it's using native widgets, which gives the GUI a very snappy response.

    If the only strong reason you have avoided programming applications in Java is because of their slow GUI response, I suggest looking into SWT. =)

    --
    Please consider making an automatic monthly recurring donation to the EFF