mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-25 06:14:59 +00:00
Added official examples from github.com/modular/modular: - gpu-intro, gpu-functions, gpu-block-and-warp (GPU programming) - layout_tensor, layouts (tensor operations) - life (Conway's Game of Life) - operators (custom operators) - process (subprocess handling) - python-interop (Python integration) - testing (unit test patterns) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
75 lines
1.7 KiB
Python
75 lines
1.7 KiB
Python
load("//bazel:api.bzl", "modular_py_binary", "modular_run_binary_test")
|
|
|
|
package(default_visibility = ["//visibility:private"])
|
|
|
|
modular_py_binary(
|
|
name = "hello",
|
|
srcs = ["hello.py"],
|
|
data = ["hello_mojo.mojo"],
|
|
imports = ["."],
|
|
mojo_deps = select({
|
|
"//:emit_mojo_enabled": ["//max:MOGGKernelAPI"],
|
|
"//conditions:default": [],
|
|
}),
|
|
target_compatible_with = select({
|
|
"//:asan": ["@platforms//:incompatible"],
|
|
"//:ubsan": ["@platforms//:incompatible"],
|
|
"//conditions:default": [],
|
|
}),
|
|
deps = [
|
|
"@mojo//:python",
|
|
],
|
|
)
|
|
|
|
modular_py_binary(
|
|
name = "person",
|
|
srcs = ["person.py"],
|
|
data = ["person_module.mojo"],
|
|
imports = ["."],
|
|
mojo_deps = select({
|
|
"//:emit_mojo_enabled": ["//max:MOGGKernelAPI"],
|
|
"//conditions:default": [],
|
|
}),
|
|
target_compatible_with = select({
|
|
"//:asan": ["@platforms//:incompatible"],
|
|
"//:ubsan": ["@platforms//:incompatible"],
|
|
"//conditions:default": [],
|
|
}),
|
|
deps = [
|
|
"@mojo//:python",
|
|
],
|
|
)
|
|
|
|
modular_py_binary(
|
|
name = "mandelbrot",
|
|
srcs = ["mandelbrot.py"],
|
|
data = ["mandelbrot_mojo.mojo"],
|
|
imports = ["."],
|
|
mojo_deps = [
|
|
"//max:layout",
|
|
] + select({
|
|
"//:emit_mojo_enabled": ["//max:MOGGKernelAPI"],
|
|
"//conditions:default": [],
|
|
}),
|
|
target_compatible_with = ["//:has_gpu"],
|
|
deps = [
|
|
"@mojo//:python",
|
|
],
|
|
)
|
|
|
|
modular_run_binary_test(
|
|
name = "hello_test",
|
|
binary = "hello",
|
|
)
|
|
|
|
modular_run_binary_test(
|
|
name = "person_test",
|
|
binary = "person",
|
|
)
|
|
|
|
modular_run_binary_test(
|
|
name = "mandelbrot_test",
|
|
binary = "mandelbrot",
|
|
tags = ["gpu"],
|
|
)
|