To get the CPU architecture in Spack format (e.g., neoverse_v2, sapphirerapids) on a Red Hat system, you can use the following command:
bashspack arch
This command will output the detected target architecture, which includes the CPU microarchitecture in Spack's format. For example, on a system with an ARM Neoverse-V2 CPU, it might return something like linux-rocky9-neoverse_v2. Similarly, for Intel Sapphire Rapids, it would return linux-rhel9-sapphirerapids or similar, depending on your OS and compiler.
If you want just the CPU target part (e.g., neoverse_v2), you can use:
bashspack arch -t
This will print only the target architecture, such as neoverse_v2 or sapphirerapids.
Note: If Spack does not detect the correct microarchitecture (e.g., detecting Neoverse-V2 as Neoverse-N1), you may need to update Spack or manually specify the target using the --target flag or by setting the SPACK_TARGET environment variable.
Would you like help troubleshooting a specific detection issue?