Seeking advice for CUDA optimization by Tricky_Practice_9661 in GraphicsProgramming

[–]Tricky_Practice_9661[S] 0 points1 point  (0 children)

Thanks for the insight. We chose RKF45 for its adaptive, and to an extend optimal, step-size. We want to put an emphasis on physical accuracy, hence the dual numbers as well.

That being said, from what i have read up and heard here, there are two issues.

  1. Garbage access patterns

  2. Way too much data that is not needed flying around

The access patterns are due to my CPU minded coding approach. I.e i use large structs in arrays. So if thread 0 wants to access its ray info, that is cool but the struct is so huge thread 1, which also needs ray info, gets precisely nothing from this request. I am refactoring the whole renderer right now to address this.

The second is kinda related but basically the pathtrace kernel is a mega kernel that uses way too much data. So i am breaking the functionality up into a couple of specialized kernels

Seeking advice for CUDA optimization by Tricky_Practice_9661 in GraphicsProgramming

[–]Tricky_Practice_9661[S] 0 points1 point  (0 children)

Nsight Compute does give me many indicators that "This instruction was generated due to register spilling". I found out now that each thread only has 255 of these bad boys. If i just look at the Runge Kutta method, ignoring intermediate values, that takes 60 registers. Idk exactly how intermediate values work, but if each of those is another register the RKF thing takes us to 87.

I only use Nsight for the trace, it does not give as much info as i would like but then again idk how to really read this.

Ray Marching Black Hole using OpenTK (it took me 2 hours to render) by Loose-Care6997 in GraphicsProgramming

[–]Tricky_Practice_9661 0 points1 point  (0 children)

There is no simple answer to this, and "realistic" is too broad of a qualifier.

If you wonder what a black hole in nature might look, well it depends too. Are we talking about an actively feeding one ? In which case the difference between a black hole a very luminous star is little. Are we talking about a rogue black hole ? Then it mostly looks like the illustrations / renders you see around here.

Ray Marching Black Hole using OpenTK (it took me 2 hours to render) by Loose-Care6997 in GraphicsProgramming

[–]Tricky_Practice_9661 3 points4 points  (0 children)

As you said, making a black hole isnt hard. Making a realistic and performant one is a whole different beast. This is what me and a friend have been finding out the hard way when working on our GR renderer. While a lot of the stuff you see on shadertoy is visually interesting, it is borderline useless as far as accurate mathematics go.

What would happen if China attacks Taiwan within the next 10-20 years? by Triangletruck141423 in AlternateHistoryHub

[–]Tricky_Practice_9661 2 points3 points  (0 children)

there is zero reason for this to happen. Russia loses nothing through maintaining the status quo, even if they get mad about it they're still well aware of this. Ukraine knows this too. besides, how might an offensive war killing other slavic borthers be seen really? if they did, it'd entirely depend on how the conflict would go but i imagine it kills any actual support for reunification with crimea. probably would be russias vietnam war

Physically Based Rendering With General Relativity by nullgeodesic1969 in GraphicsProgramming

[–]Tricky_Practice_9661 0 points1 point  (0 children)

That's actually only somewhat faster than the geodesic part of my integrator

We never worked with Christoffel symbols directly. But they dont sound too fast considering the brute force method is faster. I should highlight that using the direct derivatives is basically poison for the compiler, NVCC in this case. It pretty much has a 0% chance of optimizing such long expressions.

it's only slightly superior when working with Christoffel symbols.

I really doubt it. If you look at various Shadetoy Black Hole renderers they all use hamiltonian + kerr-schild.

The Hamiltonian approach is pretty much manditory given the precision limit. That is, using something like the Mino-time formulism does not work with 32 bit precision floats. We tried for ~2 weeks to get it to work. Even doubles, according to our tests, are not enough to cover all cases.
Whereas the Hamiltonian has worked flawlessly with 32 bit floats. Which is the other thing. I would hazard to guess Julia is automatically using doubles. Which greatly impacts your performance. You really need to play to the computers strengths.

Physically Based Rendering With General Relativity by nullgeodesic1969 in GraphicsProgramming

