• 3 Posts
  • 232 Comments
Joined 2 years ago
cake
Cake day: July 3rd, 2023

help-circle
  • A real-world optical chip that you can actually buy is exciting. Still, seems to be far from a consumer-grade optical CPU. It’s more like a microcontroller, which you stick at the end of your 10 GBit fiber optic cable, and receive processed optic data.

    Memory is going to be a big problem, because any AI workload requires a ton of it, and replacing even a simple 16 GB DRAM chip with an all-optic equivalent means you are essentially creating 16 GB of L1 CPU cache, which would be like 100 server CPUs stacked together, used only for their cache memory. And if you are using a conventional DRAM, you need to introduce optic-to-electric converter, which will be a speed bottleneck of your system, and probably expensive.
















  • printf is superior and more concise, and snprintf is practically the only C string manipulation function that is not painful to use.

    Try to print a 32-bit unsigned int as hexadecimal number of exactly 8 digits, using cout. You can do std::hex and std::setw(8) and std::setfill('0') and don’t forget to use std::dec afterwards, or you can just, you know, printf("%08x") like a sane person.

    Just don’t forget to use -Werror=format but that is the default option on many compilers today.

    C++23 now includes std::print which is exactly like printf but better, so the whole argument is over.