RSSAmplifier

Blog

Marton Veges

mveg.esRSS feed ↗7 posts

Latest posts

FizzBuzz in FORTRAN 1

Fortran is the first high-level programming language. Its latest iteration, Fortran 2023 is a modern language by today’s standards. However, its very first version, released in 1956, is rather simple, containing only a small set of commands. To get a feel for what it was like, I'll walk through a FizzBuzz implementation in this post. Let's start with the code: c FizzBuzz program in FORTRAN 1 1…

Optimizing PyTorch Docker images: how to cut size by 60%

When training neural networks on a cluster, using Docker containers is one of the easiest ways to package up all the dependencies. However, PyTorch and CUDA are both large libraries, which can make your Docker images quite hefty. For example, we might have the following dockerfile: FROM nvidia/cuda : 11.8.0 - cudnn8 - runtime - ubuntu22.04 RUN apt - get update && apt - get install - - no - install…

Eigenvalues as the magnitude of the matrix

Eigenvalues are a notoriously hard topic to understand. Their definition can be unintuitive, making it difficult to understand their usefulness. Recently, I've started explaining eigenvalues as the magnitude of a matrix, that generalizes the notion of "big" and "small" numbers. Magnitude of real numbers Take an arbitrary real number $x$. What is $x^n$ if $n$ is large? If $x=0$ or $1$ the answer is…

Fast numerically stable moving average

Calculating the moving average of a time series is a pretty simple problem. Just loop over each position, and add up the elements over the window: void simple_ma ( double * in , double * out , int N , int W ) { for ( int i = 0 ; i < N - W + 1 ; i ++ ) { double sum = 0 ; for ( int j = 0 ; j < W ; j ++ ) { sum += in [ i + j ] ; } out [ i ] = sum / W ; } } However, this has a time complexity of…

Writing a device driver for Unix V6

In this post we will learn the useful skill of writing a device driver for Unix V6 (released in 1975) and run it on an emulator. The implemented device is fairly trivial: it will open a message box on the host OS. The goal is that we can execute the following command: echo "Hello world" > /dev/mb And get this: The message box is opened in the host OS, so effectively we create a special file (…

Linux Server on an Android Phone

A little while ago I wanted to set up a small home server to host some pages. I could have just used some free web hosting but where is the fun in that? So I checked what old devices I have I could repurpose. The first obvious choice was my old HP laptop. It had a tiny bit of a problem: its fans are super loud, I didn't want to listen to them all day. Then it downed on me: I just bought a new…

Inside Windows Registry

The Windows Registry is a central storage for settings in Windows, and also a popular target of hacks to enable/disable obscure features. But how does it work? Where does it store all the data? What options are available in it? In this post I plan to go through the internals of the registry. Overview The registry is a hierarchical key-value storage system, that keeps its elements in a tree-like…