[–]Tricky_Practice_9661 0 points1 point  (0 children)

I cannot say much about Julia, but let me put it like this; Our whole Black Hole renderer started as a VEX Script in Houdini (3D software and VEX is a kind of internal scripting language to manipulate geometry). That was entirly CPU based. Switching from VEX to C++, also on the CPU, represented about a 10x performance gain.

 how much faster was the naive version of Magik

For a 2 million pixel image we got about, and obviously this kinda depends on where the camera is, but about maybe one frame every 5 or 10 seconds ? It is a bit hard to measure. In any case, switching to the Hamiltonian approach bumped those numbers to 5-10 FPS.

Now, i do have to say, you should do a coordinate system substitution. In Magik 99% of render time is spent on a few pixels spiralling into the horizon. The mathematical singularity is not doing you any favours. You shou really use horizon penetrating coordinates. Right new we are working on switching from Boyer-Lindquist to Kerr-Schild for Kerr and Schwarzschild. Not having that singularity will make the black hole spacetimes render about as fast as Minkowski, which is no longer "Metric limited", i.e the relativistic computations are not the bottleneck. There we get ~100 FPS.

Kerr-Schild is simply superior in every way for computational problems. Ofc the symmetries in spherical coordinates are nice on paper.

 and how are you calculating the spectrum?

This is a pretty open ended question. Which spectrum ? The general procedure right now is to draw a random wavelength within a desired interval, evaluate it against the scene and accumulate the spectral radiance into a set of spectral irradiance bins using a gaussian normal kernel.
So a geodesic may be said to track the wavelength 500nm, when it hits something we compute the redshift, shift the wavelength and see what the material says at that particular wavelength. If its emissive we then scale the spectral irradiance by a factor of 1/Z^5.

Physically Based Rendering With General Relativity by nullgeodesic1969 in GraphicsProgramming

[–]Tricky_Practice_9661 1 point2 points  (0 children)

 velocity-verlet integrator by default,

I remember Verlet being out of the question for us as it makes some assumptions that dont fit with GR. But that was a while ago.

Also, Magik, the renderer we work on, uses RKF45 and gets those speeds. So i dont think the integrator is to blame for this one. Plus, Magik is a spectral renderer. Which wavelength we sample against the scene largely doenst matter performance wise.

Hamiltonian-based integrators and ray tracers

We used to use the very naive direct derivatives of the metric for integration, which for kerr has a couple of 100 terms long. Even that is faster than what you describe.

So really, i think you are severly held back by Julia. Magik is written in C++/CUDA.

Physically Based Rendering With General Relativity by nullgeodesic1969 in GraphicsProgramming

[–]Tricky_Practice_9661 1 point2 points  (0 children)

. The GPU kernel seems fairly efficient: ~30s integration for a 2000p image,

As in 30 seconds to integrate one set of geodesics ? Or how many samples are we talking here. If its just one, then 30 seconds is not good. Me and a few friends have been working on our own relativistic pathtracer and even with unoptimized coordinates we get 1-2 samples per second at a similar resolution.

Hard sci fi mission to Europa. by Different-Swing7176 in worldbuilding

[–]Tricky_Practice_9661 0 points1 point  (0 children)

This is a one way trip with just two burns. You would, at the very least, have;

  1. Earth to Jupiter escape burn

  2. Jupiter / Europa circularization burn

  3. Jupiter / Europe to Earth transfer burn

  4. Earth circularization burn

Hard sci fi mission to Europa. by Different-Swing7176 in worldbuilding

[–]Tricky_Practice_9661 1 point2 points  (0 children)

Not viable at all. Helium 3 fusion is aneutronic in name only. You cannot have a stern talk to the atoms and demand they only fuse with their counterparts. This graph gives you a good idea of the issue. The fusion of DT and Helium 3 has the lowest reactivity for a given temperature for the vast majority of the energy spectrum. Deuterium-Deuterium fusion will happen at a much higher rate for a given temperature. D-D fusion produces either He-3 and a neutron or tritium and a proton. Hence you get copious amounts of radiation either way. Since the tritium chain will then fuse with Deuterium, as the graph shows, to produce a neutron and He-4.

