Description
Title
Writing array-library-agnostic code using the Python array API standard (with a hint of cosmology)
Describe your Talk
Over the years, the lack of an array data type in Python has resulted in the creation of numerous array libraries, each specializing in unique niches but still having some interoperability between each other. NumPy has become the de facto array library of Python, and the other array libraries try to keep their API close to that of NumPy. However, this often becomes infeasible, and the libraries deviate out of necessity. To make Python's array libraries shake hands with each other without any inconsistencies, the Consortium for Python Data API Standards has formalized an Array API standard for libraries offering array creation and manipulation operations.
A user usually finds it trivial to choose an array library (based on the suggestions on the internet forums), but things get out of hand once they start exploring use cases that they had not thought about initially. For instance, a user might attempt to make their NumPy code differentiable but hit a blocker when they realize their functions do not work with the arrays of an automatic-differentiable library such as JAX. Similarly, specific applications require CPU and GPU support; hence, the code written should be able to work with both CPU and GPU arrays. The Array API standard allows users to write and use the same code for arrays belonging to any of the standard-conforming libraries.
Through this talk, we will explore the need for such standardization and discuss its salient features in detail. We will further delve into several real-life examples of large and relatively small libraries that have migrated their codebases to adopt this standard. These examples will be sourced from my experience working with and on multiple Python array libraries for scientific computing (mostly cosmology and particle physics). Ultimately, the audience can expect to leave the room with the knowledge to write device-agnostic and array-library-agnostic code for their use cases.
Pre-requisites & reading material
- familiarity with NumPy
- a rough idea of Python's array ecosystem might be beneficial
- some scientific curiosity is appreciated
Resources
No response
Time required for the talk
30 minutes; I can add more content if people want a 45-60 minute talk; cannot be a lightning talk
Link to slides/demos
No response
About you
Yearly pilgrimage to India and Delhi means yearly pilgrimage to a PyDelhi event :)
Previous talks at PyDelhi:
- Python packaging: from stone age to the future #215
- The scientific side of Python and Open-Source: using Python for High Energy Physics at CERN #275
I am a research software engineer at University College London's Centre for Advanced Research Computing, where I am partly funded by grants from the Edinburgh Parallel Computing Centre and the UK Space Agency to work on GLASS, a cosmology library for full-universe simulations.
Before UCL, I was based at CERN (European Organisation for Nuclear Research), where my work revolved around high-performance+scientific computing in Python and computational high-energy physics. Before CERN, I was a B.Tech (IT and Maths) student at the University of Delhi.
See my website for a more detailed profile.
Availability
August 2025
Any comments
Strictly not available before and after August :(
My availability will become more clear with time, but I will most probably make it to the August event. As always, opening this issue in advance to secure a spot.