Skip to content

Instantly share code, notes, and snippets.

View rgommers's full-sized avatar

Ralf Gommers rgommers

View GitHub Profile
@rgommers
rgommers / blas_lapack_meson_notes.md
Last active October 13, 2023 18:08
Notes on BLAS/LAPACK library details and conventions

Conda-forge library names and pkg-config output

@rgommers
rgommers / spack-scipy-oneapi-build.log
Created October 13, 2022 13:26
A build for SciPy 1.8.1 with oneAPI compilers (with a build failure)
==> py-scipy: Executing phase: 'install'
==> [2022-10-13-12:45:50.325962] '/home/rgommers/code/spack/opt/spack/linux-endeavourosrolling-skylake_avx512/oneapi-2022.2.0/python-3.9.13-mn4ovd4dkbyg62orinqikrnvaxq6r5tf/bin/python3.9' '-m' 'pip' '-vvv' '--no-input' '--no-cache-dir' '--disable-pip-version-check' 'install' '--no-deps' '--ignore-installed' '--no-build-isolation' '--no-warn-script-location' '--no-index' '--prefix=/home/rgommers/code/spack/opt/spack/linux-endeavourosrolling-skylake_avx512/oneapi-2022.2.0/py-scipy-1.8.1-ww5y2ruckqwn44vypo4e7yl3yzmxiwsh' '.'
Using pip 22.2.2 from /home/rgommers/code/spack/opt/spack/linux-endeavourosrolling-skylake_avx512/oneapi-2022.2.0/py-pip-22.2.2-42kbxmhhxyigyp2224oarapc3o5xxpga/lib/python3.9/site-packages/pip (python 3.9)
Non-user install due to --prefix or --target option
Ignoring indexes: https://pypi.org/simple
Created temporary directory: /tmp/pip-ephem-wheel-cache-vju1m2iu
Created temporary directory: /tmp/pip-build-tracker-h5l54x96
Initialized build tracking at
@rgommers
rgommers / jax_numpy_random_apis.py
Created June 1, 2022 17:40
Comparing JAX and NumPy APIs for random number generation - serial and parallel
"""
Implement `jax.random` APIs with NumPy, and `numpy.random` APIs with JAX.
The purpose of this is to be able to compare APIs more easily, and clarify
where they are and aren't similar.
"""
import secrets
import multiprocessing
import numpy as np
To create an environment with the most recent version of all mainstream Python array/tensor libraries installed:
conda create -n many-libs python=3.7
conda activate many-libs
conda install cudatoolkit=10.2
pip install numpy torch jax jaxlib tensorflow mxnet cupy-cuda102 dask toolz sparse
Conda doesn't manage to find a winning combination here; pip has a hard time
too and probably not all constraints are satisfied, but nothing crashes
and basic tests work as they are supposed to.
==> 2018-03-06 17:49:03 <==
# cmd: /home/rgommers/anaconda3/bin/conda install pytorch torchvision -c pytorch --no-deps
+defaults::_ipyw_jlab_nb_ext_conf-0.1.0-py36he11e457_0
+defaults::alabaster-0.7.10-py36h306e16b_0
+defaults::anaconda-5.1.0-py36_2
+defaults::anaconda-client-1.6.9-py36_0
+defaults::anaconda-navigator-1.7.0-py36_0
+defaults::anaconda-project-0.8.2-py36h44fb852_0
+defaults::asn1crypto-0.24.0-py36_0
+defaults::astroid-1.6.1-py36_0
# scipy
time python setup.py build
real 16m52.989s
user 8m37.808s
sys 0m10.156s
time python setup.py build -j2
real 13m27.485s
@rgommers
rgommers / autograd_specialfuncs.py
Last active June 28, 2017 09:50
A test of autograd for automatic differentiation of scipy.special functions
import numpy as np
import matplotlib.pyplot as plt
from autograd import grad
import autograd.scipy.special as special
plt.style.use('ggplot')
x = np.linspace(-10, 10, num=1000)

Keybase proof

I hereby claim:

  • I am rgommers on github.
  • I am rgommers (https://keybase.io/rgommers) on keybase.
  • I have a public key whose fingerprint is BFE9 5DF1 9868 9E30 AFF4 A1CD EDBE A378 BF1A 5EBD

To claim this, I am signing this object:

@rgommers
rgommers / gist:bca29ea209e7714848c5884b88d338bb
Created June 21, 2017 06:41
Timing results for scipy test suite
Output of ``scipy.test('full', timer=250)`` against numpy master with scipy version ``1.0.0.dev0+d88eb06``.
[success] 1.90% test_kdeoth.test_kde_2d: 10.5936s
[success] 1.89% test_mpmath.TestSystematic.test_betainc: 10.5385s
[success] 1.86% test_linsolve.TestSpsolveTriangular.test_random: 10.3594s
[success] 1.74% test_cdflib.TestCDFlib.test_chndtrix: 9.7304s
[success] 1.67% test_mpmath.TestSystematic.test_bessely_complex: 9.3187s
[success] 1.58% test_circular_imports.test_importing_submodules: 8.8049s
[success] 1.51% test_basic.TestSolve.test_all_type_size_routine_combinations: 8.4452s
@rgommers
rgommers / gist:b06981f89fb67eb6c1e643cab565419d
Created March 26, 2017 03:19
scikit-image test suite for edd5fe4 on 32-bit Python
With numpy 1.12.1 and scipy master.
$ python -c "import skimage; skimage.test()"
.................................................................................................................................................................................................................................../home/rgommers/Code/scikit-image/skimage/transform/_warps.py:84: UserWarning: The default mode, 'constant', will be changed to 'reflect' in skimage 0.15.
warn("The default mode, 'constant', will be changed to 'reflect' in "
......../home/rgommers/Code/scikit-image/skimage/feature/corner.py:373: RuntimeWarning: divide by zero encountered in divide
return (2.0 / np.pi) * np.arctan((l2 + l1) / (l2 - l1))
/home/rgommers/Code/scikit-image/skimage/feature/corner.py:373: RuntimeWarning: invalid value encountered in divide
return (2.0 / np.pi) * np.arctan((l2 + l1) / (l2 - l1))