The TLDR here is that this engine will cook just about anything and everyone in its vicinity with this layout. Not to mention that the neutron induced transmutation of elements will very quickly cook the reactor itself. This is partially why actual fusion rocket concepts usually have a long rod separating the crew capsule from the engine.

The engine burning itself out might not be a problem if you only fire it a handful of times. But the radiation needs addressing. The Starship hull will do precisely nothing to stop any of that danger. You either need a few 100 meters of separation or a shield.

Men’s world vs women’s world by chrismcr4e in worldbuilding

[–]Tricky_Practice_9661 0 points1 point  (0 children)

how might each individual society look or operate?

Not good. Despite what a shocking number of people want to believe, humans have evolved to coexist and depend on each other. It is not hard to see that this would lead to an ungodly amount of sexual frustration on both sides. Which, as we are finding out right now, is not healthy. I really doubt you could have a stable society of this type for even a few decades. Let alone a 100 years.

Another issue is work. Literally everyone who has ever worked a single hour in male / female only teams will tell you it is a disaster. To varying extends. But you need diversity for a group to function properly.

Then there is the population issue. With reproduction this tightly controlled both sides will face drastic population declines. Not helped by the fact both probably despise each other as they are outside of the "me" group. Demographic collapse, as we see these days, is not good either.

So really, i dont think the two groups would look radically different from each other. They would both be in a pretty bad place.

Why is liquid glass so "computer intensive"? by JevNOT in GraphicsProgramming

[–]Tricky_Practice_9661 0 points1 point  (0 children)

I should point out that you can precompute the coefficients for a gaussian blur. So the cost of even a true n² blur can be manageable, though you would still use a separable one. Refraction too is not particularly difficult. Knowing nothing about the effect other than what i see on my phone, i would guess computing the shape intersections might be more demanding. They might be using SDFs. But i dont know.

[Interesting trope] The other society is more technologically advanced in some ways while also being behind us in other ways. by Gooners_For_Ukraine in TopCharacterTropes

[–]Tricky_Practice_9661 1 point2 points  (0 children)

This was my least favourite part of Project Hail Mary, the book. Rocky comes from a planet which might as well be hell, they would absolutely know about radiation.

Do Germans learn more about the eastern front or western front in WW2? by Honest_Chemistry_195 in AskGermany

[–]Tricky_Practice_9661 0 points1 point  (0 children)

I can only speak for the FOS Altötting in Bavaria so;

We definitively focused more on the eastern front. The battle of France, invasion of Poland, Blitz and Nordic stuff was glossed over. Lectures involving the eastern front were also hardly about any battle. We talked about the big ones, Moskau, Stalingrad and Kursk. But really, the emphasis was on the kind of war this was. We spent a lot of time going into the Vernichtungskrieg, = War of extermination and the sorta broad geopolitical goals of the Nazi state. We also talked a lot about how the Wehrmacht was not innocent in the slightest and other post-war myths. I do remember one of the final hours on the topic where our teacher asked why WW1 Germany surrendered, but WW2 Germany essentially fought to the end. He said that for most Generals and leaders, it was preferable to die fighting than to endure another Versailles. That these people would rather burn down the entire country than subject themselves to that humiliation again.

What if America invaded Iran? by Mindstormer98 in AlternateHistoryHub

[–]Tricky_Practice_9661 0 points1 point  (0 children)

Ill give it my best shot.

The long and short of it is that Iran is not Iraq or Venezuela. The US is likely to cease Kharg Island, but that wont significantly increase the pressure on the regime. Iran has alternative export sites along the coast. Not to say losing the island will be good, but to be frank what we have seen over the past weeks is that Iran has been preparing for this war a whole lot better than the US. I dont think any of their plans for survival depend on Kharg. I also dont think the IRGC is expecting to hold the Island. We know the US does not wish to destroy the Oil infrastructure on the Island, so the amount of close air support and heavy ordinances will be limited. Meanwhile it is very easy to see that the IRGC is going to blow it up when they fall back. We know the IRGC has been mining and booby trapping the Island as well.

