Skip to content

Instantly share code, notes, and snippets.

View yoshipon's full-sized avatar

Yoshiaki Bando yoshipon

View GitHub Profile
@yoshipon
yoshipon / bench.py
Created July 24, 2020 11:02
A tiny benchmark script
import time
import numpy as np
def make_psd_matrix(M, T):
tmp = np.random.randn(T, M, M) + 1j * np.random.randn(T, M, M)
return np.einsum("tmn,tno->tmo", tmp, tmp.conj())
@yoshipon
yoshipon / numpy-aocl.conf
Created July 25, 2020 09:40
A singularity recipe for NumPy w/ AOCL
# 1. Download `aocl-linux-gcc-2.2.0_1_amd64.deb` into the same directory as this config file.
# 2. Build the container with `sudo singularity build numpy-aocl.img numpy-aocl.conf`.
# 3. Run ipython with `OMP_NUM_THREADS=64 singularity exec numpy-aocl.img ipython`.
Bootstrap: docker
From: continuumio/anaconda3
%files
aocl-linux-gcc-2.2.0_1_amd64.deb /tmp
@yoshipon
yoshipon / noglobal.py
Last active November 20, 2022 03:45 — forked from ax3l/noglobal.py
Useful Noglobal in Python
# License:
# I hereby state this snippet is below "threshold of originality" where applicable (public domain).
#
# Otherwise, since initially posted on Stackoverflow, use as:
# CC-BY-SA 3.0 skyking, Glenn Maynard, Axel Huebl
# http://stackoverflow.com/a/31047259/2719194
# http://stackoverflow.com/a/4858123/2719194
import types
import inspect
@yoshipon
yoshipon / bench.py
Last active September 25, 2021 01:32 — forked from denkiwakame/bench.py
numba-cpp benchmarks
from benchmarks.bench_ising import IsingModel, setup
import time
if __name__ == '__main__':
t = time.time()
setup()
im = IsingModel()
print('compile', time.time()-t)
t = time.time()
im.time_ising()
@yoshipon
yoshipon / torch_vs_cupy.ipynb
Created December 30, 2022 13:07
torch.linalg.inv
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.