Beware of fast-math

date: 2023-10-25 · Tags: #til, #system-programming, #clang

fast-math is a set of compiler flags that enables a series of optimizations for floating-point arithmetic.

  • -ffast-math (and included by -Ofast) in GCC and Clang
  • -fp-model=fast (the default) in ICC
  • /fp:fast in MSVC
  • --math-mode=fast command line option or @fastmath macro in Julia.

But please notice that fast-math is not free lunch. Use it with cautions 😲.

Hence check this post 1 to see what innocuous performance speedup or unfortunate downstream effects fast-math would bring to you.

I mean, the whole point of fast-math is trading off speed with correctness. If fast-math was to give always the correct results, it wouldn’t be fast-math, it would be the standard way of doing math. -- Mosè Giordano 2

Footnotes

  1. Simon's notes - Beware of fast-math

  2. What’s going on with exp() and –math-mode=fast?

An Interactive Intro to CRDTs

date: 2023-10-10 · Tags: #til, #good-reading, #dev

Today, let's enjoy anotehr (previous one is here) amazing interactive visualization of CRDTs1.

Footnotes

  1. An Interactive Intro to CRDTs

Generative AI exists because of the transformer

date: 2023-10-07 · Tags: #news, #ai

An excellent visual article by the Financial Times on how generative AI and the transformer model work. Entry level, but very well done.

Unifying the CUDA C++ Core Libraries

date: 2023-10-07 · Tags: #dev

We're excited to announce that the CUDA C++ Core Libraries (CCCL) - Thrust, CUB, and libcudacxx - are now unified under the nvidia/cccl repository.

-- Jake Hemstad (@jrhemstad) on GitHub1

  • thrust: The C++ parallel algorithms library.
  • cub: Cooperative primitives for CUDA C++.
  • libcudacxx: The C++ Standard Library for your entire system.

I delightful love news / work like unifying abstractions. It makes me peace, relaxy and makes everything robuster.

Refs:

Footnotes

  1. Unifying the CUDA C++ Core Libraries: Towards a More Delightful CUDA C++ #520

Epoch in PostgreSQL and Unix

date: 2023-10-03 · Tags: #postgresql, #dev

Today I got to update my #ObscureKnowledge that the system epoch (1970-01-01) is not the same as the @PostgreSQL epoch (2000-01-01) to help someone squash a bug.