CUDA is one of a few different GPU languages. You also have the Chinese chips which have their own language too as far as I'm aware so Mojo's proposition is to use one language i.e. Mojo across any hardware WITHOUT vendor lock-in so you're not juggling multiple languages and multiple compilers and also not locked into an ecosystem.
Plus it's fully Python compatible so instead of throwing away or translating Python scripts you cam use them in Mojo AND Mojo has C/C++ speed with some of Rust and Zig's comptime safety.
It’s not Python-compatible, they gave up on that (because it was never possible, you literally just can’t make Python fast without breaking the whole ecosystem).
Literally scroll down on their home page and I quote:
"Python interop
Mojo meets developers where they are. Import Python libraries, accelerate performance-critical paths, and move gradually from prototypes to production systems without rewriting everything at once."
That's not the same as Python compatibility; it's Python interoperability, the ability to ask Python to run Python code. This is famously a feature of almost every programming language: Python is popular since it has bindings to everything.
The previous claim they made was they'd have Python compatibility (a Python superset), i.e. you could drop your Python code into Mojo and still have it run. They seem to have given up on that, since it would make it basically impossible to meaningfully optimize the language.
Then interop directly in a Mojo .mojo file in the same repo and you do not need to write any special FFI, ABI declarations, ctypes, cffi, pybind11, or similar boilerplate yourself:
```
from std.python import Python
def main() raises:
Python.add_to_path(".") # or a specific path
var mypython = Python.import_module("mypython")
var values = mypython.gen_random_values(2, 3)
print(values)
```
11
u/Hornstinger 14d ago
CUDA is one of a few different GPU languages. You also have the Chinese chips which have their own language too as far as I'm aware so Mojo's proposition is to use one language i.e. Mojo across any hardware WITHOUT vendor lock-in so you're not juggling multiple languages and multiple compilers and also not locked into an ecosystem.
Plus it's fully Python compatible so instead of throwing away or translating Python scripts you cam use them in Mojo AND Mojo has C/C++ speed with some of Rust and Zig's comptime safety.