未验证 提交 8c296dea 编写于 作者: P Pei Yang 提交者: GitHub

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

上级 4a5de144
......@@ -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 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册