Skip to content

Instantly share code, notes, and snippets.

View V0XNIHILI's full-sized avatar
🎯
Focusing

Douwe den Blanken V0XNIHILI

🎯
Focusing
View GitHub Profile
@V0XNIHILI
V0XNIHILI / argmax_tree.v
Created June 14, 2024 15:31
Argmax tree
module pairwise_max #(
parameter int WIDTH = 8,
parameter int INDEX_WIDTH = 4
)(
input signed [WIDTH-1:0] a,
input signed [WIDTH-1:0] b,
input [INDEX_WIDTH-1:0] index_a,
input [INDEX_WIDTH-1:0] index_b,
@V0XNIHILI
V0XNIHILI / gtk_wave_on_apple_silicon.md
Last active September 2, 2024 17:04
How to compile GTKWave for Apple Silicon (M1/M2/M3 Macs)

How to compile GTKWave for Apple Silicon (M1/M2/M3 Macs)

Based on this tutorial for the M1 Mac, find below a step-by-step guide on how to compile GTKWave from scratch for the M3 MacBook (Pro). See my LinkedIn post with the short announcement here.

Note: it is a prerequisite to have HomeBrew installed (find installation instructions at site).

Steps

1. Install required Homebrew packages

@V0XNIHILI
V0XNIHILI / Makefile
Last active June 10, 2024 17:43
Sudoku solver in C
# Makefile for Sudoku Solver
# Compiler
CC = gcc
# Compiler Flags
CFLAGS = -O3 -march=native -flto -funroll-loops -ffast-math -fomit-frame-pointer -finline-functions -fmerge-all-constants -ffunction-sections -fdata-sections -fstack-protector-strong -falign-functions=32
# Target executable
TARGET = sudoku_solver
@V0XNIHILI
V0XNIHILI / gpu_picker_utils.py
Last active April 4, 2024 16:03
Get the index / id of the Nvidia GPU on your cluster that has the lowest total memory usage to run your job on
from typing import Optional
import os
import subprocess
import torch
def get_gpu_memory_usage():
"""Get GPU memory usage using nvidia-smi."""
try:
@V0XNIHILI
V0XNIHILI / CNN4.py
Last active March 25, 2024 22:21
4-layer CNN model used in a variety of meta-learning papers
from typing import Tuple
import torch
import torch.nn as nn
def conv_block(in_channels: int,
out_channels: int,
batch_norm: bool):
return nn.Sequential(
@V0XNIHILI
V0XNIHILI / 1.58_bit_weights_exploration.ipynb
Last active March 11, 2024 10:29
Ternary (1.58 bit) weight exploration
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@V0XNIHILI
V0XNIHILI / variable_size_output_layer.py
Last active June 8, 2023 17:29
Initial take at variable size linear output layer
import torch.nn as nn
import torch
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self, input_size=16, hidden_size=32, initial_output_size=5):
super().__init__()
self.input_size = input_size
@V0XNIHILI
V0XNIHILI / calculate_vinyals_split_indices.ipynb
Created April 8, 2023 13:29
Calculate Omniglot Vinyals train, validation and test splits from Protoypical networks code for PyTorch
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@V0XNIHILI
V0XNIHILI / on_chip_energy.py
Last active March 16, 2023 10:43
Functions to compute energy per operation on a chip
"""Data taken from paper: Computing's Energy Problem (and what we can do about it) - Mark Horowitz
All output energies are in pJ (pico Joule)
"""
import math
E_INT_ADD_PER_BIT = (0.03 / 8 + 0.1 / 32) / 2
@V0XNIHILI
V0XNIHILI / matrix_as_graph.ipynb
Last active January 29, 2024 16:48
Matrix multiplication in graph form
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.