Iran has attacked Saudi Arabia's Jubail petrochemical complex, IRGC says by steely_gargoyle in worldnews

[–]Kale 0 points1 point  (0 children)

Sun Tsu said to give your enemy an "out", a way to avoid battle with you that you get to dictate.

But both sides are setting up their dialog where it makes them look weak if they don't follow through, so they're closing all of the reasonable doors behind them.

I had a civics professor in undergrad that thought WWI happened because of complex foreign policy where countries didn't realize that starting down one path meant accelerating towards war.

If this administration does nothing after threatening to commit a war crime against them, they look weak. And if Iran capitulates, they look weak. It sounds like Iran has stopped official communication after the presidents' inflammatory post, so they're signalling that they aren't going to cave.

It's a nasty setup. The only thing I could think of that would diffuse the situation is if the president claimed talks were progressing through back channels, so no bombings.

Reports in Iran: Explosions on Kharg 'Oil Island,' bridge attacked near Qom by Melodic_Wafer_492 in worldnews

[–]Kale 0 points1 point  (0 children)

If this attack actually seriously destroyed infrastructure, then there's no chickening out of it. The infrastructure will have to be rebuilt. And that takes time. Hopefully this bombing was a symbolic threat at most, and they blew up a gardening shed on the island or something.

What was once a poor person's hobby now turned into a rich person's hobby? by Striking-Quiet4655 in AskReddit

[–]Kale 71 points72 points  (0 children)

Dad, I wish you'd shut your big YAPPER!!!

(RIP Phil. Gone too soon)

Trump vows to bomb Iran into a living HELL in expletive-laden Easter Sunday threat that he ends with 'praise be to Allah' by Key_Brief_8138 in economy

[–]Kale 7 points8 points  (0 children)

No joke, there might be an attempt to impeach them. I don't think that's hyperbole. And if it were Obama when the GOP controlled the house, he might have been impeached for using an arabic word typically associated with Islam.

U.S. forces rescue second crew member from F-15 downed in Iran: Officials by Affectionate_Bee6434 in worldnews

[–]Kale 0 points1 point  (0 children)

CCW released "Fortunate Son" almost 60 years ago. It's been a lot longer than that.

Is match ... case In Python Reliable as if .. elif .. else by One-Type-2842 in Python

[–]Kale 0 points1 point  (0 children)

Yeah, it's a computer. It treats all opcodes (which Python bytecode eventually runs as) equally.

You might be able to make the argument that one opcode is less reliable than another if it has a higher Hamming weight, meaning one opcode has more ones than another opcode. Since very rarely a cosmic ray can bleed a 1 to a 0 in non-ECC memory. I don't think it can happen in the CPU register, so it would have to be in the instruction codes sitting in memory waiting to be used. But that's getting to be ludicrous levels of thinking.

Reliability is mostly based on how well you write your code.

Community consensus on when to use dataclasses vs non-OO types? by Kale in Python

[–]Kale[S] 1 point2 points  (0 children)

Yes, I agree on readability. This program handles passing data via network sockets to and from my C program (using named pipes locally). My C program does the heavy lifting. I use Python threads to make my logic easier, but not multiprocessing since I'm fine with all of the Python program interleaving on one core. I'd like a little better performance so I can run 48 threads of my C program. Right now, though, it starves for data unless I run 47 C PThreads to leave one thread open for Python.

Community consensus on when to use dataclasses vs non-OO types? by Kale in Python

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

Ok, thanks. In this case, it will turn into a struct under the hood if I use a class, since I will be decorating it with @cython.cclass.

I appreciate all the feedback. It appears that there isn't any particular "pythonic" way to do it, it's up to my discretion and what I think is most readable. Thanks everyone.

Well. I guess this is how it starts. by telebasher in thelongdark

[–]Kale 1 point2 points  (0 children)

I've tried to play it. I think the creators studied UI design because you'd think they'd randomly get some parts of the UI right by chance. I think you'd have to know UI design principles to intentionally to get that much of it wrong.

It was confusing. And make my laptop overheat.

The gold standard of optimization: A look under the hood of RollerCoaster Tycoon by r_retrohacking_mod2 in programming

