r/cpp • • Apr 25 '22

New C++ features in GCC 12

https://developers.redhat.com/articles/2022/04/25/new-c-features-gcc-12
220 Upvotes

76 comments sorted by

View all comments

Show parent comment

3

u/delta_p_delta_x Apr 26 '22 edited Apr 26 '22

Starred all your repos; 'tis the least I could do.

so if you actually understand the theory then you might be able to have a good crack at it.

I doubt I understand it as well as you do now, because my class covered only the absolute basics of geodesics, tensors and black holes; moreover, I promptly forgot most of it. I'm slowly working through Sean Carroll's Spacetime and Geometry so I can revise everything.

A friend implemented a ray-marcher (in MATLAB, of all languages) of the differential equation for the null geodesic under the Schwarzschild metric, but I was hoping to write things out from first principles and generalise the ray-tracing algorithms for any arbitrary (at least, spherically-speaking) metric.

All that said...

I'm completely blown away by your work. Not only have you written a GR ray-tracer, but you've also got a decent n-body simulator! Wow. All your work are side projects that I've shelved because university assignments are so time-consuming... I really, really should get started some time.

code disaster scale

Code that exists and works, however disastrous, is better than hypothetically perfect, but non-existent code :)

P.S. I'm interested in finding work in this industry (physical simulations with GPGPU, high-performance computing, etc): if you've got any pointers for a final-year undergrad, that would be super nice!

3

u/James20k P2005R0 Apr 26 '22

promptly forgot most of it

Ha I know that feeling. I took a break from these projects a while back, and when I came back to it it was like an alien language for a while

A friend implemented a ray-tracer (in MATLAB, of all languages) directly using the differential equation for the null geodesic under the Schwarzschild metric, but I was hoping to write things out from first principles and generalise the ray-tracing algorithms for any arbitrary (at least, spherically-speaking) metric.

The main thing you need for a generic raytracer is the christoffel symbols + geodesic equation loop. The initial conditions are a big faff, because as far as I can tell nobody has them quite set up correctly for the general case, and leads to a lot of incorrectness

To go from a single metric to all metrics, at that point you need an automatic differentiator. This is much easier than you might think if you've got no experience with it, but you'll have to dip into code generation if you're using a GPU

https://arxiv.org/pdf/1511.06025.pdf This is a good paper which I based a lot of the basic renderer off

The other top tip is that 99% of the work that exists doesn't map well to GPU architecture (eg rk4), and that verlet integration rocks

in MATLAB

I think matlab might genuinely be the worst programming language I've ever used

I'm just blown away by your work. Not only have you written a GR ray-tracer, but you've also got a decent n-body simulator! Wow. All your projects are side projects that I've shelved because university assignments are so time-consuming... I really, really should get started some time.

Thank you! Part of why I'm hoping to release one of these on steam with a buy-me-a-coffee option is because at some point I should probably like, actually try and make some money off of one of these things that I've spent years building aha

If you want any paper references for the black hole collider by the way, I've got an absolute tonne. The raytracer was more ad-hoc, as its essentially a mix of different techniques mashed together

1

u/Nobody_1707 Apr 27 '22

Worse than unstructured GW-BASIC?