ztxz16 / fastllm

纯c++的全平台llm加速库,支持python调用,chatglm-6B级模型单卡可达10000+token / s,支持glm, llama, moss基座,手机端流畅运行
Apache License 2.0
3.3k stars 337 forks source link

make -j报错 #96

Open 741075810 opened 1 year ago

741075810 commented 1 year ago

In file included from /usr/local/include/c++/10.1.0/cstdint:35, from /opt/module/fastllm-master/include/fastllm.h:9, from /opt/module/fastllm-master/include/devices/cuda/fastllm-cuda.cuh:1, from /opt/module/fastllm-master/src/devices/cuda/fastllm-cuda.cu:9: /usr/local/include/c++/10.1.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options. 32 | #error This file requires compiler and library support \ | ^~~~~ In file included from /usr/local/include/c++/10.1.0/cstdint:35, from /opt/module/fastllm-master/include/fastllm.h:9, from /opt/module/fastllm-master/include/devices/cuda/fastllm-cuda.cuh:1, from /opt/module/fastllm-master/src/devices/cuda/fastllm-cuda.cu:9: /usr/local/include/c++/10.1.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options. 32 | #error This file requires compiler and library support \ | ^~~~~ make[2]: [CMakeFiles/fastllm_tools.dir/src/devices/cuda/fastllm-cuda.cu.o] Error 1 make[2]: Waiting for unfinished jobs.... make[2]: [CMakeFiles/fastllm.dir/src/devices/cuda/fastllm-cuda.cu.o] Error 1 make[2]: Waiting for unfinished jobs.... In function ‘fastllm::ChatGLMModel::LaunchResponseTokens(const std::vector&)::<lambda(fastllm::ChatGLMModel)>’: cc1plus: warning: iteration 2147483647 invokes undefined behavior [-Waggressive-loop-optimizations] /opt/module/fastllm-master/src/models/chatglm.cpp:837:51: note: within this loop 837 | for (int i = 0; i < seqLen - 1; i++) { | ^~~~~~ In function ‘fastllm::ChatGLMModel::LaunchResponseTokens(const std::vector&)::<lambda(fastllm::ChatGLMModel)>’: cc1plus: warning: iteration 2147483647 invokes undefined behavior [-Waggressive-loop-optimizations] /opt/module/fastllm-master/src/models/chatglm.cpp:837:51: note: within this loop 837 | for (int i = 0; i < seqLen - 1; i++) { | ^~~~~~ make[1]: [CMakeFiles/fastllm_tools.dir/all] Error 2 make[1]: Waiting for unfinished jobs.... make[1]: [CMakeFiles/fastllm.dir/all] Error 2 make: [all] Error 2

kiranosora commented 1 year ago

This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

根据报错提示,你漏掉了 -std=c++11 flag,可能是改错了CMakeList.txt文件导致的

741075810 commented 1 year ago

CMakeList.txt 文件我是这样改的 if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread --std=c++11 -O2") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOMINMAX -O2 /std:c++11 /arch:AVX /source-charset:utf-8") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread --std=c++11 -O2 -march=native") endif()

741075810 commented 1 year ago

是我哪里改错了吗

kiranosora commented 1 year ago

用的编译器是gcc吗?版本是多少?如果版本过低建议升级下gcc

741075810 commented 1 year ago

是gcc,版本是10.1.0的,应该不会低了吧

kiranosora commented 1 year ago

清空build目录,重新运行一下cmake,看下CXX_FLAGS是什么

Sberm commented 1 year ago

试下这个:

export CC=`which gcc`
export CXX=`which g++`
huwei02 commented 10 months ago

请问您这个问题解决了吗?我也遇到了

biyou commented 8 months ago

加上这个解决了 set (CMAKE_CXX_STANDARD 11)