fix compile error(cpuid.h not found) on nvidia jetson platforms. test=develop (#24329)

revert-24314-dev/fix_err_msg
Pei Yang 5 years ago committed by GitHub
parent 4a5de14426
commit 8c296dea75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,6 +4,7 @@ endif()
if (WITH_NV_JETSON)
add_definitions(-DWITH_NV_JETSON)
set(paddle_known_gpu_archs "53 62 72")
set(paddle_known_gpu_archs7 "53")
set(paddle_known_gpu_archs8 "53 62")

@ -139,6 +139,7 @@ bool MayIUse(const cpu_isa_t cpu_isa) {
if (cpu_isa == isa_any) {
return true;
} else {
#ifndef WITH_NV_JETSON
int reg[4];
cpuid(reg, 0);
int nIds = reg[0];
@ -164,6 +165,7 @@ bool MayIUse(const cpu_isa_t cpu_isa) {
return (reg[1] & avx512f_mask) != 0;
}
}
#endif
return false;
}
}

@ -40,12 +40,14 @@ limitations under the License. */
#ifdef _WIN32
#define cpuid(reg, x) __cpuidex(reg, x, 0)
#else
#ifndef WITH_NV_JETSON
#include <cpuid.h>
inline void cpuid(int reg[4], int x) {
__cpuid_count(x, 0, reg[0], reg[1], reg[2], reg[3]);
}
#endif
#endif
#endif
namespace paddle {
namespace platform {

Loading…
Cancel
Save