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

Value Semantics and async code

What does Mojo's value semantics mean for writing asynchronous code? Can Mojo sidestep the problem of coloured functions, or make it easier to write asynchronous code?

Mojo vs Rust memory safety

Does Mojo's value ownership and lifecycle mean that it can compete with Rust for memory safety?

threading in mojo

Does mojo have an abstraction for threading like python and c++ 'std::thread' . I saw a coroutine struct in docs , is that the expected model for concurrency use cases ?

How to use mojo in jupyter notebook with the new magic based installation of max-mojo?

Any recommended steps to use jupyter notebook with mojo, now that it is installed with magic cli.

How to improve the performance of formatting output

I wrote a piece of scientific simulation code as shown below: ```mojo fn run(inout self) raises -> None: with open(self.output_path, "w") as f: var out: String = "location,velocity,acceleration\n"...

how to use Buffer?

it seems we're still in the dark regarding arrays. Mojo has efficient implementations of max, sum, etc. over Buffers but creating one is a pain. For instance this code breaks on the print, why? ```python np = Python.import_module('numpy') logits = np.load('logits.npy') # (C, H, W)...

Do you guys want docs to help contributors?

Hi all! Hopefully, this is the right place to ask about this. I'm one of the founders of Agentic Labs. We build automatic software documentation you can chat with. We're looking to do a little win-win by creating documentation of the codebase for a few open-source repos to help out and let people use/give feedback on our product. It would probably be most beneficial for contributors. Would creating this documentation be something the community wants and the staff is okay with? I know you guys have a few docs in the repo, would be happy to add to those if you like the docs we create Here's a sample of some docs we created for a different project...

Using structs that inherit from a specific trait as a type?

If you have a trait and a struct that inherits from it, could you use that trait's children as a type in, for example, a list? E.g.: ```rust trait MyTrait: fn init(inout self): ... ...

Is there something I’m not understanding about the Mojo memory model?

I hope this is an easy question and someone will know the obvious thing I'm doing wrong. I have this minimal example code that demonstrates an issue I’m having. main.mojo: ```rust...

Runtime Reflection in Mojo?

Does Mojo support runtime reflection, like in Golang's reflect ? Or this is on the roadmap> https://pkg.go.dev/reflect...

Is auth not working for me?

i clicked the authorize but it seems i did not get moved to a new window as the gif in announcements showed. I am using ubuntu os.

How do i access TensorDict.items?

items(ref [self_is_lifetime] self: Self) -> _DictEntryIter[$0, String, _CheckpointTensor, $1._items, 1 It seems to not act as a regular dict or tensor upon this call. I can really see how i am meant to iterate through it. this is my current solution;...

How to prevent compilation when parametric conditions fail?

```python struct Test[bits_count: Int64 = 10]: @parameter if bits_count < 0 or bits_count > 10: raise Error("Invalid number of bits count.")...

LLVM ERROR: out of memory

WSL Ubuntu user with 16GB ram. Getting this error using Tensors: ``` LLVM ERROR: out of memory Allocation failed [76641:76641:20240928,125448.725259:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)...

Is there any mutex available in the stdlibs?

Searched for mutex in the docs and it looks like it's not available yet. Is there a way I can atomically perform multiple ops or do the following with the atomic package? I want to perform an increment on an int, followed by a modulo which should round the number back to 0 after a certain limit and return the value....

Verification Failed - I'm human

"Roomie" robot not helpful. Any suggestions? External link did not appear.

Calling methods from list indexes

When I try running update from here: ```python alias CptList = List[ComponentList] struct Entity:...

How to get unix timestamp?

Hi, is there currently currently any API to get the unix timestamp (since unix epoch)? I read the docs for time.now() and it seems it only measures the time from the system boot.

map vs parallelize vs sync_parallelize

What is the difference between these 3 functions?

Distinction Between map, parallelize and sync_parallelize

Trying to read the docs to see which one to use, but parallelize and sync_parallelize has the same function signature for the first overload function. Also, map has the same. What is the difference between those functions?