Skip to content

Instantly share code, notes, and snippets.

View rgommers's full-sized avatar

Ralf Gommers rgommers

View GitHub Profile
@rgommers
rgommers / f2py_callback_gees_user_routines.c
Created July 17, 2024 19:54
f2py snippet for a LAPACK function with a callback
/******************* See f2py2e/cb_rules.py: buildcallback *******************/
/********************* cb_cselect_in_gees__user__routines *********************/
typedef struct {
PyObject *capi;
PyTupleObject *args_capi;
int nofargs;
jmp_buf jmpbuf;
} cb_cselect_in_gees__user__routines_t;
@rgommers
rgommers / list_torchdata_deps.txt
Created July 2, 2024 08:18
torchdata dependencies (July 2024)
$ # For top-level dependencies, see the conda-forge metadata browser:
$ # https://conda-metadata-app.streamlit.app/?q=conda-forge%2Flinux-64%2Ftorchdata-0.7.1-py39h02e9b37_5.conda
$ mamba create -n torchdata torchdata # on macOS arm64
$ mamba activate torchdata
$ mamba repoquery depends torchdata
Executing the query torchdata
@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: