HN user

Tunabrain

243 karma
Posts7
Comments25
View on HN

GPUs are deterministic machines, even for floating point.

The behavior in the linked article has to do with the use of atomic adds to reduce sums in parallel. Floating point addition is not associative, so the order in which addition occurs matters. When using atomic adds this way, you get slightly different results depending on the order in which threads arrive at the atomic add call. It's a simple race condition, although one which is usually deemed acceptable.

I think there may be a misunderstanding here regarding the use case. If the vectors are large and allocated on the heap/on an accelerator, then yes, writing out explicit temporaries may be faster. Of course, this does not preclude operator overloading at all: You could write the same code as auto t = vec1 - vec2; t *= 0.5/0.3; t += vec3; t *= 0.3;

However, if the operands are small (e.g. 2/3/4 element vectors are very common), then "unnecessary copies" or move semantics don't come into play at all. These are value types and the compiler would boil them down to the same assembly as the code you post above. Many modern C++ codebases in scientific computing, rendering, or the game industry make use of vector classes with operator overloading, with no performance drawbacks whatsoever; however, code is much more readable, as it matches actual mathematical notation.

Any entry level optimization course will make you implement something like that; do a matrix+matrix addition, but traverse it in row-major order in one program, and column-major in the other. If the matrix is big enough, you will easily get a 10x difference. For even larger sizes (once you thrash the TLB), you will get an additional factor.

You might not get up to 60, but this is just a simple matrix addition. Even just matrix multiplication might be enough to get a 60x difference just with optimizing for memory hierarchy. I expect that high-performance memory bound programs are more complex than matrix multiplication, so the parent comment's claim doesn't seem too unlikely to me.

[dead] 10 years ago

I like the idea! But is there a reason why it's only available in app form? I was going to try it and see what gifts were available/how much they cost, but I can't do that from the website. I'm not going to install an app on my phone just to see whether it's affordable (and so I'm unlikely to try it at all).

I don't see why this couldn't be done in a Desktop browser (just enter a phone number/email address instead of selecting a contact).

Big Hex Machine 10 years ago

Are all of those ethernet cables? I can't say I know much about wiring, but that seems like a bit overkill.

But this does use solar panels.

The device uses solar electricity from a photovoltaic panel to power the chemistry that splits water into oxygen and hydrogen. Microbes within the system then feed on the hydrogen and convert carbon dioxide in the air into alcohol that can be burned as fuel

Only the hydrogen + co2 -> alcohol part uses biological components.

I absolutely agree, though I always feel like culture and nationality are very underplayed in this discussion - I believe an American, an Eastern European and a Chinese national would bring a lot more diverse world views to the table than a female and a male American (or black and white).

In my country, there are a couple of newspapers distributed for free in train stations. These newspapers are purely financed with ads. Is it my moral obligation to read every ad in the newspaper to make sure they stay profitable?

I used to watch satellite TV when I was a kid. Most channels I watched were privately owned and purely financed with their (extremely long) ad breaks. Is it my moral obligation to sit through every single ad break?

My answer is no, that's ridiculous. If a company decides to offer content for free, it is not my obligation to make sure their business model stays lucrative. It shouldn't be anyone's obligation to consume every last bit of content someone offers only because it's given away for free.

Doesn't Turing completeness require the ability to modify an arbitrary amount of memory? (because the length of the tape on a Turing machine is unbounded).

However, if I understood correctly, the size of the Game of Life grid is fixed in the Makefile and cannot be extended arbitrarily at runtime, making it not Turing complete (cool nonetheless!).

Although, maybe a Makefile that generates a Makefile with an arbitrary number of cells...?

    (on Windows use MinGW/MSYS or Cygwin make and make sure you have rustc in PATH)
This made me chuckle - if you have MSYS installed, which already comes with a windows port of coreutils, why would you want to use it to build a windows port of coreutils?

As brain-dead as I was after eight hours at my project, [..]

Is giving out an 8+ hour programming project as part of the application process really considered good hiring practice? If you apply to five jobs, you're expected to spend an entire unpaid work week writing code that doesn't benefit anyone? If a company receives 20 applicants, their ideal candidate selection wastes a collective work month?

I don't really understand this ideal. What's the point of maintaining an online portfolio and a github profile full of code if companies prefer to waste your time writing a pointless uploader?

Ah, you're most likely talking about Wenzel Jakob's wonderful 2D tool for demonstrating Manifold Walks.

Wenzel was actually one of my thesis advisors, and his tool was the inspiration behind this project. :) I was writing an implementation of Manifold Walks out of personal interest and reproduced his 2D tool for debugging purposes. Eventually I realized that caustics in 2D actually look kinda neat, so I spent some time doing research and then fleshed it out into this article + demo.