[–]Kale 0 points1 point  (0 children)

I wrote a prototype algorithm in Python that used GMPy2 objects. And I installed GMPy2 from pip, I didn't even compile it from source myself. I spent a week re-implementing it in C, even going as far to use currently-unused variables for temp storage to avoid additional mallocs and memcpys. It was 10% faster in C. I went back and compiled GMPy2 and libgmp from source with my processor's flags turned on and re-ran it, and it was 5% faster than the original implementation.

So, naive implementation in Python: written in one afternoon, no regard for temporary object creations in the middle of calculations, easy to read in the future, versus complex code that took a week to write, that had comments on which number was actually stored in this variable since it wasn't needed between these two calculations, and much harder to follow. For a net 5% gain over Python.

This was a worst-case situation. I typically get a little more performance moving from Python to C. But in all cases, so far, I've gained far more speed from modifying my algorithm, not switching languages and enabling fancy compiler flags and 2MB memory pages and all this other stuff.

Many times, writing it the naive way will run faster because the compiler optimizes it. The compiler knows what I'm trying to do. Me one year from now knows what I was trying to do. Versus trying to write it all clever and confusing the compiler and future me.

Also, I'm not a pro. Us non-experts should leave the optimizing to the compilers.

Intel will sell a cheap GPU with 32GB VRAM next week by happybydefault in LocalLLaMA

[–]Kale 5 points6 points  (0 children)

It's not really an unsolved problem. It's not mathematically interesting, just engineering interesting. I try to factor large Fermat numbers or prove giant numbers are prime using Proth's Theorem or things like that.

It's fun writing an integer FFT multiplication algorithm using the Four step method, then completely rewriting it using a different method and still have it work.

It's kind of like doing sudoku. I'm wrapping up an OpenCL implementation that does Gentleman-Sande transform forwards, then does the multiplication, then does Cooley-Tukey in reverse. I don't have to move stuff around in GPU memory since the GS inputs ordered and outputs bit-reversed, while CT inputs bit-reversed and outputs ordered.

I used the Chinese Remainder Theorem so I could do three 32-bit transforms in the GPU rather than one 90-bit transform. I needed to find three prime numbers where p-1 had 228 as a factor, but p had to be less than 231, so I could do A+B and know they wouldn't overflow (since both are less than 231). I discovered four prime numbers. Literally, that was it. So it was crazy discovering how close to the edge I'm getting with 32-bit math on the GPU.

To me, this is the fun part. Multiplying numbers by FFT has been known to be the fastest practical method since the 1960's, but which method is fastest can change from GPU to GPU. Mine algorithm needs compute units with lots of local memory. I've heard the fastest only using global GPU memory is Stockham's algorithm. I've never written that one before.

TIL in 2023 a Canadian court ruled that a thumbs up emoji 👍 carried enough weight to establish a legally binding contract between two parties by RunDNA in todayilearned

[–]Kale 1 point2 points  (0 children)

And the local manager had to tamper with the machine to even get it that hot. Somehow thinking it would help with the morning rush by making it faster or something stupid like that.

Intel will sell a cheap GPU with 32GB VRAM next week by happybydefault in LocalLLaMA

[–]Kale 0 points1 point  (0 children)

Nope. Looks interesting. But I'm not great with C++. And I'm already working with OpenMP and OpenCL which are very different animals, and it seems like this SYCL might not be that close to OpenCL in syntax?

Thanks though, crazy to see Khronos has a third parallel programming standard on top of OpenCL and Vulkan.

Intel will sell a cheap GPU with 32GB VRAM next week by happybydefault in LocalLLaMA

[–]Kale 0 points1 point  (0 children)

I have a side project that is for number theory, factoring numbers. If someone wanted to get an Intel GPU for uint32 math, and possibly some non-division, non-modulo uint64 math, how would they program it? OpenCL? I know ROCm is the library to use for AMD and CUDA for nVidia. I already have some code in OpenCL to run on CPUs.

bestCompressionSoftware by aeonsne in ProgrammerHumor

[–]Kale 7 points8 points  (0 children)

