Mojo module
info
Implements methods for querying the host target info.
You can import these APIs from the sys package. For example:
from sys import CompilationTarget
print(CompilationTarget.is_x86())Structs
- CompilationTarget: A struct that provides information about a target architecture.
Functions
- align_of: Returns the align of (in bytes) of the type.
- alignof:
- bit_width_of: Returns the size of (in bits) of the type.
- bitwidthof:
- has_accelerator: Returns True if the host system has an accelerator and False otherwise.
- has_amd_gpu_accelerator: Returns True if the host system has an AMD GPU and False otherwise.
- has_apple_gpu_accelerator: Returns True if the host system has a Metal GPU and False otherwise. Returns: True if the host system has a Metal GPU.
- has_nvidia_gpu_accelerator: Returns True if the host system has an NVIDIA GPU and False otherwise.
- is_32bit: Returns True if the maximum integral value is 32 bit.
- is_64bit: Returns True if the maximum integral value is 64 bit.
- is_amd_gpu: Returns True if the target triple of the compiler isamdgcn-amd-amdhsaFalse otherwise.
- is_apple_gpu: Returns True if the target triple is for Apple GPU (Metal) and False otherwise. Returns: True if the triple target is Apple GPU and False otherwise.
- is_big_endian: Returns True if the target's endianness is big and False otherwise.
- is_gpu: Returns True if the target triple is GPU and False otherwise.
- is_little_endian: Returns True if the target's endianness is little and False otherwise.
- is_nvidia_gpu: Returns True if the target triple of the compiler isnvptx64-nvidia-cudaFalse otherwise.
- is_triple: Returns True if the target triple of the compiler matches the input and False otherwise.
- num_logical_cores: Returns the number of hardware threads, including hyperthreads across all CPU sockets.
- num_performance_cores: Returns the number of physical performance cores across all CPU sockets. If not known, returns the total number of physical cores.
- num_physical_cores: Returns the number of physical cores across all CPU sockets.
- platform_map: Helper for defining a compile time value depending on the current compilation target, raising a compilation error if trying to access the value on an unsupported target.
- simd_bit_width: Returns the vector size (in bits) of the specified target.
- simd_byte_width: Returns the vector size (in bytes) of the specified target.
- simd_width_of: Returns the vector size of the type on the host system.
- simdbitwidth:
- simdbytewidth:
- simdwidthof:
- size_of: Returns the size of (in bytes) of the type.
- sizeof:
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!
