Home Artificial Intelligence Mojo: The Programming Language for AI That Is Up To 35000x Faster Than Python

Mojo: The Programming Language for AI That Is Up To 35000x Faster Than Python

0
Mojo: The Programming Language for AI That Is Up To 35000x Faster Than Python

Image created with Midjourney

A latest programming language for AI developers was just released: Mojo.

I do know what you is perhaps considering — a latest programming language to learn from scratch … Well, I actually have excellent news, Mojo is designed as a superset of Python, so in the event you already know Python learning Mojo shouldn’t be hard.

But that’s not all. Mojo combines the usability of Python with the performance of C obtaining a speed that’s as much as 35000x faster than Python.

In the event you’re into AI and already know Python, Mojo is certainly value a try. Here’s all the pieces you might want to find out about Mojo.

Why do we’d like Mojo if we have already got Python?

Python’s simplicity and flexibility made it the language of alternative in fields akin to data science, machine learning, and AI. It has tons of packages which are very useful for anyone working with data, but for libraries that require great performance, Python only acts as a glue layer and low-level bindings to C, C++, and other languages with higher performance.

This enabled the event of libraries akin to numpy and TensorFlow. Nevertheless, this comes with a drawback: constructing these libraries may be very complicated, it requires a low-level understanding of the internals of CPython, requires knowledge of C/C++, etc.

Based on the Mojo doc, the problems brought by Python go deeper and particularly impact the AI field.

Python alone isn’t capable of address all the problems that applied AI systems need and that’s how Mojo was born. Mojo is a programming language that mixes the usability of Python with the performance of C.

The perfect of each worlds!

But Mojo isn’t a random project that emerged out of nowhere. In truth, Mojo comes from an organization named Modular, co-founded by Chris Lattner, the identical guy who created the Swift programming language and LLVM.

That’s why I believe this project is value listening to. Now let’s see a few of Mojo’s best features.

Features of Mojo

Mojo comes with many interesting features out of the box. Listed below are a few of them.

1. Mojo is designed as a superset of Python

Mojo goals to be fully compatible with the Python ecosystem.

Which means that you would easily work with Mojo in the event you’re a Python programmer because each programming languages have many functions, features, and libraries in common.

Libraries akin to numpy, pandas, and matplotlib are also available in Mojo. Here’s the way you’d make a plot with matplotlib using Mojo.

Screenshot: Mojo

That said, Mojo remains to be in a really early stage, so it still misses many features of Python (for instance it doesn’t support classes yet).

Hopefully, in future updates Mojo shall be fully compatible with Python.

2. Strong type checking

Mojo leverage types for higher performance and error checking.

Screenshot: Mojo

Although you’ll be able to still use flexible types like with Python, Mojo enables you to use strict type-checking. This could make your code more predictable, manageable, and secure.

3. Memory ownership and borrowing checker

Mojo supports a owned argument convention that’s used for functions that need to take exclusive ownership over a price.

Screenshot: Mojo

It will show you how to make the most of memory safety without the rough edges.

4. Auto-tuning

Mojo has built-in autotuning that helps mechanically find the most effective values to your parameters to make the most of goal hardware.

Screenshot: Mojo

5. Mojo leverages MLIR

Through the use of the complete power of Multi-Level Intermediate Representation (MLIR), Mojo developers can make the most of vectors, threads, and AI hardware units.

This helps Mojo achieve great performance because, unlike Python which works with single-threaded execution, Mojo can work with parallel processing across multiple cores.

Screenshot: Mojo

That’s certainly one of the the reason why Mojo it’s 35000x faster than Python.

Screenshot: Mojo

Methods to start using Mojo

Mojo remains to be a piece in progress, but you’ll be able to try it today on the JupyterHub-based Playground. To try Mojo go to this website to register and don’t forget to examine the Mojo box within the “Modular Product Interest” section.

Glad coding!

LEAVE A REPLY

Please enter your comment!
Please enter your name here