www.modular.com Open in urlscan Pro
63.35.51.142  Public Scan

URL: https://www.modular.com/max/mojo
Submission: On April 04 via manual from PH — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

Max Platform

NEW


MAX Platform


Learn more

Platform

MAX Engine

MAX Serving

Mojo
Docs



Docs


Learn more

Docs Home

MAX Engine Docs

MAX Serving Docs

Mojo Docs
Company



About


Learn more

Vision

Newsletter

Culture

ModCon

Contact

Careers
Blog

Sales

LoginSign Up

Get StartedSign In
Menu
MAX Platform

Mojo


MOJO 🔥 — THE PROGRAMMING LANGUAGE FOR ALL AI DEVELOPERS

Mojo combines the usability of Python with the performance of C, unlocking
unparalleled programmability of AI hardware and extensibility of AI models.


Available on Mac 🍎, Linux, and Windows (WSL)


Install Mojo🔥

Read the docs




JOIN THE MODVERSE

175K+ Developers

50K+ Enterprises



22K+ Members



17K+ stars



9K+ subscribers

Over 300 open-source projects created by the community


LLAMA2.MOJO

Inference forLlama2 models in a single file of Mojo 🔥

Github


VOODOO

A machine learning framework in pure Mojo 🔥

Github


LIGHTBUG HTTP

Simple and fast HTTP framework for Mojo 🔥

Github
More community awesomeness



MOJO OUT-PERFORMS

01
Usability & Programmability


WRITE EVERYTHING IN ONE LANGUAGE

Write Python or scale all the way down to the metal. Program the multitude of
low-level AI hardware. No C++ or CUDA required.

Take a tour of Mojo
FILE_NAME.🔥

def sort(v: ArraySlice[Int]):
  for i in range(len(v)):
    for j in range(len(v) - i - 1):
      if v[j] > v[j + 1]:
        swap(v[j], v[j + 1])

FILE_NAME.🔥

struct MyPair:
  var first: Int
  var second: F32
  
  def __init__(self, first: Int, second: F32):
    self.first = first
    self.second = second

FILE_NAME.🔥

def reorder_and_process(owned x: HugeArray):
  sort(x)	# Update in place
  
  give_away(x^)	# Transfer ownership
  
  print(x[0])	# Error: ‘x’ moved away!

FILE_NAME.🔥

def exp[dt: DType, elts: Int]
    (x: SIMD[dt, elts]) -> SIMD[dt, elts]:
  x = clamp(x, -88.3762626647, 88.37626266)
  k = floor(x * INV_LN2 + 0.5)
  r = k * NEG_LN2 + x
  return ldexp(_exp_taylor(r), k)

FILE_NAME.🔥

def exp_buffer[dt: DType](data: ArraySlice[dt]):

  # Search for the best vector length
  alias vector_len = autotune(1, 4, 8, 16, 32)
  
  # Use it as the vectorization length
  vectorize[exp[dt, vector_len]](data)



Features include:


PROGRESSIVE TYPES

Leverage types for better performance and error checking.




ZERO COST ABSTRACTIONS

Take control of storage by inline-allocating values into structures.




OWNERSHIP + BORROW CHECKER

Take advantage of memory safety without the rough edges.




PORTABLE PARAMETRIC ALGORITHMS

Leverage compile-time meta-programming to write hardware-agnostic algorithms and
reduce boilerplate.




LANGUAGE INTEGRATED AUTO-TUNING

Automatically find the best values for your parameters to take advantage of
target hardware.


As well as:

The full power of MLIR

Parallel heterogenous runtime

Fast compile times

FILE_NAME.🔥

def sort(v: ArraySlice[Int]):
  for i in range(len(v)):
    for j in range(len(v) - i - 1):
      if v[j] > v[j + 1]:
        swap(v[j], v[j + 1])



Features include:


PROGRESSIVE TYPES

Leverage types for better performance and error checking.


FILE_NAME.🔥

struct MyPair:
  var first: Int
  var second: F32
  
  def __init__(self, first: Int, second: F32):
    self.first = first
    self.second = second



Features include:


ZERO COST ABSTRACTIONS

Take control of storage by inline-allocating values into structures.


FILE_NAME.🔥

def reorder_and_process(owned x: HugeArray):
  sort(x)	# Update in place
  
  give_away(x^)	# Transfer ownership
  
  print(x[0])	# Error: ‘x’ moved away!



Features include:


OWNERSHIP + BORROW CHECKER

Take advantage of memory safety without the rough edges.


FILE_NAME.🔥

