Mojo🔥编程语言开放下载,声称比 Python 快 68000 倍

829次阅读
没有评论

Mojo 是 Modular AI 公司开发的新编程语言,它结合了 Python 的易用性以及 C++ 语言的可移植性和性能,目标是使其成为 AI 研究和生产的理想选择。

Modular AI 是 Chris Lattner 和 Tim Davis 于 2022 年创立的公司,目标是自下而上重建全球 ML 基础设施。在这家新生的创业公司中,Chris Lattner 以 CEO 身份领导团队

Chris Lattner 毕业于波特兰大学的计算机科学系,具有创建和领导多个知名大型项目的经验,其中包括 LLVM、Clang、MLIR 和 CIRCT 等编译器基础设施项目,他还带头创建了 Swift 编程语言。

从 2005 年 7 月到 2017 年 1 月间,他曾领导苹果的开发者工具部门,随后,曾短暂领导过特斯拉的自动驾驶团队。2017 年 8 月,Chris Lattner 在 Google Brain 团队领导了 TensorFlow 基础设施工作,包括一系列硬件支持(CPU、GPU、TPU),底层运行时和编程语言工作。

Mojo🔥编程语言开放下载,声称比 Python 快 68000 倍

今年 5 月,Modular AI 向外界公布了 Mojo。据称自 Mojo 亮相以来,超过 12 万开发者注册使用了 Mojo Playground,另外还有 19 万开发者参与 Discord 与 GitHub 讨论。Modular AI 公司更是在上月底宣布融资 1 亿美元

Mojo🔥编程语言开放下载,声称比 Python 快 68000 倍

9 月 7 日,Modular AI 宣布 Mojo 正式开放下载,这意味着开发者可以在本地使用 Mojo 进行开发——目前仅支持 Linux,官方表示会尽快推出 Mac 和 Windows 版本。

根据公告,官方提供了编译器和 Mojo SDK。其中 Mojo SDK 还包括全套开发者和 IDE 工具 ,用于轻松构建和迭代 Mojo 应用程序。

Mojo🔥编程语言开放下载,声称比 Python 快 68000 倍

下面是 Mojo SDK 包含的工具概览。

Mojo🔥编程语言开放下载,声称比 Python 快 68000 倍

  • mojo 驱动:提供 shell 用于 read-eval-print-loop 或 REPL 的 shell,支持构建和运行 Mojo 程序、打包 Mojo 模块(包括对 🔥 扩展的支持)、生成文档和格式化代码‍
  • VS Code 扩展:支持多项生产力功能,例如语法高亮显示、自动补全代码等 ‍
  • Jupyter kernel:支持构建和运行 Mojo notebooks,包括 Python 代码‍
  • 调试工具(即将推出):进入并检查正在运行的 Mojo 程序,甚至包括混合 C++ 和 Mojo 代码的框架

Mojo 刚发布时,官方介绍称它能够利用 MLIR,使 Mojo 开发者能够利用向量、线程和 AI 硬件单元。根据测试,Mojo 比 Python 快 35000 倍。

Mojo🔥编程语言开放下载,声称比 Python 快 68000 倍

最近开发团队刷新了自己的成绩,他们表示 Mojo 将动态和静态语言的优点结合在一起性能可达到目前 Python 的 68000 倍

Mojo🔥编程语言开放下载,声称比 Python 快 68000 倍

Mojo🔥编程语言开放下载,声称比 Python 快 68000 倍

▲ 好一个 Python++

这很难评,各位自行下载来玩一玩吧:https://developer.modular.com/

示例代码

跟 Python 一样,可以通过运行 mojo 命令在 REPL 中进行编程。下面是使用 Mojo 计算欧几里得距离的代码:

$ mojo
Welcome to Mojo! 🔥
Expressions are delimited by a blank line.
Type `:mojo help` for further assistance.
1> %%python
2. import numpy as np
3. n = 10000000
4. anp = np.random.rand(n)
5. bnp = np.random.rand(n)

6> from tensor import Tensor
7. let n: Int = 10000000
8. var a = Tensor[DType.float64](n)
9. var b = Tensor[DType.float64](n)
10. for i in range(n):
11. a[i] = anp[i].to_float64()
12. b[i] = bnp[i].to_float64()

13> from math import sqrt
14. def mojo_naive_dist(a: Tensor[DType.float64], b: Tensor[DType.float64]) -> Float64:
15. var s: Float64 = 0.0
16. n = a.num_elements()
17. for i in range(n):
18. dist = a[i] – b[i]
19. s += dist*dist
20. return sqrt(s)

23> fn mojo_fn_dist(a: Tensor[DType.float64], b: Tensor[DType.float64]) -> Float64:
24. var s: Float64 = 0.0
25. let n = a.num_elements()
26. for i in range(n):
27. let dist = a[i] – b[i]
28. s += dist*dist
29. return sqrt(s)
30.
31> let naive_dist = mojo_naive_dist(a, b)
32. let fn_dist = mojo_fn_dist(a, b)
33. print(fn_dist)
34.
1290.8521425092235
35. print(naive_dist)
36.
1290.8521425092235

