einsums.hardware#
Note
This page is generated by apiary from the binding
annotations and the package’s Python source. Do not edit by hand.
Summary#
cpu_brand— The CPU brand string: sysctl on macOS, CPUID on x86-64, /proc/cpuinfo on other Linux.default_profile_path— Where a tune writes this machine’s profile:<cache-dir>/profiles/<fingerprint>.json.get_max_threads— The OpenMP runtime’s current ceiling on a parallel region’s team size.machine_fingerprint— This machine’s fingerprint, the name its profile is filed under.omp_min_parallel_elements— Elements below which an elementwise loop should not be parallelized.omp_min_parallel_flops— Work, in flops, below which parallelizing a contraction is a net loss.omp_region_cost_ns— Cost in nanoseconds of entering and leaving an OpenMP parallel region.physical_memory_bytes— Physical memory in bytes.profile_header_json—profile_headeras JSON text, for tests and scripts that assemble a profile.profile_path— The file the profile in effect came from, or empty when none was found.profile_reason— Why the profile in effect is not plainly loaded, or empty when it is.profile_search_path— Every place a profile is looked for, in order, after a named file.profile_state— The state of the profile in effect, by name (seeto_string).region_cost_is_calibrated— Whetheromp_region_cost_nscame from the hardware profile, not an in-process measurement. Also true single-threaded (the cost is zero) and when pinned.set_num_threads— Set the OpenMP runtime’s ceiling on a parallel region’s team size.tune— Measure this machine and write its hardware profile, or report on the profile in effect.
Functions#
- einsums.hardware.cpu_brand() str#
The CPU brand string: sysctl on macOS, CPUID on x86-64, /proc/cpuinfo on other Linux.
Added in version 2.0.0.
- Returns:
The brand, or “Unknown CPU” when the platform will not say.
- einsums.hardware.default_profile_path() str#
Where a tune writes this machine’s profile:
<cache-dir>/profiles/<fingerprint>.json.Added in version 2.0.0.
- Returns:
The path, or empty when there is no cache directory.
- einsums.hardware.get_max_threads() int#
The OpenMP runtime’s current ceiling on a parallel region’s team size.
omp_get_max_threads(): what is in effect now, not whatOMP_NUM_THREADSrequested. 1 without OpenMP.Added in version 2.0.0.
- Returns:
The team size a parallel region would get right now.
- einsums.hardware.machine_fingerprint() str#
This machine’s fingerprint, the name its profile is filed under.
Added in version 2.0.0.
- Returns:
fingerprintofmachine_identity.
- einsums.hardware.omp_min_parallel_elements() int#
Elements below which an elementwise loop should not be parallelized.
The region cost at a conservative one element per nanosecond.
--einsums:hardware:omp-min-parallel-elementspins it.
- einsums.hardware.omp_min_parallel_flops() int#
Work, in flops, below which parallelizing a contraction is a net loss.
The region cost times a multiplier calibrated end to end on tiled CCSD residuals.
--einsums:hardware:omp-min-parallel-flopspins it.
- einsums.hardware.omp_region_cost_ns() float#
Cost in nanoseconds of entering and leaving an OpenMP parallel region.
An empty region at the current team size, warm team, best of several trials: around 20 us on a 10-thread machine. Read from the hardware profile (written only by
einsums-tune) when it has an entry for the current team size, otherwise measured, which drifts by tens of percent per process.--einsums:hardware:omp-region-cost-nspins it.
- einsums.hardware.physical_memory_bytes() int#
Physical memory in bytes.
Added in version 2.0.0.
- Returns:
The total, or zero when the platform will not say.
- einsums.hardware.profile_header_json() str#
profile_headeras JSON text, for tests and scripts that assemble a profile.Added in version 2.0.0.
- Returns:
The canonical JSON.
- einsums.hardware.profile_path() str#
The file the profile in effect came from, or empty when none was found.
Added in version 2.0.0.
- Returns:
The path.
- einsums.hardware.profile_reason() str#
Why the profile in effect is not plainly loaded, or empty when it is.
Added in version 2.0.0.
- Returns:
The reason.
- einsums.hardware.profile_search_path() list[str]#
Every place a profile is looked for, in order, after a named file.
Added in version 2.0.0.
- Returns:
The paths, existing or not.
- einsums.hardware.profile_state() str#
The state of the profile in effect, by name (see
to_string).Added in version 2.0.0.
- Returns:
The name.
- einsums.hardware.region_cost_is_calibrated() bool#
Whether
omp_region_cost_nscame from the hardware profile, not an in-process measurement. Also true single-threaded (the cost is zero) and when pinned.
- einsums.hardware.set_num_threads(nthreads: int) None#
Set the OpenMP runtime’s ceiling on a parallel region’s team size.
omp_set_num_threads(), which also governs OpenMP-threaded BLAS; for a per-thread BLAS setting seeeinsums::blas::set_num_threads_this_thread. A no-op without OpenMP.Added in version 2.0.0.
- Parameters:
nthreads – Thread count ceiling to request.
- einsums.hardware.tune(args: list[str]) int#
Measure this machine and write its hardware profile, or report on the profile in effect.
The one implementation behind the
einsums-tuneexecutable,einsumstuneandpython-meinsums.tune. Without an action it measures GEMM efficiency, memory and cache bandwidth, permute throughput, call overhead, per-kernel thread efficiency and the OpenMP region cost, and writes them as one profile, by default this machine’s in the cache directory. The actions report instead:--showthe profile in effect and why one is not used,--checkwhether a current one applies,--exportits path, and--importadopts a file measured elsewhere.--helplists every argument.The runtime must be running; its own
--einsums:*options amongargsare skipped.Added in version 2.0.0.
- Parameters:
args – The arguments, without the program name.
- Returns:
The exit status: 0 on success, 1 when an action reports failure, 2 for bad arguments.