Jensen's Photon Mapping was also my very first exposure to light transport theory - I was in high school too and got the book as a Christmas gift. The math was way beyond me at the time, but it was the first time I realized computer graphics actually had some substance and wasn't just about making triangles fly around funny. Definitely a very influential book for me :)

Unfortunately, that's not possible in the current version - originally I had a demo with larger scope in mind, but WebGL turned out to be a lot more limited than I expected.

I wasn't able to implement an acceleration structure in WebGL, so the amount of primitives it can trace in real-time are quite limited, and all scenes had to be hardcoded in GLSL. This makes modifying scenes a real pain, since adding a new primitive amounts to generating and compiling new shader code.

The original C++ version just constructs the scene from very small (~1px long) line segments and then builds a BVH acceleration structure over them, so you have practically unlimited freedom in the type and number of primitives. Unfortunately traversing a BVH inside a shader in WebGL is almost not doable, so I had to improvise.

Yep! Wenzel was even one of the judges at the rendering competition.

Mitsuba was and continues to be an important inspiration.

I think that an implementation targeting real-time would need an entirely different design than an offline implementation, especially if it had to run on the GPU.

The main challenge is probably achieving full utilization of SIMD units (CPU) or streaming multiprocessors (GPU), which would require tracing and shading multiple rays within one unit. There's lots of papers on how to do this for geometry intersection (i.e. packet tracing), and I think there's a few slides from nvidia that give hints on how to do it for shading (avoid megakernels, sort all shading points by material id).

Brigade is a path tracer that is close to the real-time ideal (for outdoor scenes and using high-end GPUs), so looking into their code would certainly be interesting.

By default it will use one thread less than the amount of cores available, so that the rest of the system is still usable while a render is running.

It's not currently user configurable, but I'll add it to the Todo list. Thanks!

You're absolutely right. Getting the hair data right (groom, strand color, little fiber variations) is just as difficult as implementing the right shading model.

My renders are currently a bit lacking in that regard - I'm not an artist, but I'll try to look out for that in the future. Adding some subtle random variation between fibers is definitely doable.

As far as the hair color goes, I was following measured absorption coefficients of real human hair. Eugene d'Eon's paper "An Energy-Conserving Hair Reflectance Model" contains measured absorption coefficients for the pigments Eumelanin and Pheomelanin, which are responsible for human hair color. By mixing their concentrations, you can reproduce any hair color found in real life. It's difficult to find the mixtures that are just right though, and it's likely that I was a bit off for the blonde hair render :) I'll tweak it some more in the future.

Thanks!

The final render took about 30 hours at >5k samples per pixel. While prototyping I typically used a resolution of 1000x563 (low-res 16:9) and used the incremental renderer in the editor, meaning that the first images would come back after a few seconds. This was usually enough to figure out whether a composition would work or not.

To setup and tweak the lighting, I needed more converged renders, and that could take anywhere from 15 minutes to several hours. Most of the museum converged pretty quickly, making it easier to set up the sun and these sorts of things, but the planet would stay noisy for a very long time. Multiple scattering in the atmosphere has enormous variance and tends to just spray bright blue dots throughout the scene. Any change to the parameters of the planet, atmosphere or clouds would require a few hours of rendering before I was able to check whether the change was for the better or worse.

Not the most efficient feedback loop, but I had other final projects to work on while renders were running, so it wasn't too bad.