此外,Mojo 支持构建静态编译的可执行文件,开发者可以在没有任何依赖项的情况下进行部署。例如直接从官方的示例 repo 中编译并运行 hello.🔥 程序,代码如下所示:

$ mojo build hello.🔥

$ ./hello
Hello Mojo 🔥!
9
6
3

$ ls -lGtranh hello*
-rw-r–r– 1 0 817 Sep 3 23:59 hello.🔥
-rwxr-xr-x 1 0 22K Sep 3 23:59 hello

Read More 

正文完
可以使用微信扫码关注公众号(ID:xzluomor)
post-qrcode
 0
评论(没有评论)

文心AIGC

2023 年 9 月
 123
45678910
11121314151617
18192021222324
252627282930  
文心AIGC
文心AIGC
人工智能ChatGPT,AIGC指利用人工智能技术来生成内容,其中包括文字、语音、代码、图像、视频、机器人动作等等。被认为是继PGC、UGC之后的新型内容创作方式。AIGC作为元宇宙的新方向,近几年迭代速度呈现指数级爆发,谷歌、Meta、百度等平台型巨头持续布局
文章搜索
热门文章
潞晨尤洋:日常办公没必要上私有模型,这三类企业才需要 | MEET2026

潞晨尤洋:日常办公没必要上私有模型,这三类企业才需要 | MEET2026

潞晨尤洋:日常办公没必要上私有模型,这三类企业才需要 | MEET2026 Jay 2025-12-22 09...
“昆山杯”第二十七届清华大学创业大赛决赛举行

“昆山杯”第二十七届清华大学创业大赛决赛举行

“昆山杯”第二十七届清华大学创业大赛决赛举行 一水 2025-12-22 17:04:24 来源:量子位 本届...
MiniMax海螺视频团队首次开源:Tokenizer也具备明确的Scaling Law

MiniMax海螺视频团队首次开源:Tokenizer也具备明确的Scaling Law

MiniMax海螺视频团队首次开源:Tokenizer也具备明确的Scaling Law 一水 2025-12...
清库存!DeepSeek突然补全R1技术报告,训练路径首次详细公开

清库存!DeepSeek突然补全R1技术报告,训练路径首次详细公开

清库存!DeepSeek突然补全R1技术报告,训练路径首次详细公开 Jay 2026-01-08 20:18:...
最新评论
ufabet ufabet มีเกมให้เลือกเล่นมากมาย: เกมเดิมพันหลากหลาย ครบทุกค่ายดัง
tornado crypto mixer tornado crypto mixer Discover the power of privacy with TornadoCash! Learn how this decentralized mixer ensures your transactions remain confidential.
ดูบอลสด ดูบอลสด Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
ดูบอลสด ดูบอลสด Pretty! This has been a really wonderful post. Many thanks for providing these details.
ดูบอลสด ดูบอลสด Pretty! This has been a really wonderful post. Many thanks for providing these details.
ดูบอลสด ดูบอลสด Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.
Obrazy Sztuka Nowoczesna Obrazy Sztuka Nowoczesna Thank you for this wonderful contribution to the topic. Your ability to explain complex ideas simply is admirable.
ufabet ufabet Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.
ufabet ufabet You’re so awesome! I don’t believe I have read a single thing like that before. So great to find someone with some original thoughts on this topic. Really.. thank you for starting this up. This website is something that is needed on the internet, someone with a little originality!
ufabet ufabet Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
热评文章
摩尔线程的野心,不藏了

摩尔线程的野心,不藏了

摩尔线程的野心,不藏了 量子位的朋友们 2025-12-22 10:11:58 来源:量子位 上市后的仅15天...
摩尔线程的野心,不藏了

摩尔线程的野心,不藏了

摩尔线程的野心,不藏了 量子位的朋友们 2025-12-22 10:11:58 来源:量子位 上市后的仅15天...
AI体育教练来了!中国团队打造SportsGPT,完成从数值评估到专业指导的智能转身

AI体育教练来了!中国团队打造SportsGPT,完成从数值评估到专业指导的智能转身

AI体育教练来了!中国团队打造SportsGPT,完成从数值评估到专业指导的智能转身 量子位的朋友们 2025...
AI体育教练来了!中国团队打造SportsGPT,完成从数值评估到专业指导的智能转身

AI体育教练来了!中国团队打造SportsGPT,完成从数值评估到专业指导的智能转身

AI体育教练来了!中国团队打造SportsGPT,完成从数值评估到专业指导的智能转身 量子位的朋友们 2025...
真正面向大模型的AI Infra,必须同时懂模型、系统、产业|商汤大装置宣善明@MEET2026

真正面向大模型的AI Infra,必须同时懂模型、系统、产业|商汤大装置宣善明@MEET2026

真正面向大模型的AI Infra,必须同时懂模型、系统、产业|商汤大装置宣善明@MEET2026 量子位的朋友...