Mojo is now available on Mac
modular.com
modular.com
From Chris Lattner when asked about the date that will happen:
I would tell you if I knew . Our priority is to build the "right thing" not build a demo and get stuck with the wrong thing. My wild guess is that the language will be very usable for a lot of things in 18 months, but don't hold me to that.
It WILL be open-sourced, because Modular on its own isn't big enough to build the whole ecosystem.
They do very much claim to plan. There's a bit of difference.
Sometimes it’s okay to trust people in this space. To me, this is one of those times.
That’s how SQLite operates and it works well.
An analogy would be that you don’t believe in human rights if only 10% of your business operations violate them.
Software freedoms are important. Don’t release proprietary software. Doing so is bad and makes the world worse.
Releasing it closed source allows them to point to something that justifies further fund raising and allowing them to control the direction of development while getting user feedback.
This isn't some esoteric language where if mojo vanished you'd lose your whole project and have to rewrite it into something else. It's python with some syntax sprinkled on top, so vendor lockin isn't a huge concern.
Also, I am not an absolutist where free software is concerned. It doesn't make the world worse to release proprietary software. Especially if you have the stated goal of eventually open sourcing it.
Python 4.216 GFLOPS
Naive: 6.400 GFLOPS 1.52x faster than Python
Vectorized: 22.232 GFLOPS 5.27x faster than Python
Parallelized: 52.591 GFLOPS 12.47x faster than Python
Tiled: 60.888 GFLOPS 14.44x faster than Python
Unrolled: 62.514 GFLOPS 14.83x faster than Python
Accumulated: 506.209 GFLOPS 120.07x faster than Python* For context I do have done some experience experimenting on the gcc/intel compiler options that are available for linear algebra, and even outside of BLAS, compiling with -o3 -ffast-math -funroll-loops etc does a lot of that, and for simple loops as in matrix vector multiplication, compilers can easily vectorize. I'm very curious if there is something I don't know about that will result in a speedup. See e.g. https://gist.github.com/rbitr/3b86154f78a0f0832e8bd171615236... for some basic playing around
I'm not sure where/how they'd be squeezing out more performance unless its better compilation/compatibility with Apple Silicon intrinsics.
Edit: ..Is Mojo using more than 1 core? I'm not sure I understand their syntax and if they are parallel constructs.
Edit2: Yeah Mojo seems to be parallelizing, so the comparison really isn't fair. The np.config posted elsewhere shows that OpenBLAS is only compiled with MAX_THREADS=3 support, and its not clear what their OPENBLAS_NUM_THREADS/OPENMP_NUM_THREADS was set to at runtime.
Python 119.189 GFLOPS
Naive: 6.275 GFLOPS 0.05x faster than Python
Vectorized: 22.259 GFLOPS 0.19x faster than Python
Parallelized: 50.258 GFLOPS 0.42x faster than Python
Tiled: 59.692 GFLOPS 0.50x faster than Python
Unrolled: 62.165 GFLOPS 0.52x faster than Python
Accumulated: 565.240 GFLOPS 4.74x faster than Python
np.__config__: Build Dependencies:
blas:
detection method: pkgconfig
found: true
include directory: /opt/arm64-builds/include
lib directory: /opt/arm64-builds/lib
name: openblas64
openblas configuration: USE_64BITINT=1 DYNAMIC_ARCH=1 DYNAMIC_OLDER= NO_CBLAS=
NO_LAPACK= NO_LAPACKE= NO_AFFINITY=1 USE_OPENMP= SANDYBRIDGE MAX_THREADS=3
pc file directory: /usr/local/lib/pkgconfig
version: 0.3.23.dev
lapack:
detection method: internal
found: true
include directory: unknown
lib directory: unknown
name: dep4364960240
openblas configuration: unknown
pc file directory: unknown
version: 1.26.1
Compilers:
c:
commands: cc
linker: ld64
name: clang
version: 14.0.0
c++:
commands: c++
linker: ld64
name: clang
version: 14.0.0
cython:
commands: cython
linker: cython
name: cython
version: 3.0.3
Machine Information:
build:
cpu: aarch64
endian: little
family: aarch64
system: darwin
host:
cpu: aarch64
endian: little
family: aarch64
system: darwin
Python Information:
path: /private/var/folders/76/zy5ktkns50v6gt5g8r0sf6sc0000gn/T/cibw-run-27utctq_/cp310-macosx_arm64/build/venv/bin/python
version: '3.10'
SIMD Extensions:
baseline:
- NEON
- NEON_FP16
- NEON_VFPV4
- ASIMD
found:
- ASIMDHP
not found:
- ASIMDFHMBecause it's slow as dirt right? Isn't the point that they are trying to make is that one could with Mojo?
[1] https://github.com/modularml/mojo/blob/5ce18c47a27c0c4123de1...
In a single-threaded comparison to numpy (or just measuring total throughput -- many applications have lots of slightly smaller matmuls they can do which make it trivially to parallelize without having to parallelize each matmul, and throughput increases slightly when you do so) though, the details start to matter. Numpy is bad with small dimensions (hasn't optimized for them at all really, and overhead moving data from a Python context to a Numpy context starts to dominate), and performance can vary 10-50x just based on whether you've set up an optimized BLAS library for it to link to or not. Mojo side-steps some of that because it provides the fast primitives you need in the language itself and doesn't present the opportunity to execute more slowly. Single-core Mojo shouldn't be meaningfully faster than a properly installed single-core Numpy on large matmuls, and the given implementation should be meaningfully slower on large enough problems.
I don't really care for the benchmark though. It's potentially okay at showing how easy it can be to write fast code, but it comes across as being presented to show how much faster mojo is than Python. That latter is misleading for at least a couple reasons:
- By some magic, my $300 old dev laptop (swift 3) is 6x faster than their brand new m2 pro max with a vanilla Python triple for loop. Is Mojo adding some overhead as it runs that benchmark? Is something wrong with their Python installation?
- Many of the optimizations they applied in Mojo apply just as well in vanilla Python. Tiling, parallelization, ... Some of those have a higher ratio of improvement in Python than Mojo (depending on some fiddly GC details) because their purpose is to cut back on cache/page/... misses enough to make the problem compute-bound rather than IO-bound, and the Python representation takes enough extra space that the benefits accumulate faster. The serialization overhead for stdlib parallelization is dwarfed by the matmul cost, so it doesn't wind up mattering much that you have slow copies all over the place, and you really do find yourself bound by the interpreters rate of interpreting.
Like, it's still faster than Vanilla Python by a lot, and it's neat that the code is so easy to write, but 90k isn't the speedup I'd headline with.
To be fair, I think their point is just that you can write fast code easily in Mojo, and matmul is something easy to understand, so it makes a good case study. The optimization primitives are fairly intuitive, so presumably you should be able to apply the same naive approach (code it, slap on optimization primitives) and get decent speedups in less well studied domains.
Some of the issues I pointed out there are pretty low hanging fruit for LLVM, so they may have improved a lot in more current releases.
I have had some frustration with Mojo in that their standard libraries, as far as I have found, lack a lot of general programming support, like file I/O, etc. Are we meant to import the Python package and just use that?
That said, I love the idea of Mojo.
I'd like to know how fast numpy is here, but they didn't compare... which is weird because that's what almost everyone would use.
If you ask your average Python programmer what “pure Python” means they’d think numpy is included.
Their Mojo code just does the same optimizations numpy certainly has.
There's also the issue of doing complicated work with NumPy and you start looping and revert back to slow (pure) Python because you are crossing the NumPy/ Python interface. Tools like Cython, Numba, and probably Mojo help to solve this.
But nobody doing any significant numeric work would ever consider a "pure" python matrix multiply meaningful. It's disingenuous to present that as your comparison, at least without also including the way it's actually done in practice.
Honestly, it undermines their presentation with anyone involved in the area.
It's like claiming that your code is faster than MATLAB's for loops. Why write gemm yourself?
Even if this language is a good idea, I worry that they don't seem to understand the audience.
Not too dissimilar to Swift, which was launched as being faster than C/C++.
I don't know about mojo, but they seem to import python module for this benchmark. https://github.com/modularml/mojo/blob/5ce18c47a27c0c4123de1...
And for some reason they don't compare against NumPy https://github.com/modularml/mojo/blob/5ce18c47a27c0c4123de1...
What would be more interesting is to use NumPy and do the vectorized opreations.
I think that mojo in it's current form is not on par with numpy performance (if it was they would be saying that). Even if the performance is same I would still give it a try. Their whole marketing though is making me reconsider
Mojo is python syntax first where they want to be proper superset, which gives them access to wide python ecosystem and community. If executed well, this alone can absorb community similarly to how ie. typescript absorbed javascript community. Also similar thing happened with objective-c -> swift - also led by Chris, which gives a lot of credibility to the whole initiative.
Julia is proper new language you need to learn, use new tooling around it, ecosystem is quite academia skewed, ie. writing web services is probably not the best idea etc.
Additionally Julia suffers from "time to first plot" problem, which alienates a lot of newcomers who are not familiar or simply don't want to switch to programming mode where it becomes less of a problem (repl/notebook style where runtime is always active).
Both are very interesting languages, but mojo's starting point and trajectory seem to be at different level, ie. adoption may be very sharp.
[1] https://github.com/modularml/mojo/blob/5ce18c47a27c0c4123de1...
Python 4.216 GFLOPS
Naive: 6.400 GFLOPS 1.52x faster than Python
Vectorized: 22.232 GFLOPS 5.27x faster than Python
Parallelized: 52.591 GFLOPS 12.47x faster than Python
Tiled: 60.888 GFLOPS 14.44x faster than Python
Unrolled: 62.514 GFLOPS 14.83x faster than Python
Accumulated: 506.209 GFLOPS 120.07x faster than PythonThis is a blocker for me to ever adopt this as more than a toy language. These days, if I can't use Nix to build + deploy the whole set of requirements (I'm fine building out the packages themselves), it's basically a non-starter!
I know they are claiming that it will eventually be open-sourced. Just a bit sad that there's no timeline on that
And the idea that you will do everything with a conda package at every point is laughable. You need a compilable language, where code can be ported over from Python very rapidly, and where ML/AI tools such as differentiability is a first class citizen. That language doesn't really exist today, but multiple billions of actual industrial applications need it.
In fact, what the negativity shows here is how skewed Hacker News is towards the bit folks, and how little they talk to the atoms side of things.
Or rather what it will become once the VCs who are paying for all this start the squeeze.
I'd be nervous about getting in too deep with tools from a company with what looks to me like an utterly unsustainable business model. The house of card will have to come down, won't it? You don't want your stuff to go down with it.
IDK, been wrong before, could be here too. It's disconcerting, though.
1) Have a compelling enough product to become an essential tool in data-focused workflows across the massive Python ecosystem.
2) Get acquired by someone interested in a deeply wedged stake across the massive Python ecosystem.
At that point, it doesn’t matter if they’re open source or not.
How do we know that squeeze isn’t already happening?
The mojo launch was extremely underwhelming, and I wonder if it was forced by early investors to help drive hype and the next round of funding.
* https://github.com/Bears-R-Us/arkouda * https://twitter.com/ChapelLanguage/status/168858897773200179...
I'd rather use Python if I'm in the Python ecosystem. So many attempts were made in the past to make a new language compatible with the Python ecosystem (look up hylang and coconu -- https://github.com/evhub/coconut). But at the end of the day, I'd come back to Python because if there's one thing I've learnt in recent years it's this:
minimize dependencies at all costs.Chapel is also just one of many other projects broadly interested in developing new programming languages for "high performance" programming. Out of that large field, Chapel is not especially related to the specific ideas or design goals of Mojo. Much more related are things like Codon (https://exaloop.io), and the metaprogramming models in Terra (https://terralang.org), Nim (https://nim-lang.org), and Zig (https://ziglang.org).
But Chapel is great! It has a lot of good ideas, especially for distributed-memory programming, which is its historical focus. It is more related to Legion (https://legion.stanford.edu, https://regent-lang.org), parallel & distributed Fortran, ZPL, etc.
Likewise most seats from Kotlin Foundation are from JetBrains and Google.
Nit: it's worth the most, or has been at times, but Apple is not a big company or organisation compared to others, and I think the number of people involved is perhaps the more useful comparison here rather than market cap. They're roughly an order of magnitude below the top end.
Mojo must have better marketing.
I keep looking into Julia and Chapel instead.
I can also buy the argument why setting up all the dev-tel infra to make an odd language project successful is a lot of work and possibly a distraction. Even though the source isn’t currently open, they’re certainly developing it in the open.
Maybe it’s a combination of a bunch of these things that’s throwing people off?
If I were on a PC I would have to ask GPT4 to summarize it for me.
How is it so difficult to write a two sentence elevator pitch that anyone outside of your bubble can understand?
If Feynman could do it, you should be able to do it too.
https://syntax.fm/show/679/creator-of-swift-tesla-autopilot-...
I would start at the jump link "12:13 is Mojo a programming language"
They also cover its plan for becoming open source (at 37:36)
Second result on google: https://docs.modular.com/mojo/why-mojo.html
Promise greatness but deliver vague closed source breadcrumbs.
But I too have a hard time trusting this.
First, because I feel that Swift has been a boondoggle that everyone was forced to accept and now it's just normal. I'm still not convinced Steve Jobs would have given Swift a go-ahead (release).
From the start, Swift felt like, as a language, that it didn't know what it wanted to say, with a big part of that coming from having just taken a kitchen sink approach to syntax and features. Looking at their same code, 4 lines of python becomes like 12+ lines. I'm not sure who this attracts.
More importantly, he clashed at Tesla. He left a gaping hole in the Swift Tensorflow stuff at Google. He also left Apple and promised that he would still be involved in Swift, until he got pushed out.
It's not that he isn't productive or brilliant, I'm just not sure I trust someone with a track record of being volatile as a great maintainer of a platform.
Overall, this appears to have the same markings of the Cappuccino web framework project.
Objective-C 2.0 was released in 2006, and Steve Jobs died in 2011.
As per Chris Lattner interviews, Objective-C 2.0 and latter improvements were the ground work to have a good interoperability story between Objective-C and the new language prototype that would be eventually be known as Swift in 2014.
Note that Apple already toyed with Java as possible Objective-C replacement, when they weren't sure if Apple folks educated in Object Pascal and C++ would be keen in adopting Objective-C, latter tried with Ruby (MacRuby) which didn't went anywhere, and the develoeprs left Apple founding RubyMotion still going on.
You can't say for a fact if he "gave it a go", and neither can I.
> As per Chris Lattner interviews, Objective-C 2.0 and latter improvements were the ground work to have a good interoperability story between Objective-C and the new language prototype that would be eventually be known as Swift in 2014.
Even if Lattner says this, it still seems as bogus to me as saying it's "objective c without the c." They're two completely different things. Swift is a language. Objective-C is a runtime on top of a language disguised to look like a language. They only say this stuff because people probably would have had a meltdown if they were blunt about what swift actually meant - foundational incompatibility. I'm sure their PR was informed by what happened with the massive amount of software that got lost during the Classic MacOS-Max OS X needs-to-be-rewritten transition.
To the point, I'm not sure what the syntax sugar they added to the 2.0 release had to do with the fact that swift still relies on message passing to access Foundation et al. MacRuby and PyObC used those same mechanisms to access the same stuff.
> Note that Apple already toyed with Java as possible Objective-C replacement, when they weren't sure if Apple folks educated in Object Pascal and C++ would be keen in adopting Objective-C
We know. Java was also just buzzyworthy to include in your OS back then.
A lot of life's bullshit is people convinced of their own bullshit.
I know I'm likely to be very wrong here... and they may easily remedy that, I hope they do because I really like the idea's they've presented.
The point of this benchmark is making it clear that things you wouldn't dream of doing with python are fine in mojo.
People use numpy because python is stupidly slow. Mojo isn't. You can still use numpy of course. But you don't have to.
If they want to show all 3: mojo, numpy, and pure python, then that might be the best of all worlds. They could brag about being 90,000x faster than python, while at the same time showing the actual slowdown of using a pure python-like language (mojo) compared to a compiled numpy library. Let's say the mojo code ends up being 0.5x as fast as numpy; that would still be a pretty great tradeoff for being able to do it all in one language. If you're a python programmer and want to do something that isn't possible with the existing compiled libraries, this would be a good sell. To me, that's still the real comparison of interest.
So is this meant to replace vanilla python matmul (which nobody uses IRL)? No? That was just a benchmark to show off their compiler tricks? Okay, how does it fare against numpy (which is actually used)? Well, it's faster? But I have to write little wrappers around basic functions like np.max to parallelize them myself? Shouldn't that just be in your std lib / invisible to the programmer? I thought it was supposed to be a drop-in speed improvement...
I don't really get it. Am I stupid? Maybe I'm stupid.
People use Python because numpy isn't slow! It works quite well for its domain.
People use numpy bc of the python ecosystem and all the domain specific libraries it is compatible with. It very fast relative to Python and provides aa stable, easy to use, array API.
It is difficult to explain but let me try. It looks like the fire is facing laptop screen, but look closely, is it really facing laptop screen or you. It is so confusing, you can never tell.
If this was actually a 3d rendering, all lines would follow the perspective from camera in a certain direction. Look at where keyboard is going. It seems to be going upwards somewhere. If you extend the top and bottom end of keyboard behind the screen, those lines won't make a correct rectangle.
Look at the yellow part of the flame just blending into red/orange near eye on the right side of image. Try following any shadows or edges of things. They are often wrong.
All of these could have easily fixed with a bit of time in photoshop/image editing software, which leads me to believe it has not been retouched at all an is a direct output from the AI. Quite impressive.
Edit: Just saw the other comments saying the same, whoops
In this case, what makes me think it's AI generated, is an inconsistent mix between a 3d style render and digital painted art. The way it's lit. And after I already suspected, I looked at the keyboard because it's usually where AI fumbles the bag.