Skip to content

Instantly share code, notes, and snippets.

View isVoid's full-sized avatar
🤗

Michael Wang isVoid

🤗
View GitHub Profile
@isVoid
isVoid / gist:d10d40fae8158ea697d12bb81d434240
Created August 7, 2025 05:01
bfloat16_int8_mappings.py
#!/usr/bin/env python3
"""
Script to check 1:1 mapping between int8 and bfloat16 data types.
This script iterates through all possible int8 values (-128 to 127),
converts each to bfloat16, and checks if there's a bijective mapping
between the two data types.
"""
import numpy as np
@isVoid
isVoid / CMakeLists.txt
Last active April 8, 2024 15:18
Trace Instantiated Class Template from ParmVarDecl
cmake_minimum_required(VERSION 3.10)
project(ClangToolingExample)
# libastcanopy shared lib targget
find_package(Clang REQUIRED)
# Add include directories
include_directories(${CLANG_INCLUDE_DIRS})
# Add the source files for your Clang tool
@isVoid
isVoid / module_scraper.py
Created March 7, 2024 10:04
Recursively extract module and functions
import os
import pkgutil
import importlib
from inspect import getmembers, isfunction
import cuml
import json
import pprint
pp = pprint.PrettyPrinter(indent=4)
@isVoid
isVoid / tf_device_bug.ipynb
Last active September 19, 2023 10:17
Several Repros of `tf.device` bug, ran on Nvidia DGX V100 machines with 8GPUs.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@isVoid
isVoid / benchmark_driver.py
Last active May 31, 2023 15:59
Pairwise LineString DIstance Benchmarks
from dataclasses import dataclass
import subprocess
benchmark_bin = "/home/coder/cuspatial/cpp/build/release/benchmarks/LINESTRING_DISTANCES_BENCH"
attr_names = ["NumPairs",
"NumLineStringsPerMultiLineString",
"NumSegmentsPerLineString"]
@dataclass
@isVoid
isVoid / spline_bench.ipynb
Created August 16, 2022 02:54
Benchmark cuspatial CubicSpline against Scipy
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@isVoid
isVoid / RollingVarErrorAnalysis.ipynb
Last active August 24, 2021 00:30
Pandas rolling std vs cudf rolling std
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@isVoid
isVoid / cvn_get_loc_bench.py
Created June 14, 2021 22:25
Using cupy/numpy in get_loc
import cupy as cp
import pandas as pd
import cudf
def make_non_monotonic_non_unique_multiindex(N):
half_n = int(N / 2)
l0 = cp.concatenate([cp.arange(0, half_n), cp.full(half_n, 42)])
l1 = cp.concatenate([cp.arange(half_n, N), cp.full(half_n, 42)])
random_order = cp.arange(0, N)
cp.random.shuffle(random_order)
@isVoid
isVoid / pvc_get_loc_bench.py
Created June 14, 2021 22:22
Pandas vs cudf get_loc benchmark
import cupy as cp
import pandas as pd
import cudf
import time
def make_non_monotonic_non_unique_multiindex(N):
half_n = int(N / 2)
l0 = cp.concatenate([cp.arange(0, half_n), cp.full(half_n, 42)])
l1 = cp.concatenate([cp.arange(half_n, N), cp.full(half_n, 42)])
random_order = cp.arange(0, N)