From 6c860dce106ad3063cf432d312ff2fc0537b4638 Mon Sep 17 00:00:00 2001 From: shivasankar Date: Fri, 4 Sep 2026 23:31:34 +0900 Subject: [PATCH 1/4] Update mojoblas recipe to 0.2.0 --- recipes/mojoblas/README.md | 45 ++++++++++++++++++++---------------- recipes/mojoblas/recipe.yaml | 15 +++++++----- 2 files changed, 34 insertions(+), 26 deletions(-) diff --git a/recipes/mojoblas/README.md b/recipes/mojoblas/README.md index 9a0b5ada..cb1f5ac2 100644 --- a/recipes/mojoblas/README.md +++ b/recipes/mojoblas/README.md @@ -7,7 +7,7 @@ A high-performance **BLAS (Basic Linear Algebra Subprograms)** implementation written in [Mojo](https://modular.com/mojo). -[![Mojo](https://img.shields.io/badge/mojo-1.0.0b1-orange)](https://docs.modular.com/mojo/manual/) +[![Mojo](https://img.shields.io/badge/mojo-1.0.0-orange)](https://docs.modular.com/mojo/manual/) [![Tests](https://img.shields.io/badge/tests-level1%2F2%2F3-brightgreen)]() [![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE) @@ -27,7 +27,7 @@ The codebase is currently optimized for real scalar data types through Mojo `DTy ### Prerequisites - Pixi -- Mojo `>=1.0.0b1,<2` +- Mojo `>=1.0.0,<2` ### Modular community `mojoBLAS` is available in the modular-community `https://repo.prefix.dev/modular-community` package repository. Add the following to your `channels` list in your `pixi.toml` file: @@ -42,7 +42,7 @@ Then, you can install `mojoBLAS` using any of these methods: 2. In the `pixi.toml` file of your project, add the following dependency: ```toml - mojoblas = "==0.1.0" + mojoblas = "==0.2.0" ``` Then run `pixi install` to download and install the package. @@ -55,7 +55,7 @@ Add the repository to your `pixi.toml`: preview = ["pixi-build"] [dependencies] -mojo = ">=1.0.0b1,<2" +mojo = ">=1.0.0,<2" mojoblas = { git = "https://github.com/shivasankarka/mojoBLAS.git", branch = "main" } ``` @@ -78,26 +78,27 @@ pixi install ### Basic example ```mojo -from mojoblas.src.level1 import dot, axpy, nrm2 +from std.memory.alloc import unsafe_alloc +from mojoblas.level1 import dot, axpy, nrm2 -fn main(): - var x = alloc[Float32](3) - var y = alloc[Float32](3) +def main(): + var x = unsafe_alloc[Scalar[DType.float32]](3) + var y = unsafe_alloc[Scalar[DType.float32]](3) - x[0] = 1.0 - x[1] = 2.0 - x[2] = 3.0 - y[0] = 4.0 - y[1] = 5.0 - y[2] = 6.0 + x[unsafe_offset=0] = 1.0 + x[unsafe_offset=1] = 2.0 + x[unsafe_offset=2] = 3.0 + y[unsafe_offset=0] = 4.0 + y[unsafe_offset=1] = 5.0 + y[unsafe_offset=2] = 6.0 print(dot(3, x, 1, y, 1)) - axpy(3, 2.0, x, 1, y, 1) - print(y[0], y[1], y[2]) + axpy(3, Float32(2.0), x, 1, y, 1) + print(y[unsafe_offset=0], y[unsafe_offset=1], y[unsafe_offset=2]) print(nrm2(3, x, 1)) - x.free() - y.free() + x.unsafe_free() + y.unsafe_free() ``` ### Available routines @@ -132,7 +133,7 @@ pixi run -e bench bench_all ## Project structure -- `src/` - Mojo source for BLAS implementations +- `mojoblas/` - Mojo source for BLAS implementations - `tests/` - Mojo tests and reference data - `benchmarks/` - benchmark scripts and plots - `docs/` - Reference documentation. @@ -152,13 +153,17 @@ pixi run -e bench bench_all - [ ] Complex number support - [ ] GPU acceleration +## Changelog + +See [docs/CHANGELOG.md](https://github.com/shivasankarka/mojoBLAS/blob/main/docs/CHANGELOG.md) for release notes. + ## Contributing Contributions are welcome. If you find a bug or performance issue, please open an issue or submit a pull request. ## License -This project is licensed under the MIT License. See [LICENSE](LICENSE) for details. +This project is licensed under the MIT License. See [LICENSE](https://github.com/shivasankarka/mojoBLAS/blob/main/LICENSE) for details. ## Acknowledgments diff --git a/recipes/mojoblas/recipe.yaml b/recipes/mojoblas/recipe.yaml index c706a9b9..8953751c 100644 --- a/recipes/mojoblas/recipe.yaml +++ b/recipes/mojoblas/recipe.yaml @@ -1,6 +1,7 @@ context: - version: "0.1.0" - mojo_version: "=1.0.0b1" + version: "0.2.0" + mojo_version: "==1.0.0" + max_core_version: "==26.5.0" package: name: "mojoblas" @@ -8,27 +9,29 @@ package: source: - git: https://github.com/shivasankarka/mojoBLAS.git - rev: 9383e06231b9b15bc26d257a140a24d9c47b1395 + rev: 09ad6aa9a24847b7e44bcf81dadf00994f5fe80a build: number: 0 script: - - mkdir -p ${PREFIX}/lib/mojo - - mojo package src -o ${PREFIX}/lib/mojo/mojoblas.mojopkg + - mkdir -p ${{ PREFIX }}/lib/mojo + - mojo precompile -I ${{ PREFIX }}/lib/mojo mojoblas -o ${{ PREFIX }}/lib/mojo/mojoblas.mojoc requirements: host: - mojo-compiler ${{ mojo_version }} + - max-core ${{ max_core_version }} build: - mojo-compiler ${{ mojo_version }} run: - mojo-compiler ${{ mojo_version }} + - max-core ${{ max_core_version }} about: homepage: https://github.com/shivasankarka/mojoBLAS license: MIT license_file: LICENSE - summary: mojoBLAS is a pure, high performance Mojo implementation of BLAS (Basic Linear Algebra Subprograms) routines. + summary: mojoBLAS is a high performance Mojo implementation of BLAS (Basic Linear Algebra Subprograms) routines. repository: https://github.com/shivasankarka/mojoBLAS.git extra: From c78fb46a595875f3fa8160e01d52be6dc34afb4b Mon Sep 17 00:00:00 2001 From: shivasankar Date: Sat, 5 Sep 2026 00:08:09 +0900 Subject: [PATCH 2/4] Pin mojoblas recipe to latest 0.2.0 commit --- recipes/mojoblas/recipe.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/mojoblas/recipe.yaml b/recipes/mojoblas/recipe.yaml index 8953751c..cef188a9 100644 --- a/recipes/mojoblas/recipe.yaml +++ b/recipes/mojoblas/recipe.yaml @@ -9,7 +9,7 @@ package: source: - git: https://github.com/shivasankarka/mojoBLAS.git - rev: 09ad6aa9a24847b7e44bcf81dadf00994f5fe80a + rev: a3e166320716cecd5872c27165d9cef5e3d705a7 build: number: 0 From 7ee7696afb8e8e9b0958bc4f815060f16849c1fc Mon Sep 17 00:00:00 2001 From: shivasankar Date: Sat, 5 Sep 2026 01:20:54 +0900 Subject: [PATCH 3/4] update recipe readme and rev --- recipes/mojoblas/README.md | 105 ++++++++++++++++++++++++++++------- recipes/mojoblas/recipe.yaml | 2 +- 2 files changed, 86 insertions(+), 21 deletions(-) diff --git a/recipes/mojoblas/README.md b/recipes/mojoblas/README.md index cb1f5ac2..4a487579 100644 --- a/recipes/mojoblas/README.md +++ b/recipes/mojoblas/README.md @@ -29,50 +29,115 @@ The codebase is currently optimized for real scalar data types through Mojo `DTy - Pixi - Mojo `>=1.0.0,<2` -### Modular community -`mojoBLAS` is available in the modular-community `https://repo.prefix.dev/modular-community` package repository. Add the following to your `channels` list in your `pixi.toml` file: +mojoBLAS offers several installation methods to suit different development needs. Choose the method that best fits your workflow: + +### Method 1: Git Installation with pixi-build-mojo (Recommended) + +Install mojoBLAS directly from the GitHub repository to access both stable releases and cutting-edge features. This method is perfect for developers who want the latest functionality or need to work with the most recent stable version. + +Add the following to your existing `pixi.toml`: ```toml -channels = ["https://conda.modular.com/max", "https://repo.prefix.dev/modular-community", "conda-forge"] -``` +[workspace] +preview = ["pixi-build"] -Then, you can install `mojoBLAS` using any of these methods: +[package] +name = "your_project_name" +version = "0.1.0" -1. From the `pixi` CLI, run the command ```pixi add mojoblas```. +[package.build] +backend = {name = "pixi-build-mojo", version = "0.*"} -2. In the `pixi.toml` file of your project, add the following dependency: - ```toml - mojoblas = "==0.2.0" - ``` -Then run `pixi install` to download and install the package. +[package.build.config.pkg] +name = "your_package_name" -### Use as a dependency +[package.host-dependencies] +mojo = "==1.0.0" +max-core = "==26.5.0" -Add the repository to your `pixi.toml`: +[package.build-dependencies] +mojo = "==1.0.0" +max-core = "==26.5.0" +mojoblas = { git = "https://github.com/shivasankarka/mojoBLAS.git", branch = "main" } -```toml -[workspace] -preview = ["pixi-build"] +[package.run-dependencies] +mojo = "==1.0.0" +max-core = "==26.5.0" +mojoblas = { git = "https://github.com/shivasankarka/mojoBLAS.git", branch = "main" } [dependencies] mojo = ">=1.0.0,<2" +max-core = ">=26.5.0,<27" mojoblas = { git = "https://github.com/shivasankarka/mojoBLAS.git", branch = "main" } ``` Then run: - ```bash pixi install ``` -### Clone locally +The package will be automatically available in your Pixi environment, and VSCode LSP will provide intelligent code hints. + +### Method 2: Stable Release via Pixi (prefix.dev) + +For most users, we recommend installing a stable release through Pixi for guaranteed compatibility and reproducibility. `mojoBLAS` is available in the modular-community `https://repo.prefix.dev/modular-community` package repository. + +Add the following to your `pixi.toml` file: + +```toml +[workspace] +channels = ["https://conda.modular.com/max", "https://repo.prefix.dev/modular-community", "conda-forge"] + +[dependencies] +mojoblas = "==0.2.0" +``` +Then run: ```bash -git clone https://github.com/shivasankarka/mojoBLAS.git -cd mojoBLAS pixi install ``` +Or, from the `pixi` CLI, run `pixi add mojoblas` in a project whose `channels` already include `https://repo.prefix.dev/modular-community`. + +### Method 3: Build Standalone Package + +This method creates a portable `mojoblas.mojoc` file that you can use across multiple projects, perfect for offline development or hermetic builds. + +1. Clone the repository: + ```bash + git clone https://github.com/shivasankarka/mojoBLAS.git + cd mojoBLAS + ``` + +2. Build the package: + ```bash + pixi run package + ``` + +3. Copy `mojoblas.mojoc` to your project directory or add its parent directory to your include paths. + +### Method 4: Direct Source Integration + +For maximum flexibility and the ability to modify mojoBLAS source code during development: + +1. Clone the repository to your desired location: + ```bash + git clone https://github.com/shivasankarka/mojoBLAS.git + ``` + +2. When compiling your code, include the mojoBLAS source path: + ```bash + mojo run -I "/path/to/mojoBLAS" your_program.mojo + ``` + +3. **VSCode LSP Setup** (for code hints and autocompletion): + - Open VSCode preferences + - Navigate to `Mojo › Lsp: Include Dirs` + - Click `Add Item` and enter the full path to your mojoBLAS directory (e.g., `/Users/YourName/Projects/mojoBLAS`) + - Restart the Mojo LSP server + +After setup, VSCode will provide intelligent code completion and hints for mojoBLAS functions! + ## Usage ### Basic example diff --git a/recipes/mojoblas/recipe.yaml b/recipes/mojoblas/recipe.yaml index cef188a9..f035ae57 100644 --- a/recipes/mojoblas/recipe.yaml +++ b/recipes/mojoblas/recipe.yaml @@ -9,7 +9,7 @@ package: source: - git: https://github.com/shivasankarka/mojoBLAS.git - rev: a3e166320716cecd5872c27165d9cef5e3d705a7 + rev: f18ae33809e7034698ac2aa3adad2f0195087289 build: number: 0 From b094cda680f5ca4ddeb158e9e3e2715fe1a294fd Mon Sep 17 00:00:00 2001 From: shivasankar Date: Sat, 5 Sep 2026 01:35:02 +0900 Subject: [PATCH 4/4] bump rev --- recipes/mojoblas/README.md | 44 ++++++++++++++++++------------------ recipes/mojoblas/recipe.yaml | 2 +- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/recipes/mojoblas/README.md b/recipes/mojoblas/README.md index 4a487579..3dc2fce7 100644 --- a/recipes/mojoblas/README.md +++ b/recipes/mojoblas/README.md @@ -31,7 +31,28 @@ The codebase is currently optimized for real scalar data types through Mojo `DTy mojoBLAS offers several installation methods to suit different development needs. Choose the method that best fits your workflow: -### Method 1: Git Installation with pixi-build-mojo (Recommended) +### Method 1: Stable Release via Pixi (prefix.dev) (Recommended) + +For most users, we recommend installing a stable release through Pixi for guaranteed compatibility and reproducibility. `mojoBLAS` is available in the modular-community `https://repo.prefix.dev/modular-community` package repository. + +Add the following to your `pixi.toml` file: + +```toml +[workspace] +channels = ["https://conda.modular.com/max", "https://repo.prefix.dev/modular-community", "conda-forge"] + +[dependencies] +mojoblas = "==0.2.0" +``` + +Then run: +```bash +pixi install +``` + +Or, from the `pixi` CLI, run `pixi add mojoblas` in a project whose `channels` already include `https://repo.prefix.dev/modular-community`. + +### Method 2: Git Installation with pixi-build-mojo Install mojoBLAS directly from the GitHub repository to access both stable releases and cutting-edge features. This method is perfect for developers who want the latest functionality or need to work with the most recent stable version. @@ -78,27 +99,6 @@ pixi install The package will be automatically available in your Pixi environment, and VSCode LSP will provide intelligent code hints. -### Method 2: Stable Release via Pixi (prefix.dev) - -For most users, we recommend installing a stable release through Pixi for guaranteed compatibility and reproducibility. `mojoBLAS` is available in the modular-community `https://repo.prefix.dev/modular-community` package repository. - -Add the following to your `pixi.toml` file: - -```toml -[workspace] -channels = ["https://conda.modular.com/max", "https://repo.prefix.dev/modular-community", "conda-forge"] - -[dependencies] -mojoblas = "==0.2.0" -``` - -Then run: -```bash -pixi install -``` - -Or, from the `pixi` CLI, run `pixi add mojoblas` in a project whose `channels` already include `https://repo.prefix.dev/modular-community`. - ### Method 3: Build Standalone Package This method creates a portable `mojoblas.mojoc` file that you can use across multiple projects, perfect for offline development or hermetic builds. diff --git a/recipes/mojoblas/recipe.yaml b/recipes/mojoblas/recipe.yaml index f035ae57..eb2ae152 100644 --- a/recipes/mojoblas/recipe.yaml +++ b/recipes/mojoblas/recipe.yaml @@ -9,7 +9,7 @@ package: source: - git: https://github.com/shivasankarka/mojoBLAS.git - rev: f18ae33809e7034698ac2aa3adad2f0195087289 + rev: 4d8df3912b344f7b42fcc282610207a9ce5b8a36 build: number: 0