Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

README.md

CMake CPU detect

ci

These CMake functions detect the CPU arch for Intel CPUs on Linux, MacOS and Windows. We focused on Intel CPUs since the Intel compilers (including Intel oneAPI) don't currently have automatic CPU detection. To use -march= features of Intel compilers, -march=native is undocumented and does not actually detect the CPU arch. For CMake with Intel compilers these functions help yield better runtime performance by enabling the features of the Host CPU. The same technique could be used for AMD, ARM, CUDA, etc. in the future.

Result variables

The variable HOST_ARCH is set in the parent scope. HOST_ARCH is empty if CPU arch is not known.

Demo

cmake -B build

will print the CPU family e.g. "icelake-client".

About

CMake: detect CPU arch / model, useful for -march=

Resources

License

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.