def exp[dt: DType, elts: Int]
    (x: SIMD[dt, elts]) -> SIMD[dt, elts]:
  x = clamp(x, -88.3762626647, 88.37626266)
  k = floor(x * INV_LN2 + 0.5)
  r = k * NEG_LN2 + x
  return ldexp(_exp_taylor(r), k)



Features include:


PORTABLE PARAMETRIC ALGORITHMS

Leverage compile-time meta-programming to write hardware-agnostic algorithms and
reduce boilerplate.


FILE_NAME.🔥

def exp_buffer[dt: DType](data: ArraySlice[dt]):

  # Search for the best vector length
  alias vector_len = autotune(1, 4, 8, 16, 32)
  
  # Use it as the vectorization length
  vectorize[exp[dt, vector_len]](data)



Features include:


LANGUAGE INTEGRATED AUTO-TUNING

Automatically find the best values for your parameters to take advantage of
target hardware.



02
Performance


UNLOCK PYTHON PERFORMANCE

Utilize the full power of the hardware, including multiple cores, vector units,
and exotic accelerator units, with the world's most advanced compiler and
heterogenous runtime. Achieve performance on par with C++ and CUDA without the
complexity.

Play with Mojo


PARALLELIZATION

Mojo leverages MLIR, which enables Mojo developers to take advantage of vectors,
threads, and AI hardware units.


PYTHON

Single-threaded execution


MOJO 🔥

Parallel processing across multiple cores

Languages
Time (S) *
Speedup vs Python
Python 3.10.9
970 s
1x
Numpy
171 s
6x
Scalar C++
0.11 s
9000x
Mojo 🔥
0.0142 s
68000x
* Algorithm
Mandelbrot
Instance
AWS h3-standard-88
Intel Xeon
MoreRead the 68,000x Blog
03
Interoperability


ACCESS THE ENTIRE PYTHON ECOSYSTEM

Experience true interoperability with the Python ecosystem. Seamlessly intermix
arbitrary libraries like Numpy and Matplotlib and your custom code with Mojo.

Read the programming manual
MAKE_PLOT.🔥

def make_plot(m: Matrix):
  plt = Python.import_module("matplotlib.pyplot")
  fig = plt.figure(1, [10, 10 * yn // xn], 64)
  ax = fig.add_axes([0.0, 0.0, 1.0, 1.0], False, 1)
  plt.imshow(image)
  plt.show()

make_plot(compute_mandelbrot())


Mojo 🔥

04
Extensibility


UPGRADE YOUR MODELS AND THE MODULAR STACK

Easily extend your models with pre and post-processing operations, or replace
operations with custom ones. Take advantage of kernel fusion, graph rewrites,
shape functions, and more.

Model extensibility

Mojo can upgrade the existing operations in your model.


Input layer
Hidden layers
Output layer
max platform


MOJO 🔥 WORKS WITH 
ALL THE REST OF THE SUITE

Modular MAX Engine can be used in combination with our integrations via MAX
Serving services and it is powered by Mojo 🔥 the fastest and most portable
programming language for your AI applications.

Our engine integrates with the rest of our suite of MAX products, while being
usable on its own.

Explore all the MAX Platform

05
GET STARTED NOW


DOWNLOAD MOJO 🔥 AND CONTRIBUTE TO IT NOW

Mojo is still a work in progress, but it's available to try today via our Mojo
SDK. Run through tutorials and write your own Mojo code.

Download now
Mojo 🔥


01.

EASY TO GET STARTED

Get the Mojo 🔥 SDK today and get started with our example code on GitHub.


02.

Unleash your mojo

Our docs will help you quickly discover why Mojo is such a powerful extension to
Python, and the future of AI programming.


03.

JOIN the mojo COMMUNITY

Come and chat with us on our Discord, and help shape the future of the language
as we continue to develop it.





READY TO PLAY WITH MOJO?

Sign up & download the Mojo SDK right now.

Get started
API Reference, Tutorials, & More

Read the Mojo docs






MAX Platform

MAX Engine 🏎️

MAX Serving ⚡️

Mojo 🔥

Sign Up

Blog

Careers

Report an issue


Copyright ©

2024

Modular Inc

Terms

,
Privacy

&
Acceptable Use

Please accept our cookies
We use cookies to track visitor traffic so we can learn to improve the website
and documentation. Read more
AcceptReject

Cookie preferences

Cookie usage
The Modular Docs website uses browser cookies only to track website traffic with
Google Analytics. For more details about how we handle sensitive data, please
read our privacy policy.
Google Analytics cookiesGoogle Analytics cookies
These cookies track website usage and are unique to this website.

NameDomainExpirationDescription^_gagoogle.com2 yearsGoogle Analytics

Accept allReject allSave settings