eb-local.cpumask¶
- module eb-local.cpumask src/cpumask.zig[source][autodoc]¶
eb-local --cpu-target: build for another CPU target on this machine.The target is an EESSI software subdirectory. A build for it runs in one of four routes:
native(the host already is the target),cpuid(the host CPU shows the target’s identity to every child process: CPUID faulting on x86_64, a maskedgetauxvaland/proc/cpuinfoon aarch64),kvmandtcg(a virtual machine, run byeb-local __vm-run). This file holds the target and profile data, the route choice, the preflight decision, the files of the cpuid route and the provenance record. The process handling stays in main.zig.
Types¶
- pub const Host = struct[source][autodoc]¶
What the choice of a route needs to know about this machine.
- pub const Observed = struct[source][autodoc]¶
What the build script saw inside the mask. A null field was not observable: the tool is missing.
- archdetect: ?[]const u8 = null[source]¶
The output of
eessi_archdetect.sh cpupath: subdirectories separated by ‘:’.
Functions¶
- pub fn resolveTarget(a: Allocator, text: []const u8) Resolved[source][autodoc]¶
The subdirectory
textnames: a full subdirectory, or a short name that one known subdirectory ends in.
- pub fn parseProfiles(a: Allocator, text: []const u8) []Profile[source][autodoc]¶
The profiles in
text, in file order.
- pub fn builtinProfiles(a: Allocator) []Profile[source][autodoc]¶
The profiles that ship with eb-local.
- pub fn findProfile(profiles: []const Profile, subdir: []const u8) ?Profile[source][autodoc]¶
The profile for
subdir, or null.
- pub fn rulesFile(a: Allocator, p: Profile) []const u8[source][autodoc]¶
The rule lines of
pas cpuidmask reads them from CPUIDMASK_RULES.
- pub fn maskedCpuinfo(a: Allocator, p: Profile, host: []const u8) []const u8[source][autodoc]¶
host, the text of /proc/cpuinfo, as it reads on the target: the identity fields ofp, and without the flagspdrops. Lines that name nothing the profile changes stay as they are.
- pub fn cpuidProblem(a: Allocator, target: []const u8, profile: ?Profile, host: Host) ?[]const u8[source][autodoc]¶
Why the cpuid route cannot present
targetonhost, or null when it can.
- pub fn choose(a: Allocator, mode: Mode, target: []const u8, profile: ?Profile, host: Host) Choice[source][autodoc]¶
The route for
target. The target the host already is needs no mask.
- pub fn preflight(a: Allocator, p: Profile, route: Route, obs: Observed) []const Finding[source][autodoc]¶
Compare what the detectors report with
p. Every detector must name the target; a build that goes on with one that does not would install a tree labelled for one CPU and compiled for another.
- pub fn refused(findings: []const Finding) bool[source][autodoc]¶
Whether any finding refuses the build.
- pub fn cpuinfoField(text: []const u8, key: []const u8) ?[]const u8[source][autodoc]¶
The first value of
keyin /proc/cpuinfo text.
- pub fn faultingAvailable() bool[source][autodoc]¶
Whether the kernel lets this process turn on CPUID faulting.
- pub fn readFile(a: Allocator, path: []const u8, limit: usize) ?[]const u8[source][autodoc]¶
The first
limitbytes of the regular filepath, or null.
- pub fn readHost(a: Allocator, subdir: ?[]const u8, vm_helper: bool) ?Host[source][autodoc]¶
This machine as the route choice sees it.
subdiris the detected EESSI subdirectory of the host,vm_helperwhether__vm-runexists.
- pub fn hostModel(a: Allocator) []const u8[source][autodoc]¶
A one-line name of the host CPU, for the provenance record.
- pub fn kernelRelease(a: Allocator) []const u8[source][autodoc]¶
The running kernel’s release, from /proc/sys/kernel/osrelease.
- pub fn cacheKey(a: Allocator, triple: []const u8, libc: []const u8) []const u8[source][autodoc]¶
The cache key of the compiled libraries: the sources, the compiler’s target triple and the C library’s version. A library built against one glibc does not load into every other.
- pub fn ensureLibs(a: Allocator, envp: proc.Envp, path_env: []const u8, cache_home: []const u8, failure: *[]const u8) ?Libs[source][autodoc]¶
The preload library and probe for this host, compiled with the host’s cc into
cache_home/eb-local/mask-KEYon first use. A static binary cannot be preloaded into the dynamically linked programs of a build, so the library is built from the C source embedded here.
- pub fn namespaceWords(a: Allocator, unshare: []const u8, setpriv: ?[]const u8, fake: []const u8) []const []const u8[source][autodoc]¶
The words in front of the build command for the cpuid route: an unprivileged user and mount namespace that keeps the caller’s uid (a mapped root makes OpenMPI’s prterun refuse to start), with
fakebound over /proc/cpuinfo. The ambient capabilities the namespace gives are dropped before the command runs whensetprivexists.
- pub fn maskVariables(a: Allocator, p: Profile, libs: Libs, rules_path: []const u8, hooks_path: []const u8, self_exe: []const u8, route: Route, allow_archspec: bool) []const [2][]const u8[source][autodoc]¶
The variables the masked command gets.
- pub fn provenanceJson(a: Allocator, p: Provenance) []const u8[source][autodoc]¶
The text of easybuild/eb-local-build-mode.json.
Constants¶
- pub const hooks_py = @embedFile("mask_hooks_py")[source][autodoc]¶
EasyBuild hooks that chain the site’s and pin the GROMACS SIMD level.