# eb-local.mpi ::::{zig:module} eb-local.mpi :file: src/mpi.zig :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig MPI transport checks for `eb-local doctor --mpi`. The overrides are applied only to the hello this module runs. A build does not call this and does not set them. :::: ## Types ::::{zig:type} eb-local.mpi.Transport :signature: pub const Transport = enum :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L14 A site-approved transport. `ofi` uses the Open MPI cm/ofi pair. `ucx` uses the ucx point-to-point layer and turns ofi off. :::{zig:field} eb-local.mpi.Transport.ofi :signature: ofi :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L14 ::: :::{zig:field} eb-local.mpi.Transport.ucx :signature: ucx :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L14 ::: :::: ::::{zig:type} eb-local.mpi.Rank :signature: pub const Rank = struct :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L17 One line of `hello rank=R size=S cpu=C cpus=N`. :::{zig:field} eb-local.mpi.Rank.rank :signature: rank: u32 :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L18 ::: :::{zig:field} eb-local.mpi.Rank.size :signature: size: u32 :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L19 ::: :::{zig:field} eb-local.mpi.Rank.cpu :signature: cpu: i64 :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L20 ::: :::{zig:field} eb-local.mpi.Rank.cpus :signature: cpus: i64 :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L21 ::: :::: ::::{zig:type} eb-local.mpi.Hello :signature: pub const Hello = struct :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L25 The compiler and the two-rank run for one transport. :::{zig:field} eb-local.mpi.Hello.source_error :signature: source_error: ?[]const u8 = null :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L26 ::: :::{zig:field} eb-local.mpi.Hello.missing_compiler :signature: missing_compiler: bool = false :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L27 ::: :::{zig:field} eb-local.mpi.Hello.missing_launcher :signature: missing_launcher: bool = false :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L28 ::: :::{zig:field} eb-local.mpi.Hello.compile_code :signature: compile_code: u32 = 0 :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L29 ::: :::{zig:field} eb-local.mpi.Hello.compile_timeout :signature: compile_timeout: bool = false :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L30 ::: :::{zig:field} eb-local.mpi.Hello.ran :signature: ran: bool = false :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L31 ::: :::{zig:field} eb-local.mpi.Hello.run_code :signature: run_code: u32 = 0 :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L32 ::: :::{zig:field} eb-local.mpi.Hello.run_timeout :signature: run_timeout: bool = false :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L33 ::: :::{zig:field} eb-local.mpi.Hello.ranks :signature: ranks: []const Rank = &.{} :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L34 ::: :::{zig:field} eb-local.mpi.Hello.override_text :signature: override_text: []const u8 = "" :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L36 `OMPI_MCA_pml=... OMPI_MCA_mtl=...`, set only on the hello. ::: :::: ::::{zig:type} eb-local.mpi.Summary :signature: pub const Summary = struct :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L40 A short reading of `fi_info` or `ucx_info`. :::{zig:field} eb-local.mpi.Summary.present :signature: present: bool = false :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L41 ::: :::{zig:field} eb-local.mpi.Summary.line :signature: line: []const u8 = "" :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L42 ::: :::{zig:field} eb-local.mpi.Summary.code :signature: code: u32 = 0 :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L43 ::: :::{zig:field} eb-local.mpi.Summary.timed_out :signature: timed_out: bool = false :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L44 ::: :::: ## Functions :::{zig:function} eb-local.mpi.parseTransport :signature: pub fn parseTransport(name: []const u8) ?Transport :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L66 `ofi` or `ucx`, the only transports a site file may name. ::: :::{zig:function} eb-local.mpi.overrideText :signature: pub fn overrideText(transport: Transport) []const u8 :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L71 The two variables set on the hello, and nowhere else. ::: :::{zig:function} eb-local.mpi.summarize :signature: pub fn summarize(a: Allocator, exe: ?[]const u8, argv: []const []const u8, envp: proc.Envp) Summary :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L109 The first non-empty line of `argv`, at most 160 bytes. ::: :::{zig:function} eb-local.mpi.runHello :signature: pub fn runHello( a: Allocator, transport: Transport, mpicc: ?[]const u8, mpirun: ?[]const u8, work: []const u8, base: *const std.process.Environ.Map, base_envp: proc.Envp) Allocator.Error!Hello :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L132 Compile `work/hello.c` with `mpicc` and run it with `mpirun -np 2`. The two Open MPI variables are added to a copy of `base` for that run. ::: :::{zig:function} eb-local.mpi.parseRanks :signature: pub fn parseRanks(a: Allocator, text: []const u8) Allocator.Error![]const Rank :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L182 Ranks from lines `hello rank=R size=S cpu=C cpus=N`. ::: :::{zig:function} eb-local.mpi.sharedCpu :signature: pub fn sharedCpu(ranks: []const Rank) bool :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/mpi.zig#L210 True when every reported rank ran on one CPU. :::