PriNova
PriNova
MModular
Created by Krishna on 3/7/2024 in #questions
Mojo and Max installation issue
As far as I remember, this issue persisted since the closed beta of Mojo back in summer last year. Installing the Python dev library solved that issue already these days.
27 replies
MModular
Created by Krishna on 3/7/2024 in #questions
Mojo and Max installation issue
In my case, I installed Python3.12 from the deadsnakes ppa, because of WSL2 VM
27 replies
MModular
Created by Krishna on 3/7/2024 in #questions
Mojo and Max installation issue
Maybe your system is missing the libpython3.12.so. Install the Python3.12-dev headers: sudo apt install python3.12-dev Then modular install mojo This worked for me. You do not need to export LD_LIBRARY_PATH with this solution.
27 replies
MModular
Created by david on 10/2/2023 in #questions
Will Mojo solve the Expression Problem?
If this will happen, we would go back to asm and write hand-crafted loop unrolls. 😂
43 replies
MModular
Created by david on 10/2/2023 in #questions
Will Mojo solve the Expression Problem?
About code reuse, it makes sense to put proven algorithms in a library for later use in other similar projects or similar apps. What is the difference between:
fun calculate(*args):
// calculate first
...
// calculate second
...
// calculate last
...
fun calculate(*args):
// calculate first
...
// calculate second
...
// calculate last
...
and
fun calculate(*args):
calculateFirst()
calculateSecond()
calculateLast()

...

// This functions are usually in different files and folders
fun calculateFirst(*args):
...

fun calculateSecond(*args):
...

fun calculateLast(*args):
...
fun calculate(*args):
calculateFirst()
calculateSecond()
calculateLast()

...

// This functions are usually in different files and folders
fun calculateFirst(*args):
...

fun calculateSecond(*args):
...

