Determine the number of cores at compile time in C/C++

Viewed 2131

Is there a way to determine how many physical cores a target machine has at compile time in C/C++ in Linux under GCC?

I am aware of other methods like td::thread::hardware_concurrency() in C++11 or sysconf(_SC_NPROCESSORS_ONLN) but I am curious to know if there is actually a way to obtain this information at compile time.

1 Answers
Related