Prime factorization is useful for reshaping an array into the highest dimension form where non of the dimension has size of 1.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Compile this with: | |
$ clang -O3 do_no_evil.c && ./a.out | |
Reference http://blog.llvm.org/2011/05/what-every-c-programmer-should-know_14.html | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numba import jitclass | |
from numba import types | |
from numba.typed import Dict | |
@jitclass([('d', types.DictType(types.intp, types.float64))]) | |
class DictWrapper(object): | |
def __init__(self): | |
d = Dict() | |
d[1] = 1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numba import cuda, typeof | |
import numpy as np | |
import pickle | |
@cuda.jit | |
def foo(x, v): | |
x[0] = v | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numba import njit | |
@njit | |
def foo(functor, a, b): | |
return bar(functor, functor(a, b), b) | |
@njit | |
def bar(functor, a, b): |
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
NewerOlder