fun calculateLast(*args):
...
The former is the vertical layered architecture and the latter is the horizontal layered architecture.
43 replies
MModular
Created by david on 10/2/2023 in #questions
Will Mojo solve the Expression Problem?
I'm with you, when it comes to the distinction of comptime vs runtime polymorphism. I guess Casey is arguing against dynamic polymorphism/dispatching, but he was not explicit enough. By using static polymorphism, you know the types a priori during writing code and be concrete over what to be needed. By using dynamic polymorphism, you write mostly for future cases. Packing everything under a base class, like a 'Human' and an 'Ant' because they can move. This is the inheritance problem. Solved by utilizing composites (a concept also from OOP). You see, I do not doom OOP at all. It has its use cases. Why I try to encourage people reconsidering OOP, because of overengineering it. Like a hammer for everything which looks like a nail. In Mojo exists the 'alias' keyword as tagging and for example create a Matrix 'object' like alias Matrix4x4 = SIMD[float32, 16] (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) (<- pseudo code) If someone is coming from a strongly OOP educated direction, explain why to use a 4x4 Matrix is better over of a 3x3 Matrix, even if you only need 9 elements as in a 3x3 Matrix and can put aside the other 7 elements? Or explaining, why a 'Person' class, with member variables such as 'name', 'email', 'age', 'profession', 'wage', 'bonus' etc., is a bad choice, if you want to calculate the yearly wage + bonus for 500k Person instances?
43 replies
MModular
Created by david on 10/2/2023 in #questions
Will Mojo solve the Expression Problem?
No description
43 replies
MModular
Created by david on 10/2/2023 in #questions
Will Mojo solve the Expression Problem?
Maintainability and performance are not diametral. They can exist simultaneously. An engineer has to find a way to design with minimal cost in mind, too. This applies also to CPU cycles. Why design programs which waste CPU cycles because of principles which never were measured quantitively? Here, I do not mean algorithms, but how to connect the algorithms in a structural way that does not harm execution time. For example, you have a program written with Clean Code, small methods, and all such SOLID principles, which uses 340 cycles. And in comparison, a program structured in a way with data-oriented design, which uses only, say, 20 cycles. You are wasting the technological evolution of about 10 years only because a senior dev said, these principles are good? Why are polymorphisms good and if/switch statements bad? How do small methods and separations of concerns help the compiler/hardware? On my programming career, I used Java a lot and learned Clean Code, Clean Architecture, read many books about these principles from Uncle Bob et al. Until I found functional programming, I read Grokking Simplicity and read code from game and render engines. This changed my mind a lot. I switched from Hexagonal Architecture to Vertical Sliced Architecture. Now I try to write code with performance as highest priority in mind, focusing on data structures, knowledge- and lookup tables, padding, alignment, etc without losing readability, maintainability and such. I will not pray for my view. This is the experience I grokked and every need his own way to enlightenment.
43 replies
MModular
Created by Elaid Tebabkha on 9/30/2023 in #questions
Can't show the plot of matplotlib os Ubuntu!
If you installed WSL2 through the Microsoft Store the WSLg is already included.
17 replies
MModular
Created by Elaid Tebabkha on 9/30/2023 in #questions
Can't show the plot of matplotlib os Ubuntu!
Are you on windows 11 or 10?
17 replies
MModular
Created by Elaid Tebabkha on 9/30/2023 in #questions
Can't show the plot of matplotlib os Ubuntu!
Are you able to use other WSL2 gui apps like gedit, gimp or other X11 apps?
17 replies
MModular
Created by Elaid Tebabkha on 9/30/2023 in #questions
Can't show the plot of matplotlib os Ubuntu!
Are you in WSL2 or is this some kind of Chromebook or Surface?
17 replies
MModular
Created by david on 10/2/2023 in #questions
Will Mojo solve the Expression Problem?
To be clear about SOLID, this is the worst you can do in regards to performance. SOLID and Clean Code was developed for humans and not for hardware. So, this is a tooling problem instead of a programming problem. Hardware evolved since the creation of SOLID and other OOP principles. Have a look here and reconsider: https://youtu.be/tD5NrevFtbU?si=vebQwmCk_nmRB0GA
43 replies
MModular
Created by david on 9/29/2023 in #questions
Will Mojo Metaprogramming support Lisp/Julia Style Macros?
I agree that OOP helps to manage complexity, but do not focus too much on Clean Code or OOP, because then you suffer a performance hit in your code a lot. For performance rich code, focus more on data-oriented design like it is done in game development and put OOP onto the shell. For more reference, have a search for Casey Muratori or Richard Fabian.
41 replies
MModular
Created by Elaid Tebabkha on 9/30/2023 in #questions
Can't show the plot of matplotlib os Ubuntu!
It seems you have a corrupt installation. Try to install Mojo fresh with:
sudo apt-get update
modular clean
modular install mojo
sudo apt-get update
modular clean
modular install mojo
17 replies
MModular
Created by Larsis on 9/14/2023 in #questions
How to use Modulo?
Mojo encourages by using SIMD types, which is preferred for parallel execution and tiling etc. These are the primitives to use efficiently. SIMD also has a __mod__ dunder for calculating the modulo.
8 replies
MModular
Created by Larsis on 9/14/2023 in #questions
How to use Modulo?
Called with:
fn main():
alias o = object(10)
let result = intMod[o](4)
fn main():
alias o = object(10)
let result = intMod[o](4)
Important here, the object must be an alias, because dynamic types are not supported.
8 replies
MModular
Created by Larsis on 9/14/2023 in #questions
How to use Modulo?
If the parameter is an object and you want a modulo, this is a workaround:
fn intMod[o: object](mod: Int) -> Int:
if o._value.is_int():
return (o._value.get_as_int() % mod).to_int()
return -1
fn intMod[o: object](mod: Int) -> Int:
if o._value.is_int():
return (o._value.get_as_int() % mod).to_int()
return -1
8 replies
MModular
Created by Orwink on 9/19/2023 in #questions
Mojo have a HashMap or Dict?
The !kgen seems to be a Fortran Kernel generator and is used for AST generation and manipulation.
32 replies
MModular
Created by Orwink on 9/19/2023 in #questions
Mojo have a HashMap or Dict?
Ok, understand.
32 replies