Performance Hints, notes
There’s a fantastic performance article by the legendary Jeff Dean, Sanjay Ghemawat that covers the vast span of Performance optimizations that captures a good mental model for performance awareness.
Recent content in surya on Suriya's site
There’s a fantastic performance article by the legendary Jeff Dean, Sanjay Ghemawat that covers the vast span of Performance optimizations that captures a good mental model for performance awareness.
I was reading this paper , It appears you don't have a PDF plugin for this browser. No biggie... you can click here to download the PDF file.
an agent that learns and optimizes will outperform a frozen 1.8 trillion parameter model. i’m not saying a 7B model is smarter than a frontier model. on a zero-context task the big models win. what i’m saying is that the moment you fix a task, a customer issue, a codebase, a distribution of tickets, and you let one system accumulate the corrections while the other one wakes up with…
mintlify’s cofounder wrote an article about why you should “ remember to not smile ”. I’m sure han is a fantastically optimistic guy. you can’t build a company without infinite optimism. while the gist of his article is directionally correct (do hard things), his punchline just points at a dystopian future where people are just grinding on b2b saas while not smiling.…
It’s been 100 days since I met the guy who will be holding most of my attention for the upcoming decades. Something my wife said that is fascinating to me, until 01:45 of April the 3rd, I didn’t know how this guy would look, but now all I can see when I close my eyes is his face. in my completely unbiased opinion ila maaran has the best smile of any baby in existence.
back in 2012 when I moved from pattiveeranpatti, a small village to Chennai, a city in Tamil Nadu. there was something interesting, the kids there had no mental model of villages, farming or the culture around it. Coffee 1 , vegetables, and everything else were just things that you procure from shops. I remember explaining, in detail, the layers and process involved, but even then they could never…
When traced through literary history, there’s a clear trend of smaller and smaller books, War and Peace (Leo Tolstoy, 1869): ~587,000 words. Ulysses (James Joyce, 1922): ~265,000 words. Harry Potter and the Sorcerer’s Stone (JK Rowling, 1997): ~77,000 words. Convenience Store Woman (Sayaka Murata, 2016): ~35,000 words. and it is not merely coincidence that, less people are reading books as…
I hate elon for his political affiliations and his lame comments as much as the next guy. But it would facetious to not acknowledge his accomplishments.
Postgres is awesome, but can You get away with it being a filesystem or stash space for your application. here are some calculations I did.
What is the cloud ? essentially a bunch of server running in a random datacenter. server rack These racks and racks of servers can run cohesively together as one simple computer using the Internet. by communicating to each other.
drone trained by RL beat the world’s best human pilots (2023) UZH, 2023. Trained in simulation. Onboard camera only. Beat three FPV world champions on a real track.
God as an it. everything is subjective perspective of of the self, interacting with the world. because we consider something as thou does not take away the fact that, something is an it. thou is a subjective emotion evoked as a function of the world. All Real Living is Meeting: I and Thou The idea, boils human existence down to a single premise: Life is defined entirely by how we relate to the…
Recursion is often taught in Computer Science 101 as an elegant, mathematically pure way to solve problems and used widely in leetcode style problems. However, in production environments using mainstream imperative languages (like Python, JavaScript, Java, or C++), it is heavily discouraged. Recursions are usually a footgun in waiting because of some technical
In the past few weeks there have been examples of successful agent usage at a shocking scale. some in production no less.
make a release build!!!! so many times, when doing performance profiling, I’ve used the debug build and profiled it, because usually there is the DWARF debugging information. making it easy/fast to build a binary. but the problem with it that, there are ton of developer friendly optimizations that happens, heap layout will be unoptimized, link time optimization is not there
I love working at oxen because we strive to be the fastest data versioning tool in the market. Which is why we often do multi terabyte benchmarks on each commands that we support , (add, commit, etc.)
This is such a front loaded question, because depending on where you are in life or where this question is being pointed at (family, career, etc.) and the timeline given It is going to be wildly different. But it is important to take time to stabilize the ever growing entropy.
It is now possible to create content that is, a few order of magnitude more than the total time available to all humans currently alive. and I’m confident a major percentage of them can be tailored to be interesting for a person with specific psyche. My opinion is that human attention is going to become more and more valuable, yet it is going to get very difficult to focus on something for…
I really love just taking notes, run code and having it in my blog. Quarto is quite cool, I end up committing both the .qmd and .md files generated from running quarto render locally. (haven’t gotten to cicd yet.)
I love poor Richard’s almanack specifically because the wisdom hidden within the words is malleable and every time I come back to read it I take something new based on my life experiences since then. This book has become part of this meditative 1 - 2 hours I spend every 6 months. and I can definitively say that this is a must read for everyone.
There is work underway to convert this into english. just haven’t gotten to it yet. Some of these dishes are so nostalgic even when I read the name.
convert RW2 format to jpg with imagemagick. while maintaining quality. for f in *.RW2; do magick " $f " -quality 85 "GooglePhotosBackup/ ${ f%.* } .jpg" exiftool -tagsFromFile " $f " -all:all "GooglePhotosBackup/ ${ f%.* } .jpg" -overwrite_original done convert mp4 into good quality video.
Overall I loved this book a lot. bought me a new passion for reading fiction. astrophage. Astrophage (Greek for “star eater”), is an interstellar bacteria. sort of like the bacteriophage, but if it could somehow store neutrinos and travel at the speed of light. quite tacky, but leads to a very interesting storyline because they come to the solar system they start consuming the sun and…
the core principle: think slow, act fast The vast majority of big projects fail—they are over budget, over time, and under benefits. The pattern for failure is “Think fast, act slow.” A rush to start, followed by endless delays, problems, and cost overruns. The pattern for success is “Think slow, act fast.” A long, careful, iterative planning phase enables a quick,…
#include <cuda_runtime.h> #include <iostream> #include <stdio.h> __global__ void convolution_1d_kernel ( const float * input, const float * kernel, float * output, int input_size, int kernel_size) { int i = blockDim.x * blockIdx.x + threadIdx.x; int output_size = input_size - kernel_size + 1 ; if (i < output_size ) { float sum = 0.0f ; for ( int j = 0 ; j < kernel_size; j ++ ) { sum += input[i +…
#include <cuda_runtime.h> __global__ void invert_kernel ( unsigned char * image, int width, int height) { int i = blockIdx.x * blockDim.x + threadIdx.x; image[i * 4 ] = 255 - image[i * 4 ]; image[i * 4 + 1 ] = 255 - image[i * 4 + 1 ]; image[i * 4 + 2 ] = 255 - image[i * 4 + 2 ]; } // image_input, image_output are device pointers (i.e. pointers to memory on the GPU) extern "C" void solve( unsigned…
#include <cuda_runtime.h> __global__ void count_2d_equal_kernel ( const int * input, int * output, int N, int M, int K) { int idx = blockDim.x * blockIdx.x + threadIdx.x; int idy = blockDim.y * blockIdx.y + threadIdx.y; if ((idx < N && idy < M) && input[idx * M + idy] == K) atomicAdd(output, 1 ); } // input, output are device pointers (i.e. pointers to memory on the GPU) extern "C" void solve(…
#include <cuda_runtime.h> __global__ void count_equal_kernel ( const int * input, int * output, int N, int K) { int id = blockDim.x * blockIdx.x + threadIdx.x; if (id < N && input[id] == K) atomicAdd(output, 1 ); } // input, output are device pointers (i.e. pointers to memory on the GPU) extern "C" void solve( const int * input, int * output, int N, int K) { int threadsPerBlock = 256 ; int…
#include <cuda_runtime.h> __global__ void leaky_relu_kernel ( const float * input, float * output, int N) { int id = blockDim.x * blockIdx.x + threadIdx.x; if (id < N) output[id] = input[id] > 0 ? input[id] : 0.01 * input[id]; } // input, output are device pointers (i.e. pointers to memory on the GPU) extern "C" void solve( const float * input, float * output, int N) { int threadsPerBlock = 256 ;…
#include <cuda_runtime.h> __global__ void matrix_add ( const float * A, const float * B, float * C, int N) { int id = blockDim.x * blockIdx.x + threadIdx.x; if (id < N) C[id] = A[id] + B[id]; } // A, B, C are device pointers (i.e. pointers to memory on the GPU) extern "C" void solve( const float * A, const float * B, float * C, int N) { int threadsPerBlock = 256 ; int blocksPerGrid = (N * N +…
#include <cuda_runtime.h> #include <stdio.h> #include <iostream> __global__ void copy_matrix_kernel ( const float * A, float * B, int N) { int idx = blockDim.x * blockIdx.x + threadIdx.x; if (idx < N){ B[idx] = A[idx]; } } // A, B are device pointers (i.e. pointers to memory on the GPU) extern "C" void solve( const float * A, float * B, int N) { int total = N * N; int threadsPerBlock = 256 ; int…
The tricky part in this was that, I took some time to intuit that each thread should associate to each value in the output matrix.
#include <cuda_runtime.h> #include <iostream> #include <stdio.h> __global__ void matrix_transpose_kernel ( const float * input, float * output, int rows, int cols) { int i = blockIdx.x * blockDim.x + threadIdx.x; int j = blockIdx.y * blockDim.y + threadIdx.y; printf( "%d" ,i); if (i < rows && j < cols){ output[j * rows + i] = input[i * cols + j]; } } // input, output are device pointers (i.e.…
ReLU(x) = max(0,x) #include <cuda_runtime.h> __global__ void relu_kernel ( const float * input, float * output, int N) { int id = blockDim.x * blockIdx.x + threadIdx.x; if (id < N) output[id] = std :: max( 0.0f ,input[id]); } // input, output are device pointers (i.e. pointers to memory on the GPU) extern "C" void solve( const float * input, float * output, int N) { int threadsPerBlock = 256 ; int…
#include <cuda_runtime.h> #include <iostream> #include <stdio.h> __global__ void reverse_array ( float * input, int N) { int i = blockDim.x * blockIdx.x + threadIdx.x; if (i < N / 2 ) { std :: swap(input[i],input[N - i - 1 ]); } } // input is device pointer extern "C" void solve( float * input, int N) { int threadsPerBlock = 256 ; int blocksPerGrid = (N + threadsPerBlock - 1 ) / threadsPerBlock;…
#include <cuda_runtime.h> __global__ void silu_kernel ( const float * input, float * output, int N) { int id = blockDim.x * blockIdx.x + threadIdx.x; if (id < N) output[id] = input[id] * ( 1 / ( 1 + std :: exp( - 1 * (input[id])))); } // input, output are device pointers extern "C" void solve( const float * input, float * output, int N) { int threadsPerBlock = 256 ; int blocksPerGrid = (N +…
import torch import torch.nn as nn # input, model, and output are on the GPU def solve (input: torch . Tensor, model: nn . Module, output: torch . Tensor): model . eval() with torch . no_grad(): output . copy_(model(input))
#include <cuda_runtime.h> float silu ( float x){ return x * ( 1 / ( 1 + std :: exp( - 1 * (x)))); } __global__ void swiglu_kernel ( const float * input, float * output, int halfN) { int id = blockDim.x * blockIdx.x + threadIdx.x; if (id < halfN) output[id] = input[id % halfN] * ( 1 / ( 1 + std :: exp( - 1 * (input[id % halfN])))) * input[id % halfN + halfN]; } // input, output are device pointers…
The question was Implement a program that performs element-wise addition of two vectors containing 32-bit floating point numbers on a GPU. The program should take two input vectors of equal length and produce a single output vector containing their sum. Implementation Requirements External libraries are not permitted The solve function signature must remain unchanged The final result must be…
functional programming (FP) has always seemed like a curiosity – a realm of mathematical purity with little bearing on the practical realities of building robust, scalable software. However, as the complexity of software grows and the demand for concurrent and parallel processing. This post aims to demystify functional programming for the experienced object-oriented programmer and offer a…
cold emailing is very powerful, but doing it effectively is a very difficult task. There are so many things to consider, before sending out an email. This is a collection of successful cold emails I’ve found around the web.
parkinson’s law “work expands so as to fill the time available for its completion” When Northcote made this observation, this was designed for organisations, but I believe this is a good representation for personal tasks as well.
Amodei focusing on AI comes from a belief that these risks are the primary obstacles to an overwhelmingly positive future. because if AI is as promising as it is, then it is our job to be that much more careful about it. Most people are underestimating the sheer scale of AI’s potential benefits, just as they underestimate the risks. This essay is an attempt to sketch out that positive…
tools hex is the package manager. similar to pip. mix tooling to build, run, test, and release Erlang applications. kinda like cargo for rust.
I will start out by saying I’m a big fan of ridiculously successful people taking their hobbies/passtimes to extreme ends. Which is why i really like, Linus torvalds building his scuba diving software or Nathan Myhrvold writing a five volume book set about bread. Something about it is just fascinating to me. Here is a person whose attention is extremely in demand and there are a million on…
I used to listen to Charlie Munger’s psychology lectures a lot. So I had some idea what the book was going to be about, invert always invert, align incentives, do a simple thing consistently where ideas that I try to apply in my life. One of the things that I like a lot about charlie’s view of life is how he focuses on perpetual, voracious learning. Being able to adapt to changing…
He would have been 27 today. Been three quite long years since he decided he no longer wanted to do anything with life and took his own.
Every week there is a new agent that the twitter micro-cosmos gets fired up about. This week it was agent 3. Which is apparently miles ahead of the competition and is able to plan and execute for up to 200 minutes.