Usually, located at /usr/local/cuda/bin
$ nvprof python train_mnist.py
I prefer to use --print-gpu-trace.
| SHOBJ_CFLAGS ?= -fno-common -g -ggdb | |
| SHOBJ_LDFLAGS ?= -shared -Bsymbolic | |
| CFLAGS = -Wall -g -fPIC -lc -lm -Og -std=gnu99 | |
| CC=gcc | |
| all: example.so | |
| example.so: example.o | |
| $(LD) -o $@ example.o $(SHOBJ_LDFLAGS) $(LIBS) -lc |
| .PHONY: using-gcc using-gcc-static using-clang | |
| using-gcc: | |
| g++-4.8 -o main-gcc -lasan -O -g -fsanitize=address -fno-omit-frame-pointer main.cpp && \ | |
| ASAN_OPTIONS=symbolize=1 ASAN_SYMBOLIZER_PATH=$(shell which llvm-symbolizer) ./main-gcc | |
| using-gcc-static: | |
| g++-4.8 -o main-gcc-static -static-libstdc++ -static-libasan -O -g -fsanitize=address -fno-omit-frame-pointer main.cpp && \ | |
| ASAN_OPTIONS=symbolize=1 ASAN_SYMBOLIZER_PATH=$(shell which llvm-symbolizer) ./main-gcc-static |
| #include <iostream> | |
| #include <random> | |
| #include <chrono> | |
| #include <x86intrin.h> | |
| #include <cassert> | |
| // Runtime evaluation for squared Eucliden distance functions | |
| // - fvec_L2_sqr_ref: naive reference impl from Faiss | |
| // - fvec_L2_sqr_sse: SSE impl from Faiss | |
| // - fvec_L2_sqr_avx: AVX impl from Faiss |
| /* | |
| * Parallel bitonic sort using CUDA. | |
| * Compile with | |
| * nvcc -arch=sm_11 bitonic_sort.cu | |
| * Based on http://www.tools-of-computing.com/tc/CS/Sorts/bitonic_sort.htm | |
| * License: BSD 3 | |
| */ | |
| #include <stdlib.h> | |
| #include <stdio.h> |
| """ | |
| Author: Awni Hannun | |
| This is an example CTC decoder written in Python. The code is | |
| intended to be a simple example and is not designed to be | |
| especially efficient. | |
| The algorithm is a prefix beam search for a model trained | |
| with the CTC loss function. |
A pattern for building personal knowledge bases using LLMs.
This is an idea file, it is designed to be copy pasted to your own LLM Agent (e.g. OpenAI Codex, Claude Code, OpenCode / Pi, or etc.). Its goal is to communicate the high level idea, but your agent will build out the specifics in collaboration with you.
Most people's experience with LLMs and documents looks like RAG: you upload a collection of files, the LLM retrieves relevant chunks at query time, and generates an answer. This works, but the LLM is rediscovering knowledge from scratch on every question. There's no accumulation. Ask a subtle question that requires synthesizing five documents, and the LLM has to find and piece together the relevant fragments every time. Nothing is built up. NotebookLM, ChatGPT file uploads, and most RAG systems work this way.