vmois
vmois
MModular
Created by narup on 10/22/2023 in #questions
buffer function is no longer available for String ?
You can access underlying pointer using undocumented methods _as_ptr() or _steal_ptr(). They work a bit strangely. I feel like due to lifetimes. So, you can play with them but I wouldn't count on them. Let's see what new release of Mojo in 2024 will bring.
2 replies
MModular
Created by vmois on 12/30/2023 in #questions
Owned convention does not destroy variable after transferring ownership
Thank you for the answer. I will wait for the next update and as soon as it is published I will re-check this behaviour. Very excited to finilize exercises for value ownership and semantics. Just need them to get a bit more stable.
5 replies
MModular
Created by vmois on 12/30/2023 in #questions
Owned convention does not destroy variable after transferring ownership
I filled a bug report on Mojo repository - https://github.com/modularml/mojo/issues/1604. The behaviour seems unusual to me, so either we can include more clarification in the docs or indeed it is a bug.
5 replies
MModular
Created by Zain Raza (he/him) on 12/31/2023 in #questions
Are Type Hints Still Possible in Mojo?
Types in Python are only hints (hence "type hints" name), effectively Python interpreter ignores them. If you add types in Python you can still put any value you want to the function. Python will happily run it. Could you explain please about what you are trying to accomplish by using Python type hints in Mojo? Def function in Mojo supports types. You can specify them the same way you do in Python, but using types available in Mojo. The only difference is that Mojo will actually respect types. Example:
def func():
def func2(x: Int):
return x + 2
return func2(3)


def main():
print(func())
def func():
def func2(x: Int):
return x + 2
return func2(3)


def main():
print(func())
It will output "5".
5 replies
MModular
Created by vmois on 10/22/2023 in #questions
SIMD produces weird results without print statement at the end
Anyway. That is quite interesting. Thank you for the help.
24 replies
MModular
Created by vmois on 10/22/2023 in #questions
SIMD produces weird results without print statement at the end
So by using _ = a I force compiler to provide a visibility for my tensor after vectorize?
24 replies
MModular
Created by vmois on 10/22/2023 in #questions
SIMD produces weird results without print statement at the end
Oh wait. Just saw your edir
24 replies
MModular
Created by vmois on 10/22/2023 in #questions
SIMD produces weird results without print statement at the end
_ = b also works. _ = c doesn't 🙂
24 replies
MModular
Created by vmois on 10/22/2023 in #questions
SIMD produces weird results without print statement at the end
What do you mean by simd_load inside the function? Should it still display a correct results after vectorize? But I see where you are pointing. Cause in all examples provided by Modular they returned from function at this point.
24 replies
MModular
Created by vmois on 10/22/2023 in #questions
SIMD produces weird results without print statement at the end
Thanks for looking
24 replies
MModular
Created by vmois on 10/22/2023 in #questions
SIMD produces weird results without print statement at the end
I see. Surprisingly, my other SIMD implementation for euclidian distance (from Modular blog) is working fine. Maybe I am missing something. When I will have time, I will double check code and maybe look at assembly
24 replies
MModular
Created by vmois on 10/22/2023 in #questions
SIMD produces weird results without print statement at the end
Hmm. Interesting. Try to change size to multiple of 4, like 16?
24 replies
MModular
Created by vmois on 10/22/2023 in #questions
SIMD produces weird results without print statement at the end
I have M1, so it gives nelts = 2. Indexes provided by vectorize look fine. 0 2 4 6 8
24 replies
MModular
Created by vmois on 10/22/2023 in #questions
SIMD produces weird results without print statement at the end
To make it work, I uncommeted last print print(a.simd_load[nelts](0))
24 replies
MModular
Created by vmois on 10/22/2023 in #questions
SIMD produces weird results without print statement at the end
I experience the same behaviour on both arm64 and x86
24 replies
MModular
Created by Sammi Turner on 10/12/2023 in #questions
External Python dependencies and Mojo binaries
You can validate yourself by deleting a Python package with pip and trying to see if the same Mojo binary will work.
8 replies
MModular
Created by Sammi Turner on 10/12/2023 in #questions
External Python dependencies and Mojo binaries
They will need Python with the same packages. To interface with Python, Mojo runs and communicates with CPython
8 replies
MModular
Created by gma2023 on 9/27/2023 in #questions
mojo and distributed system
There is Mojo implementation of redis - https://github.com/igorgue/firedis. You can check bindings for system calls needed for networking. But yeah language is not mature and a lot of things could change.
3 replies
MModular
Created by zverianskii on 9/15/2023 in #questions
memory leak with DynamicVector
No description
23 replies
MModular
Created by zverianskii on 9/15/2023 in #questions
memory leak with DynamicVector
Not familiar with details but shouldn't vector be freed after each outer loop? Or at least re-used?
23 replies