Skip to content

Instantly share code, notes, and snippets.

Usage:

conda create -n volcano_bench python=3.6 numba scipy tbb
conda activate volcano_bench
pip install pythran
pythran -O3 -fopenmp -march=native -DUSE_BOOST_SIMD shade_pythran.py
python driver_pythran.py
python driver_numba.py
@sklam
sklam / pygdf_cupy.ipynb
Created October 18, 2018 15:18
PyGDF + CuPy Interop
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sklam
sklam / main.cpp
Created September 28, 2018 21:08
How C++ RAII work?
// Compile with clang -S -emit-llvm -O1 main.cpp
#include <cstdio>
struct Apple {
Apple() {
puts("CTOR");
}
~Apple() {
puts("DTOR");
}
@sklam
sklam / README.md
Last active August 6, 2018 16:09
A list of projects that uses Numba
@sklam
sklam / ugly_hello_world.py
Last active July 24, 2018 15:59
Ugly Python3.5: Hello World
[
type(cc)(
type(getattr(cc, next(iter(k for k in dir(cc) if k.startswith("__co")))))(
*[
*lead,
bytes(nums[:-1]),
(None, "Hello World"),
("print",),
(),
"",
@sklam
sklam / gufunc_rewrite_plan.md
Created January 31, 2018 16:57
Plan to rewrite gufunc in numba

(G)Ufunc Rewrite Plan

Introduction

This document describes the reasons for rewriting the gufunc support in numba, and it sets the goals for the rewrite.

Background

Numba supports the creation of numpy ufunc and gufunc using the @vectorize and @guvectorize decorators, respectively. These decorators provided an easy way to create ufuncs and gufuncs without sacrificing execution performance (See Appendix 1). To use these decorators, users provide a the kernel function. For ufuncs, the kernel takes scalar arguments only. For gufuncs, the kernel takes Nd arrays.

@sklam
sklam / If_else.ipynb
Created December 5, 2017 16:16
llvmlite builder.if_else & phi example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sklam
sklam / README.md
Created October 23, 2017 20:50
Randomwalk PageRank in numba. Multithreaded CPU and single CUDA-GPU implementation.

README

Setup

Create conda environment with:

conda create -n pagerank35 python=3.5 numba pyculib cudatoolkit networkx
@sklam
sklam / unsafe_cast.py
Created November 29, 2016 09:54
Demo for unsafe_cast to cast arbitrary pointer into a jitclass instance
"""
Demonstrate potential numba feature for casting an arbitrary pointer into
a jitclass instance.
"""
from collections import OrderedDict
import numpy as np
from numba import njit, jitclass, types
@sklam
sklam / tuple_of_array.py
Last active April 10, 2018 08:29
Numba namedtuple + numpy array
from collections import namedtuple
import numpy as np
from numba import njit
MyRec = namedtuple("MyRec", "indices,values")