Home DEVELOPER NumPy 2.0 with hardware acceleration, stricter API, and string functions

NumPy 2.0 with hardware acceleration, stricter API, and string functions

0


NumPy, the mathematical library for Python, has had its first major release since 2006 with version 2.0.0. It not only provides new functions but also performance improvements for Intel and Mac environments. Due to some breaking changes, it is not fully backwards compatible, so rules in the Python and C APIs were changed and many objects were omitted.

Advertisement


The new version has 11 months of work from 212 contributors with more than 1078 pulls. Several new functions have been released: there is a new data type element with variable length for string operations, numpy.dtypes.StringDTypeand namespaces numpy.strings High-performance universal functions. Data types float32 And longdouble can now be shared with everyone numpy.fft-use functions. and this numpy-Namespaces now supports the Array API.

Many changes are also related to the API. Python API version 2.0 has a strict separation between private and public APIs through a new model structure. Each public function is assigned a specific location. The team also removed many obsolete objects and aliases, about ten percent in the main namespace and even eighty percent in numpy.lib. “This will make NumPy easier to learn and use,” the contributors wrote.

Update of POSIX standard 1003.1-2024 with new tools and functions

The C API also had to give up. Functions and macros were removed or hidden “to simplify future extensibility.”

One focus of the work on the new release was on the speed of calculations. Uses NumPy for sorting (sort, argsort, partition, argpartition) Now hardware accelerated, with Intel’s sorting commands for SIMD x86 extensions on the one hand and Google Highway on the other. This means it gets “large (hardware-specific) speed-ups”. Even on Macs (>=14) it will probably be up to three times faster: NumPy 2.0 provides accelerated wheels for linear algebra.

To always keep an eye on performance, NumPy 2.0 has a tracing interface, numpy.lib.introspect.opt_func_infoWhich can be used to determine which hardware cores are available.

In detail, the team has included a number of other changes, for example the behavior of type expansion has been improved (with NEP 50), so that there are fewer confusing error messages. An overview of all the innovations can be found in release notes and on GitHub Page. due to breaking changes, Reading the Migration Guide Recommended, or downstream information for downstream packages Adjust often Sure. The next version is here since 2.1.dev0 is already ready,


(Who)

On the home page

AI Navigator #4: Phoenix from the ashes — AI needs a long-term perspective

NO COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Exit mobile version