Modular

M

Modular

This server is the home of the MAX and Mojo community. Join us to chat about all things Modular!

Join

questions

community-showcase

How to call function in share library

I try to use external_call to load library and symbol. But I don't know how to call it like C . How to do it in Mojo ?? fn main(): let data = "./libexample.so" let data_ptr = to_char_ptr(data)...

set() type

Does mojo have a type for set()?

Const generics, a runtime or compile time construct?

https://docs.modular.com/mojo/changelog.html#v0.4.0-2023-10-05 Really happy to see this development in Mojo, where StringLiteral is a const generic of type 'string', which is something not even C++ or Rust manages to do. However, I am curious if the 'instantiation' or 'specialization' of the template parameter is actually resolved during runtime or compile time....

Native in Windows of Mojo

When can I get an update of installation of Mojo in Windows Platform?

Out of space when trying to install

I'm trying to install mojo to use on an intel Mac. I got the vscode extensions, I made the ubuntu dev container, and installed the Modular CLI. Then I tried to install mojo, which prompted me to install python first. After doing that, I tried to install mojo again, and got the following error: LLVM ERROR: IO failure on output stream: No space left on device Any ideas on how to fix this?...

How to re-access struct diagnostic display?

If I define a struct, and then create an instance like this, there is a printout of the struct displayed: ` struct Foo: var bar: Int def init(inout self, b: Int): self.bar = b ...

mojo IDE

Does mojo has IDE just like pycharm for python?

How does Mojo balance fast compiles and providing zero-cost abstractions to the user?

In the Mojo docs, it's mentioned that the Mojo compiler is "simple and fast by definition" and not "magic". Fast compilation speed is also a design goal. My understanding is that in languages like Rust, the compile-time checks which are used for optimizations and the optimizations themselves contribute a lot to compilation speed (or rather the lack of compilation speed). How does Mojo aim to provide high level zero-cost abstractions and performance comparable to C++ and Rust? What are the limits to its optimizations? How much of a burden is there on the programmer to keep the code fast as abstraction levels increase?...

trouble with mandelbrot example

Newb here. I've copied code from the mandelbrot example, placing it into the file mandel.mojo, which I've copied here: https://gist.github.com/nbecker/820a6f740e4bad43bb09a52103d5b19b When I run mojo mandel.mojo...

What advantages does bring mojo for large models (whisper, llms)?

I would love to get a feel how to best use Mojo. I have a bunch of large models deployed and in training at the moment. So what benefits can I get in migrating pre-trained models to mojo? What are the benefits for pre-training, finetuning, PEFT, and in deployment? And if you want to take full advantage of the AI engine, how would you go about migrating the code (mostly implemented with huggingface)? Also feel free to link to any really interesting examples you have seen 🙂 Thanks a lot!...

how to make an exe in mojo

how can you build a windows executable with mojo

Why does `*1e-3` return different results than `/1000`?

Can somebody explain to me why Int64 yields 2 different results there? Is this intended behaviour or a bug? It sure was unexpected for me. And why does Int64 remain an integer while Int gets converted to a float type?...
No description

Refactoring from DynamicVector to a different data structure?

I'm currently teaching myself Mojo by porting the solutions to Codewars katas in Python over to the new language. The "safecracker" problem asks you to write a function that returns a tuple of three integers. My Python solution used the tuple type. My Mojo solution uses DynamicVector in place of tuple....

When will the keynote by Modular be delivered?

I heard in an interview (I think it was the Lex Fridman one but I'm not sure) that the Modular team would deliver the keynote at the next LLVM developer conference. When is that?

dont suppose anyone knows how to use modular to shard data and run it through a tpu?

I got a grant from google and ive been playing around with running models on it. I have played with modular a bit but havent had time to really sink in. Just hoping someone else has blazed the trail for me. Otherwise ill be figuring it out my self

Possible to get a meaningful time value?

Hi all. I'm wondering if it's possible to get a more meaningful time value than the existing time.now(), without going through Python or C. From my research it seems like you would have to interface with the OS, but I'm not sure Mojo has the necessary functionality to do that yet. Is it possible to get something like a Unix time? If so, could someone point me in the right direction?...

cannot be copied into its destination

Hi 👋 , I want to extend my matrix class with the transpose functionality ```alias dtype = DType.float32 alias type = Float32...

Provide a optional pure-python mode like Cython does to ease code sharing?

I have my Python library maintainer hat here. It would be cool to support both Python and Mojo (with speedups from struct & other) within a single wheel on Pypi, but without having to provide a Python extensions (which are harder to distribute) and without duplicating all the code. Cython already solves this problem with pure-python mode. Maybe let's steal those ideas? I made a discussion about it on github but I didn't get much attention there: https://github.com/modularml/mojo/discussions/922 What do you think? Maybe it could be a metaprogramming third-party lib?...

Error while installing Mojo 0.3.1

Error while installing Mojo 0.3.1 modular: error: failed to run python: Executable "$_self.package_path/venv/bin/python" doesn't exist! i used to work with mojo 0.2.0,0.2.~,0.3.0 on my OS(manjaro) but when i tried to upgrade mojo and install 0.3.1 i faced this error...

Will Mojo solve the Expression Problem?

As a software developer I want to apply Solid Design Principles to Mojo. The open closed principle states that software entities should be open for extension but closed for modification. In case of OOP operations are fixed but new types are introduced through vertical extension(inheritance) In functional programming types can be fixed and new operations are introduced through horizontal extension(pattern matching) Depending on the problem domain one over the other can be better for example if a compiler has fixed types and always new operations should be introduced on these types pattern matching might be better....