Mojo Programming SDK Now Available For Download In Local

Hello Learners…

Welcome to the blog…

Table Of Contents

  • Introduction
  • What Is Mojo Programming Language?
  • Mojo Programming SDK Now Available For Download In Local
  • Set up on Windows
  • Build and run Mojo source files
  • Run a Mojo file
  • Build an executable binary
  • Summary
  • References

Introduction

In this post we discuss about Mojo Programming SDK Now Available For Download In Local.

What Is Mojo Programming Language?

Mojo combines the usability of Python with the performance of C, unlocking unparalleled programmability of AI hardware and extensibility of AI models.

Mojo Programming SDK Now Available For Download In Local

To download mojo programming to in our local system first we have to signup on their site after that they provide an authentication code with that we can download it in our local system.

To signup,

After signup successfully, For download

Set up on Windows

Mojo is not available for Windows yet, but you can use it on a Linux container or remote system. Here’s one way you can do that with WSL

1.Install VS Code, the WSL extension, and the Mojo extension.
2.Install Ubuntu 22.04 for WSL and open it.
3.In the Ubuntu terminal, install the Modular CLI:
curl https://get.modular.com | \
 MODULAR_AUTH=YOUR_AUTH_NUMBER  \
 sh -
4. Install the Mojo SDK:
modular install mojo
5. Open the Ubuntu workspace in VS Code with this:
code .
6. Get started with Hello World!

After we install Mojo, we can use the Mojo CLI to build and compile Mojo programs. So let’s create the classic starter program that prints “Hello, world!”

Before you start:

We must set the MODULAR_HOME and PATH environment variables, as described in the output when we ran modular install mojo. For example, if we are using bash, we can set them as follows:

echo 'export MODULAR_HOME="$HOME/.modular"' >> ~/.bashrc

echo 'export PATH="$MODULAR_HOME/pkg/packages.modular.com_mojo/bin:$PATH"' >> ~/.bashrc

source ~/.bashrc

Build and run Mojo source files

Now let’s print “Hello, world” with a source file. Mojo source files are identified with either the .mojo or .🔥 file extension.

We can quickly execute a Mojo file by passing it to the mojo command, or we can build a compiled executable with the mojo build command. Let’s try both.

Run a Mojo file

First, write the Mojo code and execute it:

1.Create a file named hello.mojo (or hello.🔥) and add the following code:
fn main():
   print("Hello, world!")
2. That’s all we need. Save the file and return to our terminal.
3. Now run it with the mojo command:
mojo hello.mojo
4. It should immediately print the message:
Hello, world!

If this didn’t work ,we have to double-check our code looks exactly like the code in step 1, and make sure we correctly installed Mojo.

Build an executable binary

Now, build and run an executable:

1. Create a statically-linked binary with the build command:
mojo build hello.mojo

It creates the binary with the same name as the .mojo file, but we can change that with the -o option.

mojo build hello.mojo -o hello_mojo
2. Then run the executable:
./hello

The executable is a statically-compiled binary, which means it has no external library dependencies and it can run on any system with the same CPU architecture as our own.

Summary

Mojo Programming SDK’s availability for local installation brings a host of benefits to developers. It offers the convenience of a familiar development environment, enabling you to build and test applications with ease.

Mojo bridges the gap between usability and performance, making it a valuable tool for AI practitioners. Whether you’re building AI-powered applications, conducting cutting-edge research, or optimizing AI models for your organization, Mojo’s unique blend of Python ease-of-use and C-level performance delivers a compelling solution that unlocks the true potential of AI hardware and models.

It’s a game-changer in the field of AI development, setting the stage for faster innovation and more efficient AI-driven solutions.

Also Refer,

Happy Learning And Keep Learning…

Thank You…

References

Leave a Comment