10 ms·
Mojo is now available on Mac
- icapybara 3y agoDoes “90,000x speed up over pure python” with matrix multiplication mean vs using numpy arrays in python?
- zellyn 3y agono
- sirfz 3y agoNo It's vs a pure python implementation[1] [1] https://github.com/modularml/mojo/blob/5ce18c47a27c0c4123de1e5860f79b31d15df116/examples/pymatmul.py#L41 https://github.com/modularml/mojo/blob/5ce18c47a27c0c4123de1...
- icapybara 3y agoSeems a bit deceiving then, nobody does matrix multiplications in "pure python." They use numpy or some derivative of it.
- elashri 3y agoI think it is just pure python I don't know about mojo, but they seem to import python module for this benchmark. https://github.com/modularml/mojo/blob/5ce18c47a27c0c4123de1e5860f79b31d15df116/examples/matmul.mojo#L23C26-L23C26 https://github.com/modularml/mojo/blob/5ce18c47a27c0c4123de1... And for some reason they don't compare against NumPy https://github.com/modularml/mojo/blob/5ce18c47a27c0c4123de1e5860f79b31d15df116/examples/pymatmul.py#L41 https://github.com/modularml/mojo/blob/5ce18c47a27c0c4123de1... What would be more interesting is to use NumPy and do the vectorized opreations.
- almostdigital 3y agoI did just that, it's 120x faster than numpy. See my comment to OP.
- viraptor 3y agoNo, plain python code: https://github.com/modularml/mojo/blob/5ce18c47a27c0c4123de1e5860f79b31d15df116/examples/matmul.mojo#L74 https://github.com/modularml/mojo/blob/5ce18c47a27c0c4123de1... 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.
- riscy 3y agoIt’s not just weird, it’s an intentionally dishonest evaluation to build hype around their language. 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.
- theldnsn 3y ago[dead]
- __mharrison__ 3y agoMy experience is that most Python programmers would consider "pure Python" to basically be using the standard library. 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.
- pseudalopex 3y agoPure Python means written wholly in Python to most Python programmers in my experience. For some Python programmers this excludes the 3rd party libraries they care about.
- gcr 3y agoFor scientific users like they're targeting, `numpy` effectively _is_ part of the standard library.
- ska 3y ago
- woadwarrior01 3y agoPyTorch recently added support for JIT compiling numpy code[0]. And then there are libraries like Numba[1]. I wonder how Mojo compares with exiting OSS Python JIT libraries like these? [0]: https://pytorch.org/blog/compiling-numpy-code/ https://pytorch.org/blog/compiling-numpy-code/ [1]: https://numba.pydata.org/ https://numba.pydata.org/
- rdedev 3y agoI really don't understand why they do this. I was really excited for the compilation and type checking features but this whole speedup thing is pretty dumb. And I know the people developing mojo knows that too. Kind of seems like some marketing team is pushing them to do all this but their core customers are people who knows what python and numpy is and this kind of talk puts just feels weird 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
- mirekrusin 3y agoThey do this because they want to showcase writing code in single language that can do things that other languages can't. Other langauges are either low level or slow, but they are high level and fast.
- oddthink 3y agoNaive question, but how do they distinguish themselves from Julia, which is also in that space?
- shwaj 3y agoPrimarily by compatibility with Python, which is the de facto standard in deep learning.
- NeuroCoder 3y agoI think there's a Julia forum thread where they are casually benchmarking comparisons between the two. Not sure if it is still active though.
- mirekrusin 3y agoThere is large overlap with julia, yes. Both are addressing two-language problem. 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.
- almostdigital 3y agoHere's the same benchmark with numpy instead of native python (on M2 MBP) 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
- tambourine_man 3y ago“Let’s run a matrix multiplication example using matmul.mojo. On My Apple MacBook Pro M2 Max, I get about 90,000x speedup over pure Python”
- carbocation 3y agoA very unfortunate choice of comparison on their end. People use numpy, they don't write matrix multiplications in pure python. This feels like an own-goal, because bad benchmarks reduce trust.
- andy99 3y agoMy theory is there is a "persona" they are targeting with their marketing and it's not someone who knows about optimizing ML code.
- foooorsyth 3y agoThat’s just insulting to the intelligence of their potential users (presumably, smart ML engineers that can see through that gimmick of a benchmark)
- andy99 3y agoThat's the reason for my comment, if they were targeting smart ML engineers that can see through the gimmick, you'd expect them to market differently.
- polygamous_bat 3y agoHow many people fall into the intersection of “wants to do matrix multiplication really fast, and willing to pay for it”, “only knows pure python and can’t touch numpy”? Is that segment of the market worth investing $100M into?
- deleted 3y ago
- kelsey9876543 3y agofor anyone else wondering this is apparently a programming language?
- orangetuba 3y agoIt is a closed source programming language, yes.
- WendyTheWillow 3y agoCompiled using electricity from coal power, yes.
- cbarrick 3y agoA programming language created by Chris Lattner, creator of LLVM and Swift. Mojo uses the MLIR infrastructure of LLVM.
- riffic 3y agoI don't know why providing basic context is so hard for some submitters here.
- steezeburger 3y agoThe site could also do a much better job. If doesn't mention what Mojo is it all on the linked page.
- smusamashah 3y ago(totally off-topic comment) Couldn't help but notice that fire playing with laptop looked a bit like a AI generated. Then looking closely it definitely is.
- jmull 3y agoHow can you tell?
- citeguised 3y agoThe fingers look a bit weird and the keys are totally off. Still an OK illustration though. There are far worse being published.
- latexr 3y agoThe keys on the keyboard and the index finger on the (character’s) left hand immediately jumped at me. They’re distorted.
- KolmogorovComp 3y agoAlso the pupil-like white dots, not at the same place between the two eyes. 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.
- d11z 3y agoJust zoom in on the keyboard. It’s pretty characteristic of AI generated images. Edit: Just saw the other comments saying the same, whoops
- evanb 3y ago'I can tell from some of the pixels and from seeing quite a few shops in my time.'
- smusamashah 3y agoOne of the things you will start to notice after seeing loads of these is the wrong perspective. There are bunch of odities too other than keyboard or fingers. 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.
- scoopr 3y agoSo it seems to be behind a sign-up. Is this just a temporary measure to have some notion of "control" while its still being developed, or is this how they are positing it as? Is it interesting project enough that people will jump through hoops to get it? I didn't sign up, but I'm hazarding a guess that its binary-only also?
- toddmorey 3y agoThey do very much plan to open source Mojo. 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.
- BugsJustFindMe 3y ago> They do very much plan to open source Mojo. They do very much claim to plan. There's a bit of difference.
- MR4D 3y agoChris has a pretty solid reputation. I doubt he’d throw that away. Sometimes it’s okay to trust people in this space. To me, this is one of those times.
- jimboreeree 3y ago[dead]
- subharmonicon 3y agoWhat if it’s less his choice and more about convincing investors that it makes sense?
- shwaj 3y agoThat shouldn’t be hard I think. My confident guess is that there will be multiple backends for the language, an open source bare bones one, and one which integrates with their “value add“ highly scalable backend, with optimization for distributing work across GPU farms or even custom hardware.
- rgbrgb 3y agoHard needle to thread. I understand the risk of getting community momentum in a direction you don't want to go, but I'm also doubtful that much of the audience they want is interested in a closed source programming language. Hoping they can thread it because I think it's a good idea and Swift is pretty nice.
- leetharris 3y agoAnyone else find this Mojo hype and release cycle strange? Maybe it's because FOSS has driven so much innovation in the open for the last few years, but something feels off about how Mojo is being teased and released.
- omneity 3y agoAgreed. Here is a serious contender[0] minus all the hype and the $100M in VC money. You would expect a minimum of interest given how Mojo is received by the community, but not really in practice. [0]: https://chapel-lang.org/ https://chapel-lang.org/
- ForkMeOnTinder 3y agoI wonder if there's a happy medium between the two. Mojo definitely didn't need $100M in funding... but maybe Chapel could use $100K or so for better marketing.
- jrk 3y agoChapel has at least several full-time developers at Cray/HPE and (I think) the US national labs, and has had some for almost two decades. That's much more than $100k. 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 https://exaloop.io), and the metaprogramming models in Terra (https://terralang.org https://terralang.org), Nim (https://nim-lang.org https://nim-lang.org), and Zig (https://ziglang.org 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://legion.stanford.edu, https://regent-lang.org https://regent-lang.org), parallel & distributed Fortran, ZPL, etc.
- dom96 3y agoFor what it's worth, I think what Mojo does do better is that it's trying to be a better Python. Chapel's syntax immediately discourages me from using it.
- WanderPanda 3y ago[flagged]
- redog 3y agoMojo feels like an attack IMO mostly because I don't trust anyone. Promise greatness but deliver vague closed source breadcrumbs.
- sa-code 3y agoTheir keynote at the llvm conference looked quite substantial
- redog 3y agoYou never met a salesman who believes in the product they're hired to sell? 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.
- deleted 3y ago[deleted]
- linsomniac 3y agoIn this case, the co-founder behind Mojo is "former Google and Tesla employee[1] and co-founder of LLVM, Clang compiler, MLIR compiler infrastructure[2] and the Swift programming language", so he has some credentials and ability to deliver. https://en.wikipedia.org/wiki/Chris_Lattner https://en.wikipedia.org/wiki/Chris_Lattner
- webworker 3y agoWe know. 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.
- auggierose 3y agoWill there be Mojo for Intel Mac?
- joemi 3y agoIt sounds like it already is. From the article: "NOTE: This guide is for Mojo on Apple Silicon-based Macs only. Mojo on Intel-based Macs can be installed via Docker containers. Select “Set up on Mac (Intel)” in the developer console for instructions."
- robjwells 3y agoSo, that's a no then, since that would suggest installing it in a Linux VM?
- bzzzt 3y agoDidn't everyone who requires their code to run fast already upgrade to M1/M2 processors? Considering they already run on Intel it'll probably be done by someone, probably after they open up the code.
- auggierose 3y agoWell, I didn't. I am not ready yet to throw my 18 CPU cores and my 16GB graphics card away.
- Kwpolska 3y agoYour Mac has a real CPU in it, so you can just run the Linux version.
- qaq 3y agoglad I can finally play with it. Hopefully the pace of development does not slow down because Rust features with Python syntax and a smarter compiler is a pretty attractive proposition (regardless of all other goodness being promised).
- workfromspace 3y agohttps://archive.ph/tPOdx https://archive.ph/tPOdx (original website requires JS and cookies to be enabled - which I don't have)
- deleted 3y ago[deleted]
- beoberha 3y agoHas anyone here actually used mojo? I’m curious to hear people’s experiences who don’t have a vested interest in its success :)
- dsharlet 3y agoI tried it out and compared it to C++ at the last release. Here was what I found: https://github.com/dsharlet/mojo_comments https://github.com/dsharlet/mojo_comments 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.
- snowAbstraction 3y agoI skimmed your post and I wonder if mojo is focusing on such small 512x512 matrices? What is your thinking on generalizing your results for larger matrices?
- dsharlet 3y agoI think for a compiler it makes sense to focus on small matrix multiplies, which are a building block of larger matrix multiplies anyways. Small matrix multiplies emphasize the compiler/code generation quality. Even vanilla python overhead might be insignificant when gluing small-ish matrix multiplies together to do a big multiply.
- brap 3y agoSomething about Mojo and the company behind it really rubs me the wrong way.
- deleted 3y ago[deleted]
- amelius 3y agoCool, but why would I use consumer electronics for my server needs?
- strangemonad 3y agoI’m not saying a lot of the comments aren’t without merit but I was actually surprised to see so much negativity. There are only a handful of funding approaches for languages. I would also say most of the funding they raised is going towards the platform and inference accelerator. 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?
- deleted 3y ago[deleted]
- ayhanfuat 3y agoInitial reactions were much more positive (https://news.ycombinator.com/item?id=35790367 https://news.ycombinator.com/item?id=35790367). I think their marketing is putting people off.
- N1H1L 3y agoI am a bit surprised by the negativity here. Python's ecosystem fragmentation is legendary at this point, and it's lack of portability is well known. Let's face it - a lot of the "ML" applications for the next decade are going to be boring, but super important applications. Stuff like self-driving labs, process modules in factories and so on. 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.
- heyodai 3y ago[flagged]
- tucosan 3y agoOk, even after reading the initial announcement for Mojo on their blog, I still have no clue what this is. A python like language but closed source?A language to build prompts? Something else? 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.
- deleted 3y ago[deleted]
- deleted 3y ago[deleted]
- flanbiscuit 3y agoI had never heard of it until I was listening to this podcast and the creator of Mojo was their guest. I think the episode clarifies it pretty well, worth a listen https://syntax.fm/show/679/creator-of-swift-tesla-autopilot-and-tensorflow-new-ai-language-mojo-with-chris-lattner 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)
- rirze 3y agoIs it that hard to google "mojo programming language"? Have we finally gotten so lazy that either answers need to be in the link itself or we reach for chat bots to fill in the gaps? Second result on google: https://docs.modular.com/mojo/why-mojo.html https://docs.modular.com/mojo/why-mojo.html
- jpetrucc 3y agoI've been following for a while - I eagerly await when I can build this from source, or install without an auth token! This 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
- janalsncm 3y agoMojo claims a 90,000x speedup over python for matrix multiplication. No one does matrix multiplication with for loops. What is the speedup over numpy?
- almostdigital 3y agoHere's the same benchmark with np.matmul instead of native python (on M2 MBP) 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
- microtonal 3y agoDoes that use Apple accelerate? Depending on the matrix size, that sees a bit low, even the M1 Pro can easily reach 2.2 TFLOPS.
- gyrovagueGeist 3y agoWhat is your BLAS backend?
- andy99 3y agoYeah this is confusing for me: I'm non an expert in numpy * but I had assumed that it would do most of those things - vectorize, unroll, etc, either when compiled or through any backend it's using. I understand that numpy's routines are fixed and that mojo might have more flexibility, but for straight up matrix multiplication I'd be very surprised if it's really leaving that much performance on the table. Although I can appreciate that if it depends separately on what BLAS backend has been installed that is a barrier to getting default fast performance. * 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/3b86154f78a0f0832e8bd1716152365d https://gist.github.com/rbitr/3b86154f78a0f0832e8bd171615236... for some basic playing around
- mark_l_watson 3y agoExcept for having to follow their "manual installation" directions, everything is working great on my Apple Silicon Mac. 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.
- CalChris 3y agoYes, you are meant to import the Python package and just use that. Mojo is a Python superset. It speeds up math but then relies on CPython for grunt work.
- mark_l_watson 3y agoThank you. I will adjust to that.
- rnikander 3y agoIs Mojo interactive like Python? I mean will it work well with notebook style programming? I've been looking for something that works well in that interactive mode (like Python) but also has types (like, say, Swift). Swift playgrounds have always been buggy as hell for me.