Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cuda update #918

Merged
merged 5 commits into from
Aug 10, 2020
Merged

Cuda update #918

merged 5 commits into from
Aug 10, 2020

Conversation

OpportunityLiu
Copy link
Member

CUDA 11相关支持

@OpportunityLiu OpportunityLiu marked this pull request as ready for review August 8, 2020 11:22
@waruqi waruqi added this to the v2.3.7 milestone Aug 8, 2020
@waruqi
Copy link
Member

waruqi commented Aug 9, 2020

剩下那两处稍微改下吧

@OpportunityLiu
Copy link
Member Author

装了一堆东西,现在不加这两句就找不到头文件了,知道啥情况吗?

   add_includedirs("/usr/include/c++/9")
   add_includedirs("/usr/include/x86_64-linux-gnu/c++/9")

@waruqi
Copy link
Member

waruqi commented Aug 9, 2020

额 找不到啥头文件?是不是编译器的问题 用了clang9? 装了多个版本clang?

@OpportunityLiu
Copy link
Member Author

OpportunityLiu commented Aug 9, 2020

前一个是<new> 后一个是<bits/c++config.h>

In file included from /usr/local/cuda/bin/../targets/x86_64-linux/include/cuda_runtime.h:115:
/usr/local/cuda/bin/../targets/x86_64-linux/include/crt/common_functions.h:103:10: fatal error: 'new' file not found
/usr/include/c++/9/new:39:10: fatal error: 'bits/c++config.h' file not found

@waruqi
Copy link
Member

waruqi commented Aug 9, 2020

不太清楚 可以设下-stdlib=libc++ 试试,我明天也搞个linux环境试试

@OpportunityLiu
Copy link
Member Author

换了gcc就好了,clang就有这个问题,直接/usr/local/cuda/bin/nvcc -allow-unsupported-compiler -ccbin=clang src/main.cu 也一样

@OpportunityLiu
Copy link
Member Author

顺便,用clang的话,默认的c-console模板也编译不过去,一样的问题

orange@orange:~/orange$ xmake f --cc=clang
checking for the architecture ... x86_64
orange@orange:~/orange$ xmake -vr
checking for the g++ ... /usr/bin/g++
checking for the linker (ld) ... g++
checking for the clang ... /usr/bin/clang
checking for the flags (-O3) ... ok
checking for the ccache ... /usr/bin/ccache
[ 50%]: ccache compiling.release src/main.c
/usr/bin/ccache clang -c -fvisibility=hidden -O3 -I/usr/local/include -I/usr/include -Qunused-arguments -m64 -o build/.objs/orange/linux/x86_64/release/src/main.c.o src/main.c
checking for the flags (-MMD -MF) ... ok
checking for the flags (-fcolor-diagnostics) ... ok
[ 75%]: linking.release orange
/usr/bin/g++ -o build/linux/x86_64/release/orange build/.objs/orange/linux/x86_64/release/src/main.c.o -s -L/usr/local/lib -L/usr/lib -m64
error: /usr/bin/ld: build/.objs/orange/linux/x86_64/release/src/main.c.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
collect2: error: ld returned 1 exit status

@OpportunityLiu
Copy link
Member Author

而且ccbin默认会用clang是怎么回事啊

@OpportunityLiu
Copy link
Member Author

装了libstdc++-10-dev好了,clang还认死一个版本的啊

现在用clang报这个

error: @programdir/modules/private/async/runjobs.lua:207: @programdir/modules/private/action/build/object.lua:75: @programdir/modules/core/tools/nvcc.lua:349: /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/type_traits(1384): error: type name is not allowed
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/type_traits(1384): error: type name is not allowed
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/type_traits(1384): error: identifier "__is_same" is undefined
3 errors detected in the compilation of "src/main.cu".

@OpportunityLiu
Copy link
Member Author

装了libstdc++-10-dev好了,clang还认死一个版本的啊

不过按理说装了clang10应该就有这玩意的啊,apt被我折腾坏了?

@waruqi
Copy link
Member

waruqi commented Aug 9, 2020

装了libstdc++-10-dev好了,clang还认死一个版本的啊

现在用clang报这个

error: @programdir/modules/private/async/runjobs.lua:207: @programdir/modules/private/action/build/object.lua:75: @programdir/modules/core/tools/nvcc.lua:349: /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/type_traits(1384): error: type name is not allowed
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/type_traits(1384): error: type name is not allowed
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/type_traits(1384): error: identifier "__is_same" is undefined
3 errors detected in the compilation of "src/main.cu".

clang怎么会跑到 lib/gcc/ 的 c++库里面去?用的是gcc的stdc+++?

@waruqi
Copy link
Member

waruqi commented Aug 9, 2020

装了libstdc++-10-dev好了,clang还认死一个版本的啊

不过按理说装了clang10应该就有这玩意的啊,apt被我折腾坏了?

按理装完clang10 自带这些的 回头我试试

@waruqi
Copy link
Member

waruqi commented Aug 10, 2020

感觉像是你这环境问题,我这边测了下nvcc11+ gcc/clang 都可以么。。不过我的ubuntu 比较老 暂时没 clang10 ,pie有没有都ok

@waruqi
Copy link
Member

waruqi commented Aug 10, 2020

https://apt.llvm.org/

To make

sure always the most recent versions of the packages are installed, we are providing some default packages.
To install all of them (currently version 12):
apt-get install clang-format clang-tidy clang-tools clang clangd libc++-dev libc++1 libc++abi-dev libc++abi1 libclang-dev libclang1 liblldb-dev libllvm-ocaml-dev libomp-dev libomp5 lld lldb llvm-dev llvm-runtime llvm python-clang

看着现在似乎还要额外安装最新的版本 libc++-dev libc++1 libc++abi-dev libc++abi1 啥的。。

@waruqi waruqi merged commit 894b90a into xmake-io:dev Aug 10, 2020
@OpportunityLiu OpportunityLiu deleted the cuda-update branch August 10, 2020 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants