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

Int64 doesn't implement EqualityComparableCollectionElement?

If I change this code https://github.com/py2many/py2many/blob/main/tests/expected/bubble_sort.mojo to use List[Int64] it errors out with the above message. Known problem?...

parallelize and @parameter issue in Mojo 24.5

I am trying to convert my projects to Mojo 24.5. Right now I face the following issue. When running ```rust...

Define Tuple with PuthonObject

Trying to convert the below opencv python code to mojolang: ```python import cv2 as cv cap = cv.VideoCapture(0)...

Testing a package in latest nightly

Just installed nightly mojo 2024.9.1905 and vscode can no longer see my package.mojopkg that is right there in the test folder. Any ideas how can I structure folder differently?
No description

Segmentation Fault Core dumped

Been hard stucking on running the follow function as binary in Linux. It can run by mojo run .mojo just fine but it just can’t be executed as a binary … and the only error I got is in the title. ```fn get_codewords(owned padded: List[Int]) -> List[Int]: var ecwords = ListInt*64 var values = ListInt...

Example of parallel computing

I read the this, but unfortunately could not understand how can I do parallel computing at MOJO, can any help help with simple code sample. Thanks https://docs.modular.com/mojo/stdlib/algorithm/functional/parallelize...

MAX for fixed-function hardware

Does MAX have the ability to represent fixed-function hardware or hardware which has limited programmability? For instance, cryptographic accelerators (Intel QAT, AMD CCP) or NPUs (Intel, AMD, Qualcom, Apple). For "limited programmability", I mean devices like P4 NICs, which are not quite as flexible as FPGAs but are still flexible enough a programming language was required to use them (P4). The language is not turing complete by design to allow for fixed-function ASICs to implement it easily.

Mojo equivalent to Rust's phantom type

Does Mojo have an equivalent to Rust's phantom type? I have a few usecases where I need a raw pointer (for syscalls) to be assigned a lifetime via a wrapper, such as for iovec.

to_numpy with Mojo 24.5

I try to convert the to_numpy method from the Mojo 24.4 based KMeans tutorial https://www.modular.com/blog/fast-k-means-clustering-in-mojo-guide-to-porting-python-to-mojo-for-accelerated-k-means-clustering to Mojo 24.5 but get the following error:
error: 'pop.index_to_pointer' op MLIR verification error: unregistered operation 'pop.index_to_pointer' found in dialect ('pop') that does not allow unknown operations
error: 'pop.index_to_pointer' op MLIR verification error: unregistered operation 'pop.index_to_pointer' found in dialect ('pop') that does not allow unknown operations
...

debug

I'm seeing Connection shut down by remote side while waiting for reply to initial handshake packet on my MacBook Air M2 when I launch the debugger in VSCodium (I tried VSCode too). Is the debugger supposed to be working?

Conditional parameter evaluation

Hello, I was wondering if there was a way to write conditional parameter evaluation, something like @parameter(condition) to apply the @parameter only if condition is true. Practial example of unrolling loop: ```mojo...

Setting up SDL2 with Mojo on WSL

SDL is known for being notoriously hard to set up, and I only have experience with doing it in VS using NuGet (which is frankly a lot simpler). Does anybody know how to do it with Mojo and DLHandle?

Copy numpy data to UnsafePointer

How can I copy the data of a numpy array to an UnsafePointer in the new mojo version?

How can I convert String to StringLiteral

I understood that str() is required to convert things to String like (StringLiteral, Int, Bool, ...), but is there a way to covert String to LiteralString. As part of learning Mojolang I'm trying the below code, then this conversion issue poped up. ``` from collections import List...

C/C++ Interop

My understaffed is horror we can get something like: https://docs.modular.com/mojo/roadmap#cc-interop And for clib interop we have sys.ffi.external_call ...

Removing a mojo project

Is there a way to remove a mojo project using the magic tool?
magic remove
magic remove
in the directory doesn't seem to do anything. Thanks in advance....

Importing python modules

Whenever I try to import a python module using
import ctypes
import ctypes
(ctypes used as an example) VSCode gives me an error saying the module is inaccessible, and running mojo [file] says the same thing. I've checked and Python 3 is installed on both Windows 11 and WSL. (Using WSL) Thanks in advance....

Adding a .mojo or .🔥file to a magic project

I've created a project using
magic init hello-world --format mojo-project
cd hello-world && magic shell
magic init hello-world --format mojo-project
cd hello-world && magic shell
but how could I add a file to this project / view its directory?...

Embedding

Hi all, not sure if I have to ask here or at MAX channek, is there embedding, vector database and similarity search in MAX that I can use with LLM?

Shared Object Support?

I doubt this is the case, but is there by chance a way to compile mojo to linux shared objects? If not is there any plan to include the ability in the future? Even if they cant cross operate with other executables coded in languages other than mojo, they'd be super useful for a project I have in mind.