Skip to content

Instantly share code, notes, and snippets.

View tsmcalister's full-sized avatar

Timothy Mc Alister tsmcalister

View GitHub Profile
@tsmcalister
tsmcalister / cupy_eval.py
Created December 15, 2020 13:34
Cuda Haversine Distance Calculator for Santa's Stolen Sleigh
import cupy as cp # needs to match your cuda toolkit version (See https://docs.cupy.dev/en/stable/install.html#installing-cupy)
import numpy as np
from pandas import DataFrame
class CupyEvaluator:
def __init__(self, santa_df: DataFrame, sleigh_weight=10):
raw = santa_df.to_numpy()
# add 0 padding for indexing (GiftId starts at 1)
raw = np.vstack((np.zeros(raw.shape[1]), raw))
# add sleigh weight to northpole position
0x2629135b86519d3F7e66e430236de86381c0B701