mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2024-10-01 01:06:10 -04:00
Add a small program that tests hardware.
This commit is contained in:
parent
2dc26cfd09
commit
14831cd1c0
@ -26,7 +26,7 @@ configure_file(
|
|||||||
# Include the binary directory for the generated header file
|
# Include the binary directory for the generated header file
|
||||||
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
|
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
|
||||||
project(gpt4all VERSION ${APP_VERSION} LANGUAGES CXX)
|
project(gpt4all VERSION ${APP_VERSION} LANGUAGES CXX C)
|
||||||
|
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
set(CMAKE_AUTORCC ON)
|
set(CMAKE_AUTORCC ON)
|
||||||
@ -84,6 +84,8 @@ target_link_libraries(chat
|
|||||||
target_link_libraries(chat
|
target_link_libraries(chat
|
||||||
PRIVATE llama)
|
PRIVATE llama)
|
||||||
|
|
||||||
|
add_executable(test_hw test_hw.cpp)
|
||||||
|
|
||||||
set(COMPONENT_NAME_MAIN ${PROJECT_NAME})
|
set(COMPONENT_NAME_MAIN ${PROJECT_NAME})
|
||||||
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install)
|
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install)
|
||||||
install(TARGETS chat DESTINATION bin COMPONENT ${COMPONENT_NAME_MAIN})
|
install(TARGETS chat DESTINATION bin COMPONENT ${COMPONENT_NAME_MAIN})
|
||||||
|
27
test_hw.cpp
Normal file
27
test_hw.cpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
static bool avx = __builtin_cpu_supports("avx");
|
||||||
|
static bool avx2 = __builtin_cpu_supports("avx2");
|
||||||
|
static bool avx512f = __builtin_cpu_supports("avx512f");
|
||||||
|
static bool avx512vbmi = __builtin_cpu_supports("avx512vbmi");
|
||||||
|
static bool avx512vnni = __builtin_cpu_supports("avx512vnni");
|
||||||
|
static bool fma = __builtin_cpu_supports("fma");
|
||||||
|
static bool f16c = __builtin_cpu_supports("f16c");
|
||||||
|
static bool sse3 = __builtin_cpu_supports("sse3");
|
||||||
|
static std::string s;
|
||||||
|
s = "My hardware supports:\n";
|
||||||
|
s += "AVX = " + std::to_string(avx) + "\n";
|
||||||
|
s += "AVX2 = " + std::to_string(avx2) + "\n";
|
||||||
|
s += "AVX512 = " + std::to_string(avx512f) + "\n";
|
||||||
|
s += "AVX512_VBMI = " + std::to_string(avx512vbmi) + "\n";
|
||||||
|
s += "AVX512_VNNI = " + std::to_string(avx512vnni) + "\n";
|
||||||
|
s += "FMA = " + std::to_string(fma) + "\n";
|
||||||
|
s += "F16C = " + std::to_string(f16c) + "\n";
|
||||||
|
s += "SSE3 = " + std::to_string(sse3) + "\n";
|
||||||
|
printf("%s", s.c_str());
|
||||||
|
fflush(stdout);
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user