Open Source Friday: Julia – High-Performance Open Source Language
By GitHub
Key Concepts
- Two-Language Problem: The historical challenge in technical computing where prototypes in high-level languages (e.g., MATLAB, R) needed to be rewritten in low-level languages (e.g., C) for production performance.
- Julia Programming Language: A high-performance, dynamic programming language designed to solve the two-language problem by combining productivity and speed.
- Multiple Dispatch: Julia's core feature allowing functions to define methods for specific combinations of argument types, enabling highly specialized and efficient code execution.
- JIT (Just-In-Time) Compilation: Code is compiled at runtime, optimizing performance while maintaining dynamic language flexibility.
- Julia C: A new tool introduced in Julia 1.12 for compiling Julia code into standalone executables or shared libraries.
--trimFlag: A feature of Julia C that removes unneeded code to significantly reduce the size of compiled executables.--bundleOption: A Julia C feature that creates a directory containing all necessary external dependencies for deployment.- Agentic Workflows: Development methodologies leveraging AI agents to assist with coding, testing, and other tasks.
- Context, Loop Closure, Sandboxing: Three critical components for effective and safe AI agentic workflows.
- Context: Providing the AI with relevant code, issues, or logs.
- Loop Closure: The AI's ability to independently validate its answers (e.g., compile, run tests).
- Sandboxing: Isolating the AI's environment to prevent unintended or harmful actions.
- Cloudbox: A Julia project (written by AI) that uses Julia's sandboxing mechanisms to create isolated environments for AI agents.
- DIAD (Descriptive Language for Modeling and Simulation): A new descriptive language built on Julia by JuliaHub, designed for modeling and simulating physical systems, particularly in hardware engineering.
- Textual-Graphical Model Bridge: DIAD's unique feature that provides a one-to-one correspondence between a model's textual code and its graphical representation, facilitating collaborative AI-assisted engineering.
- JuliaHub: A cloud platform for running Julia applications, especially in certified, safety-critical, or regulatory environments, featuring tools like "Time Capsule" for reproducibility.
- Wilkinson Prize for Numerical Software: A top award in numerical computing, won by Julia's co-creators.
Introduction: GitHub Universe & Open Source
The video begins with attendees expressing their enthusiasm for GitHub Universe, highlighting its energizing atmosphere, the diverse community, and the opportunity to connect with fellow developers and GitHub experts. The conference is praised for its unique blend of topics, vibrant community, and approachable environment, contrasting with more corporate-driven events.
The discussion then transitions to open-source contributions, with a common question addressed: "What's a good way to get started?" The answer emphasizes several entry points:
- Triage issues: Helping maintainers identify real bugs in projects.
- Good first issues: Many repositories, like Home Assistant (which has 2.9K issues), label issues specifically for new contributors.
- Contributing to projects you use and care about: A practical approach to finding relevant areas to help.
The segment introduces Andrea Griffiths (Ala Colombia Dev), the host of "Open Source Friday," who welcomes viewers and introduces the Julia programming language. She notes previous discussions about Julia on the show, including demos by Logan Kilpatrick and Miguel Ras, and celebrates a viewer's successful Pull Request (PR) merge.
The Julia Programming Language: Origin & Philosophy
Andrea introduces Julia as a programming language designed to solve "the two-language problem" in technical computing. This problem arises when developers prototype in a high-level, productive language (like MATLAB or R) but then must rewrite their code in a high-performance language (like C) for production. Julia's creators aimed to eliminate this choice, asking, "Why choose between productivity and performance? Why not both?"
Viral Shah, co-founder and CEO of JuliaHub and co-creator of Julia, recounts the origin story. After his PhD, he was frustrated by the lack of control over language and parallelism in his MATLAB implementation for large graph problems. He, along with Stefan Karpinski, Jeff Bezanson, and Alan Edelman, discussed this frustration. Within three days of an email exchange, Jeff Bezanson had a working Julia parser, much of which survived for 15 years (though it's now being rewritten in Julia itself, achieving a "moment of inception").
The panel discusses why this problem wasn't solved earlier. Historically, there was a belief that high-level, dynamic languages had to be slow and couldn't have compilers, necessitating rewrites in C for performance. Julia represents a "step change" by demonstrating that high-level languages can be dynamic and high-performance, running efficiently on CPUs and GPUs. Stefan Karpinski notes that Common Lisp came very close to solving this but was hindered by its syntax.
Julia's Core Team & Recognition
The "dream team" of Julia's co-creators is introduced:
- Viral Shah: Co-founder and CEO of JuliaHub, co-creator of Julia.
- Stefan Karpinski: Co-creator and co-founder of JuliaHub, co-creator of Julia, and a recipient of the Wilkinson Prize for Numerical Software (a top award in numerical computing, won in 2019 for Julia's creation).
- Jeff Bezanson: CTO and co-founder of Julia, co-creator of Julia, and also a recipient of the Wilkinson Prize for Numerical Software.
- Keno Fischer: CTO of R&D and co-founder of JuliaHub, a core contributor for over a decade, and led optimizations for the Celeste project.
The team emphasizes that Julia started with their "unreasonable demands" and has since grown to meet the "unreasonable demands of other people over the years," leading to its robust development and community.
Real-World Applications of Julia
Julia is used in diverse fields, from academia and research to large-scale production environments.
- High-Performance Computing (HPC): Keno Fischer highlights the Celeste project, a large-scale astronomy application that analyzed astronomical images on supercomputers, running on hundreds of thousands of cores at Lawrence Berkeley National Lab.
- Scientific Machine Learning (SML): Viral Shah mentions the SML ecosystem, created by Krisha Cauus, which comprises over 150 packages focused on solving deeply scientific problems, forming the foundation for products like DIAD and Pumas.
- Pharmaceutical Industry: Julia is used in products like Pumas, which was instrumental in the modeling for the Moderna vaccine.
- Aerospace: Boeing is using Julia to build high-fidelity models of entire planes.
- Financial Sector: Used by institutions like the Federal Reserve.
- Space Exploration: Employed by NASA.
- Scalability: Julia runs on a wide range of hardware, from Raspberry Pi to supercomputers and GPUs.
The Julia community has grown significantly, with an estimated over 1 million users and over 1,000 contributors.
Deep Dive: Julia's Language Features (Demo)
Stefan Karpinski provides an interactive demo of Julia's core features, starting with its interactive session (REPL).
- Basic Calculator & Unicode Input: Julia can be used as a simple calculator and supports Unicode input, allowing users to type mathematical symbols (e.g.,
\pi+ Tab forπ) and even emojis as variable names (e.g.,🍕). This is particularly useful for researchers who want variable names to match those in papers. - Custom Type Definition: Stefan demonstrates defining a
ModInt{N}(Modular Integer) type.- It's defined as an
immutable structwith a type parameterN(the modulus) and a fieldk(the integer value). - It subtypes
Integer, inheriting generic integer behavior. - A constructor ensures the value
kis reduced moduloNupon creation.
- It's defined as an
- Multiple Dispatch & Operator Overloading:
- Initially,
ModIntinstances cannot be added, multiplied, or subtracted. - By
importing base functions like+,*,-, andnegate, new methods are defined forModIntarguments. - Julia's multiple dispatch system automatically selects the most specific method based on the argument types.
- After defining these methods, operations like
a + b,a * b,a - b, anda^100(efficiently computed) work seamlessly.
- Initially,
- Custom Printing (
showfunction): Theshowfunction is overloaded to provide a cleaner representation ofModIntobjects (e.g.,3 mod 13). - Composability & Efficiency:
- An array of
ModIntobjects is created, demonstrating how custom types compose with built-in data structures (e.g.,Matrix). - These custom types are represented efficiently, taking only the space of an
Int. - Operations on these arrays (e.g., squaring a matrix of
ModInts) are also efficient due to Julia's JIT compilation.
- An array of
- Promotion and Conversion: Julia's system allows for mixed-type arithmetic (e.g.,
a + 1) by defining rules for promoting and converting types, ensuring correct behavior. - JIT Compilation & Code Inspection:
- Julia uses the LLVM compiler. The demo shows how to inspect the generated LLVM and assembly code for operations like
ModIntaddition. - A key efficiency feature is specialization: for a modulus that is a power of two (e.g., 16), Julia generates much more efficient code using bitwise operations (
and) instead of general modular reduction.
- Julia uses the LLVM compiler. The demo shows how to inspect the generated LLVM and assembly code for operations like
Julia's Package Ecosystem & LaTeX Compatibility
Stefan explains that Julia's package manager was not present from the very beginning but was developed around 2012 when the main Julia repository became bloated with package files. He spent a month building the package manager, which now supports over 10,000 packages.
Regarding LaTeX compatibility:
- Julia's Unicode input is not fully LaTeX compatible but uses the same names for characters.
- Packages like
latexifyexist to render Julia expressions as LaTeX, which is useful for plot labels and embedding LaTeX strings.
Julia 1.12 Release: New Features & Standalone Binaries
Jeff Bezanson announces the recent release of Julia 1.12, highlighting a highly anticipated feature: the ability to easily deploy standalone binaries and shared libraries.
- Julia C Compiler: A new command-line tool,
Julia C(following naming conventions likeGCCorRust C), allows users to generate executables (--output-exe) or shared libraries (--output-lib). --trimFlag: This crucial new feature removes unneeded code from the compiled application, drastically reducing binary size. A "Hello World" executable, which previously could be 300 MB, is now around 1.5 MB, a "huge progress" that unlocks many more application areas.--bundleOption: This option creates a directory containing all necessary external dependencies, making it easy to ship and deploy applications.- Package Manager Apps: The package manager can now ship top-level command-line applications, not just Julia packages.
The development of this feature involved "years of discussion" to arrive at seemingly simple syntax, underscoring the complexity of programming language design.
AI & Agentic Workflows with Julia
Keno Fischer demonstrates his workflow for using AI agents with Julia, emphasizing three critical components for high productivity:
- Context: Providing the AI with relevant information (codebase, issues, logs).
- Loop Closure: Enabling the AI to independently validate its answers (compile, run tests).
- Sandboxing: Isolating the AI's environment to prevent unintended actions.
Keno developed a Julia project called Cloudbox (written entirely by AI) that leverages Julia's existing tooling for sandboxing and binary building. This allows the AI agent to operate autonomously within a safe environment, even if it attempts destructive commands like rm -rf, as the session is ephemeral. He also uses a GitHub sandboxing mechanism, giving the AI access to its own GitHub organization to create and delete repositories.
The demo shows an AI agent attempting to clone Julia and add a new test for Julia C. Keno notes that while AI is very good at writing Julia code, the workflow is key. He highlights ongoing efforts to improve AI interaction with Julia:
- Fixing Error Messages: Making error messages clearer for AI agents, as confusing messages can repeatedly hinder their progress.
- Building RL Environments: Creating specific training environments for future agents to improve their performance on Julia tasks.
Keno uses AI tools daily, often having an AI agent working on one screen while he handles tasks it's less suited for on another, describing it as creating his "own dream team."
DIAD: Revolutionizing Hardware Engineering
Viral Shah introduces DIAD, a new descriptive language built on top of Julia for modeling and simulation. This project emerged from customer demand for higher levels of abstraction in modeling tools, particularly for complex systems like entire planes (e.g., Boeing's interest).
- Purpose: DIAD aims to modernize antiquated systems programming, offering fast, compact models that can be deployed on embedded systems, leveraging Julia's compiler capabilities.
- Descriptive vs. Imperative: DIAD is a declarative language, focusing on what the model should do rather than how, which is better suited for physical modeling and allows for static checks like unit consistency.
- Textual-Graphical Bridge: A unique feature of DIAD is its one-to-one correspondence between the textual code representation of a model and its graphical diagram. This allows engineers to work interchangeably with code (for version control, AI manipulation) and visual diagrams (for intuitive reasoning and design).
- AI Integration: This bridge is crucial for AI agentic workflows, as Large Language Models (LLMs) excel at manipulating text. Engineers can ask an LLM to generate a model (e.g., a cargo bay door), then visually tweak the diagram, and later ask the AI to modify the model further based on the updated diagram.
- Productivity Gains: DIAD, especially with its agentic capabilities, is showing 10x to potentially 100x productivity improvements for engineers in designing new products, extending the benefits of AI from software to hardware development.
JuliaHub: The Enterprise Platform
JuliaHub is both the name of the company and its flagship cloud product. It's designed for running Julia applications in certified, safety-critical, or regulatory environments (e.g., drug design, automotive, aerospace).
- Key Features:
- Time Capsule: A crucial feature for regulatory compliance, allowing users to go back in time to review data, code, and models from past runs, ensuring reproducibility and auditability.
- Developer Productivity: Facilitates developing Julia programs, running applications like Pumas and DIAD, scaling them with GPUs, and applying AI techniques.
- Package Development Workflows: Supports package developers in the open-source ecosystem by making it easy to register and manage packages.
- Enterprise Focus: JuliaHub acts as a developer productivity tool that brings the best of open-source development practices into corporate environments, akin to GitHub Enterprise.
The Future of Julia: Roadmap & Community Engagement
The team addresses questions about Julia 2.0 and future plans:
- No Concrete Julia 2.0 Planned: The creators believe the language is too mature for another disruptive 2.0 release like the transition to 1.0, which involved significant breaking changes.
- Gradual Evolution: The focus will be on more gradual evolutions for APIs and syntax, allowing users to opt-in to changes.
- Julia C Tooling: Further development will focus on improving tooling around Julia C, particularly for understanding when it works, when it doesn't, and why.
- Interface Support: Interest in adding tooling for interfaces and code correctness checking, especially for large-scale production applications and AI agents.
- GPU Support: The team is actively collaborating with Nvidia on GPU support and encourages community members to voice specific needs through open-source channels.
- Community: Julia has been GitHub native since 2011, one of the first large-scale projects to adopt GitHub, with its entire commit history available. The community is described as welcoming and helpful, with active presence on Slack and Zulip. They acknowledge positive interactions with the Jupiter (Julia, Python, R) community and admire projects like Rust.
Conclusion
The discussion concludes by celebrating Julia's 15-year journey from a solution to the "two-language problem" to a robust ecosystem with over a million users and thousands of contributors. The team's continued innovation, particularly with the Julia 1.12 release's focus on standalone binaries and the groundbreaking DIAD project for hardware engineering, positions Julia at the forefront of AI-assisted development. JuliaHub further extends these capabilities to enterprise and regulatory environments, ensuring reproducibility and high-fidelity modeling. The vibrant and welcoming community remains a cornerstone of Julia's success, inviting new users and contributors to shape its future.
Chat with this Video
AI-PoweredHi! I can answer questions about this video "Open Source Friday: Julia – High-Performance Open Source Language". What would you like to know?