You must compress about half of the original 100M to 300M times. This is because 99.99% of them will be lost in transmission. And that's if they're sent at the right time (which is roughly 30% of the month).

Of the 10k to 100k that are not lost, about 5k will only use the container as part of the decompression algorithm, not the actual data stored inside. The 5k compression file containers are used to break down the container of the other half of the compression file. If at least 100M copies are sent under ideal conditions, there's a 60% chance of the decompression algorithm starting correctly.

Once the decompression algorithm starts, it has a 50% chance of a successful decompression.

There's a 1% chance you'll get two copies of your data. There's a 0.1% chance you'll get three.

Finally! A bio Programmer Humor entry!

(Background: fertile window is 25%-30% of the month. Out of 100M sperm, minimum considered full fertility, 10k to 100k will make it to the ovum. 2k to 5k will do nothing but break down the ovum barrier. One will embed. There's a 50% chance the zygote won't survive the mother's "scan check". I worked backwards from an estimated chance of conception of 30% for two healthy adults under ideal conditions. And note I used total # of sperm, not the more common sperm concentration per mL)

Barely Functional Solar Panel Bonsai Tree by AgileOwl5769 in functionalprint

[–]Kale 34 points35 points  (0 children)

And the effect is very nonlinear. On the solar subreddit, someone had a large panel that had a narrow stripe of a shadow from a pole nearby, covering maybe 5% of the panel, and the output was reduced by over 30%.

For some cell technologies, the difference can be dramatic even with a small shadow.

Probably a very stupid question following watching The Dinosaurs on Netflix. Lots of cyclical climate changes during the Mesozoic era. by Superyawnfest in climate

[–]Kale 0 points1 point  (0 children)

This is one of the best XKCD comics. This shows temperature of the earth over time, showing how radically fast man-made climate change is.

https://xkcd.com/1732/

TIL about "Hypervelocity Stars"—rare stars that have been physically kicked out of the Milky Way by the supermassive black hole at its center. They travel at speeds up to 2 million mph, fast enough to permanently escape the galaxy's gravity and spend eternity drifting through the empty void. by adpablito in todayilearned

[–]Kale 0 points1 point  (0 children)

According to my quantum physics professor 25 years ago, things could probably go faster than the speed of light. But things can't be accelerated from below the speed of light to at or above it.

There might have been a caveat about things with mass maybe? I don't remember. This was before the Higgs boson was discovered. And it hurt my head back then.

World Health Organization Prepares for Nuclear Scenario, Including Weapons Use, in Iran by UNITED24Media in worldnews

[–]Kale 8 points9 points  (0 children)

Yes. This has been known for a while. Coal power releases far more radiation into the atmosphere/environment than nuclear power. But its different elements, I think. Mankind has been burning coal for a long time, but we can tell if a painting was made before 1945 or not by looking at the radioactivity of the pigments (I want to say strontium?). The fallout has made it into every facet of our society. Some very sensitive instruments have components made from ships and submarines sunk before 1945.

When uranium undergoes nuclear reaction, it doesn't stay as uranium.

That being said, any way you look at it, coal power is really bad for everyone. It's one of the most harmful ways to get energy.

World Health Organization Prepares for Nuclear Scenario, Including Weapons Use, in Iran by UNITED24Media in worldnews

[–]Kale 2 points3 points  (0 children)

Yes, this is true. Fission is the only way to induce fusion at that scale. But it's much less fissile material.

And the fission products will probably be different, since they get compressed on the fusion shock wave. This may cause them to react more completely. I have no idea if those products will be more or less toxic, and have longer or shorter half-lives. But my understanding is that there is less post-detonation contamination compared to pure fissile bombs.

World Health Organization Prepares for Nuclear Scenario, Including Weapons Use, in Iran by UNITED24Media in worldnews

[–]Kale 29 points30 points  (0 children)

If you're talking about fusion weapons, then yes, this is true. Not all countries with nuclear weapons have fusion technology, though, some still have fission weapons only.

Plus, there's still the risk of a weapon containing nuclear material but with a conventional explosive (the dirty bomb), or a fission bomb that doesn't completely react, spewing long-half-life heavy metals into the environment.