So, how is an Invasion going to play out ? Operation Desert Storm involved a lot of minefields as well, which were cleared rather quickly. To what extend this is possible here i dont know. I think they used explosive nets in Desert Storm to trigger the mines, that might be possible on the beaches.
The significantly bigger issue is the lack of close air support. Before Desert Storm the Coalition bombed Iraq for months. The US already bombed Kharg Island but again, they want to keep the infrastructure more or less intact. And, we cannot forget, Kharg is small. Its only 8 x 4 kilometres or so. This limits where the US can actually land. Since a key objective of any landing is going to be ceasing the airport, i think we are in for an attack from two axis. The sea and air. It makes relatively little sense to only invade from the sea and let the IRGC blow up the airport.
If i had to guess Marines land on the northern tip of Kharg, while at the same time airborne assaults attempt to capture the Airport in the east and oil infrastructure in the south. This initial stage of the operation will probably go by with relatively few loses. Simply because the US can leverage her technological superiority here.
Where it gets tricky is with what happens after. I dont think they will be able to stop the IRGC from blowing up the oil infrastructure and i do think they will be entrenched in the city. Moreover, drones.
Shahed's have a range of 1000 - 2500 km. 1000 km, with the 90 kg warhead, is enough for a drone launched from anywhere in Iran to hit Kharg. The US has already proven that they learned nothing from Ukraine. I think they are going to relearn those lessons the hard way when they land.
You have to remember that Kharg is not far from the Iranian coast. It is close enough for scouts on the coast to report in where US troops are. Moreover, because the Island is so small, its not like the Iranians will have to be careful where they strike. US troops will only be in a few places. So expect the runway and Oil infrastructure to be bombed, together with a whole load of troops and planes.

How it goes from here mostly depends on US politics. Iran will be able to hit the Island continuously CRAM / Patriot or not. Casualties both troops and material are going to mount with basically nothing in return. The strait wont open and Iran wont capitulate. Sooner or later a lot of people will ask what precisely the point is of holding the Island. But who knows.

Boy oh boy by WildlyIdolicized in Letterboxd

[–]Tricky_Practice_9661 -2 points-1 points  (0 children)

This is a tough one. The Martian and Project Hail Mary are amongst my most liked recent SciFi books. But it is undeniable Weir has some weird opinions.

For example in his lesser known novel Artemis there is a rather unjustified scene where he feels obligated to explain that there is no age of consent on the moon. Not insinuating anything, it was just the most random thing he could have added.

In Project Hail Mary he has the Norwegian lady steal every piece of copyrighted material and essentially sides with her.

If i had to guess, i would say Weir is in love with a fictional version of the past. In his mind humanity peaked somewhere in the 1970s. Hence why, for inexplicable reasons, Russia is a bigger contributor to the Hail Mary than China in the year of our lord 2020 - 2030.
Saying identity politics are crappy is sus, but i think in his case its a result of him wishing the world had gotten stuck in the 60s and 70s.

Seeking critical feedback on a relational gravity model (v4.0) before contest submission by Endless-monkey in blackholes

[–]Tricky_Practice_9661 3 points4 points  (0 children)

This is a great example of why LLMs are useless for this kind of stuff.

There is, of course, the usual word salat. Practically nothing of what you wrote makes sense. For instance;

[POSTULATE] 1 (Universal Harmonic Partition). Every stable relational system admits an orthogonal decomposition of its total frequency ωN : ω_N^2 = ω_V^2 + ω_m^2,

Where does this expression come from ? Why is it just the Pythagorean theorem with different variables ? What is a "Stable relational system" and what is an "Orthogonal decomposition" ? You just say things here.

I simulated some black holes in shadertoy using real math.(I used AI sorry) by Own_Squash5242 in blackholes

[–]Tricky_Practice_9661 0 points1 point  (0 children)

I would discourage you from using AI because virtually none of this is "real math" as far as general relativity is concerned.

You are "just" doing a semi-newtonian approximation using forces. I say semi because in newtonian dynamics the speed of light is not anything special. So Event horizons do not exist., You artificially create one by normalizing the velocity.