Skip to content

Instantly share code, notes, and snippets.

View anupambhatnagar's full-sized avatar
😄

Anupam Bhatnagar anupambhatnagar

😄
View GitHub Profile
@anupambhatnagar
anupambhatnagar / omnitrace.out
Created January 24, 2024 23:21
omnitrace output
#### omnitrace :: executing 'python3 -m omnitrace -- rms_norm.py'... #####
[omnitrace]> profiling: ['/home/anupamb/rms_norm.py']
[omnitrace][1488305][omnitrace_init_tooling] Instrumentation mode: Trace
______ .___ ___. .__ __. __ .___________..______ ___ ______ _______
/ __ \ | \/ | | \ | | | | | || _ \ / \ / || ____|
| | | | | \ / | | \| | | | `---| |----`| |_) | / ^ \ | ,----'| |__
| | | | | |\/| | | . ` | | | | | | / / /_\ \ | | | __|
@anupambhatnagar
anupambhatnagar / omnitrace_backtrace.txt
Created January 18, 2024 19:42
omnitrace backtrace
```
$ omnitrace-instrument -- ./rms_norm.par
[omnitrace][exe]
[omnitrace][exe] command :: '/home/anupamb/rms_norm.par'...
[omnitrace][exe]
[omnitrace][exe] DYNINST_API_RT: /home/anupamb/omnitrace/lib/omnitrace/libdyninstAPI_RT.so
^C
[omnitrace][318773][0] Signal 2 caught : Interrupt (Signal sent by the kernel 0 0)
@anupambhatnagar
anupambhatnagar / omniperf_error.txt
Created January 17, 2024 00:46
omniperf roofline
❯ omniperf profile -n vcopy_all -- ./vcopy -n 1048576 -b 256
ROC Profiler: /opt/rocm-6.0.0/bin/rocprof
Execution mode = profile
___ _ __
/ _ \ _ __ ___ _ __ (_)_ __ ___ _ __ / _|
| | | | '_ ` _ \| '_ \| | '_ \ / _ \ '__| |_
| |_| | | | | | | | | | | |_) | __/ | | _|
\___/|_| |_| |_|_| |_|_| .__/ \___|_| |_|
|_|
@anupambhatnagar
anupambhatnagar / profiler.py
Created December 14, 2023 01:14
Trace collection example
import torch
import torch.nn as nn
import torch.optim as optim
from torch.profiler import profile, schedule, tensorboard_trace_handler, ProfilerActivity
class Xor(nn.Module):
def __init__(self):
super(Xor, self).__init__()
self.fc1 = nn.Linear(2, 3, True)
self.fc2 = nn.Linear(3, 1, True)
@anupambhatnagar
anupambhatnagar / leetcode2571.py
Created August 28, 2023 00:19
Solution to Leetcode 2571
"""
You are given a positive integer n, you can do the following operation any number of times:
- Add or subtract a power of 2 from n.
Return the minimum number of operations to make n equal to 0.
A number x is power of 2 if x == 2^i where i >= 0.
"""
@anupambhatnagar
anupambhatnagar / dyno_hta.dockerfile
Last active July 27, 2023 20:05
Dockerfile for Dynolog and HTA demo
FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-devel
RUN apt update
ENV DEBIAN_FRONTEND=noninteractive
RUN apt install -y curl tmux wget
# install rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="$HOME/.cargo/env:${PATH}"
@anupambhatnagar
anupambhatnagar / docker_cheatsheet.sh
Last active January 16, 2024 20:40
Commonly used Docker commands
# Launch container and enter shell
docker run --rm -it <image_name>
# Create image from docker file
docker build -t <image_name:tag> -f /path/to/dockerfile .
# Create image from running container
docker commit <container_id> <account_name/image_name:tag>
# Push image to docker hub
git checkout --orphan new-branch
git add -u
git commit -m 'first commit'
git branch -D main // delete main
git branch -m main // rename new-branch to main
git push -f origin main // force push main
@anupambhatnagar
anupambhatnagar / default.html
Created December 28, 2022 23:22
Enable LaTeX using mathjax in markdown files
<!DOCTYPE html>
<html lang="{{ page.lang | default: site.lang | default: "en" }}">
{%- include head.html -%}
{%- include mathjax.html -%}
<body>
{%- include header.html -%}
<main class="page-content" aria-label="Content">