Skip to content

Instantly share code, notes, and snippets.

View yushangdi's full-sized avatar
🎯
Focusing

Shangdi Yu yushangdi

🎯
Focusing
  • Meta
  • CA
View GitHub Profile
@yushangdi
yushangdi / gist:516e0ab4aa6940745529328f4647bed4
Last active November 3, 2025 23:52
augment cudagraph trace
import os
import json
import torch
import torch.distributed as dist
from cuda.bindings import runtime, driver
def check_errors(result, success, err_fn):
# from torch.nn import *
# class Repro(torch.nn.Module):
# def __init__(self) -> None:
# super().__init__()
# self.true_graph_3 = GraphModule()
# self.false_graph_3 = GraphModule()
# self.true_graph_4 = GraphModule()
# self.false_graph_4 = GraphModule()
@yushangdi
yushangdi / upload_zenote.python
Last active December 11, 2023 21:39
upload files to zenoto
import requests
ACCESS_TOKEN = 'TOKEN'
r = requests.get('https://zenodo.org/api/deposit/depositions',
params={'access_token': ACCESS_TOKEN})
r.status_code
# 200
# print(r.json())
# []
import os
import importlib
import pickle
import torch
from torch.fx._symbolic_trace import symbolic_trace
from torch.profiler import profile, ProfilerActivity
from torch.fx.partitioner.partitioner import CapabilityBasedPartitioner
from torch.fx.partitioner.nvfuser_operator_support import NvFuserOperatorSupport
#include <vector>
#include <limits>
#include <string>
#include <fstream>
#include <sstream>
// #include "utils/dendro.h"
#include "parlay/parallel.h"
using namespace std;
// g++ -std=c++17 -I../../external/gbbs/external/parlaylib/include dendrogram_conversion.cpp -o dendro
@yushangdi
yushangdi / scheduler.h
Last active April 17, 2022 13:05
scheduler-numa
// EXAMPLE USE 1:
//
// fork_join_scheduler fj;
//
// long fib(long i) {
// if (i <= 1) return 1;
// long l,r;
// fj.pardo([&] () { l = fib(i-1);},
// [&] () { r = fib(i-2);});
// return l + r;
@yushangdi
yushangdi / parlayschtest.cpp
Created March 31, 2022 18:00
parlayschtest.cpp
#include "parlay/scheduler.h"
#include "parlay/parallel.h"
#include <unistd.h>
//to compile: g++ -Iexternal/parlaylib/include -DPARLAY_OPENMP -std=c++17 -pthread parlayschtest.cpp
using namespace std;
int main(int argc, char* argv[]) {
parlay::fork_join_scheduler fj;
@yushangdi
yushangdi / dkern_kernel.py
Last active November 22, 2018 20:33
code modified from https://github.com/rhaps0dy/convnets-as-gps NOT the final version of the code
import torch
import torch.nn.functional as F
import gpytorch
from gpytorch.kernels import Kernel
from typing import List
import numpy as np
# import abc
import exkern
from exkern import ElementwiseExKern