RealTime application for Mojo
I was wondering is if Mojo was suited for realtime systems?
To be more precise I was thinking like hearing data from a network , interfacing this data & threat this data.
Are there examples of real-time applications benchmarking performance (time of processing & reactivity ) ?...
how to set Modular_Home environment to appropriate path?
Have installed as per the documentation, sdk installed, and all things done accordingly, but once I am running the file, it shows that path not found... pls see the image for reference
Kindly guide.....
Vectors vs Tensors ?
Can some one explain the difference between Mojo Vectors [ Dynamic , InlinedFixed ] and Tesnors and when to use what ?. For example if i want to create a list like structure [ think a python like list ] what should i use ?? and why ? Are there benefits of using Tensors over Vectors and vise versa ?
Mandelbrot simd_width clarification
I'm trying to learn Mojo. In the Mandelbrot notebook (https://github.com/modularml/mojo/blob/main/examples/mandelbrot.mojo).
The first block in the notebook sets the simd_width to "2 * simdwidthoffloat_type".
Why is this a multiplication? Wouldn't the simd_width of the complex datatype be half the width?...
How to read the Mojo documentation effectively
Am in the process of learning mojo and i want to know how to read the documenation effectively. For the most part the documentation is quite straight forward. , but ive come across some sections that trip me up.
For example when going through the section on collections
we have Dynamic vectors , and underneath dynamic vectore we have the description of the data structure and then the methods associated with it.
Now to create a dynamic vector the syntax is var vect = DynamicVectordata type . ...
Mojo - Microcontrollers
Mojo code on Raspberry Pi Pico/Arduino instead of MicroPython? It would bring significant speed ups and could be fairly easy to work with and would be amazing in performance critical applications.
Was there any specific reason for the current template syntax?
Mojo currently uses the
[
and ]
characters to specify templates instead of the <
and >
characters that we see in most other languages.
Initially one would think it is to avoid the known ambiguity the latter characters can cause, however the current characters also make the grammar ambiguous.
```python...Alias does not work with raises String methods
I have a string i know at compile time and I was writing a function to split it into each of the new lines, but because split has a raises flag it cannot be run at compile time and stored as an alias. I noticed there is a TODO to allow this, and im curious when will alias work with potentially raising functions?
Here is my sample code:
```
alias string: String = ...
How to use f-string in mojo
I want to write a ppm file in mojo using f-string pattern. e.g., thingss like:
out.write(f"P3\n{pic.size_X} {pic.size_Y}\n255\n")
out.write(f"{clamp(round(r))} {clamp(round(g))} {clamp(round(b))} ")
etc. But I can't use f-strings in mojo. Plus if I try to do like this:...
Does Mojo support fast-math flags?
Does Mojo allow for enabling flags from the fast-math group? https://llvm.org/docs/LangRef.html#fast-math-flags
Mojo Pointer to Python bytes?
Hello,
Is there a way to create a Python
bytes
object from a Mojo Pointer
?
Context: I have image/pixel data stored in contiguous memory in Mojo-land. I want to load this into Python-land using pillow. Pillow offers a Image.frombytes
function, which seems like it may do the job. But I need to provide it a Python bytes
. I don't mind if the data is copied....convert UInt8 to UInt16
Assuming this code in C
uint16_t get2i(uint8_t const * const data, uint_fast32_t * const pos)
{
uint16_t val=(data[pos]<<8)|data[(pos)+1];
(*pos)+=2;...
Python.import_module not working as expected
Hi there ❤️🔥 !
Trying to go through a basic hello world example and would like to import stdlib modules from python. My silly app looks like this:
```python
#!/usr/bin/env mojo...
Reducing binary size
I'm trying to check the executable binary generated by mojo, for a simple "Hello" I got a 1.1M, is there a way to get a less size, a way to optimize the outputfile size?
How to convert a byte to integer?
Here is the python and mojo code:
Moje code prints the byte strings while python prints the interger. How to get integer from byte string in mojo?...
pytorch
alright I am just going to ask it. I have been really interested in mojo especially for ML but it seems that you need to know a lot of concepts to actually do it. So I understand how to make a struct in mojo. But do I actually need to implement a matrix struct from scratch? And matrix multiplication and so on? Or can I use the Tensor module, or do I use vector, or both? Or is there a built in type? Or do I import pytorch into my mojo code?
Dynamic Vector of objects
I'm trying to create a dynamic vector of struct objects but facing this error:
error: 'DynamicVector' parameter #0 has 'CollectionElement' type, but value has type 'MyPair'
var vector = DynamicVector[MyPair] ()
I've also tried creating a copy and move constructor but still facing the same problem
Here is my code:...
Counter-intuitive operator precedence
While debugging, I spotted a very counter-intuitive operator precedence evaluation.
Question: is it just me, or does the following code seem highly susceptible to bugs. If the code is indeed correct, does it serve as a nice example why we should be cautious about omitting parentheses? A warning would have saved me several hours of debugging...
```python...