xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
10.04k stars 786 forks source link

添加nvidia-hpc-sdk工具链支持 #2327

Closed xiangyi-wang closed 2 years ago

xiangyi-wang commented 2 years ago

Is your feature request related to a problem? Please describe.

添加nvidia-hpc-sdk工具链支持(https://developer.nvidia.cn/nvidia-hpc-sdk-downloads)

Describe the solution you'd like

可以自动识别nvidia-hpc-sdk工具链

Describe alternatives you've considered

No response

Additional context

No response

waruqi commented 2 years ago

dev 支持了,更新到 xmake update dev

目前支持 nvc/nvc++/nvfortran

$ xmake f --toolchain=cuda -c
$ xmake -rv
[ 25%]: ccache compiling.release src/main.f90
/usr/bin/ccache /opt/nvidia/hpc_sdk/Linux_x86_64/22.3/compilers/bin/nvfortran -c -m64 -O3 -o build/.objs/test/linux/x86_64/release/src/main.f90.o src/main.f90
[ 50%]: linking.release test
/opt/nvidia/hpc_sdk/Linux_x86_64/22.3/compilers/bin/nvfortran -o build/linux/x86_64/release/test build/.objs/test/linux/x86_64/release/src/main.f90.o -m64 -s
[100%]: build ok!
$ xmake f --toolchain=cuda -c
$ xmake -rv
[ 25%]: ccache compiling.release src/main.cpp
/usr/bin/ccache /opt/nvidia/hpc_sdk/Linux_x86_64/22.3/compilers/bin/nvc++ -c -m64 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -o build/.objs/test/linux/x86_64/release/src/main.cpp.o src/main.cpp
[ 50%]: linking.release test
/opt/nvidia/hpc_sdk/Linux_x86_64/22.3/compilers/bin/nvc++ -o build/linux/x86_64/release/test build/.objs/test/linux/x86_64/release/src/main.cpp.o -m64 -s
[100%]: build ok!
xiangyi-wang commented 2 years ago

感谢这么快就支持了,不过 我更新到dev后还是有点问题,如果不设置fc,直接执行 xmake f --toolchain=cuda -c仍然使用的gfortran,设置fc后可以看到识别到nvfortran了,但是不识别fc设置的nvfortran image

image

waruqi commented 2 years ago

我这里可以,确认更新到最新 dev

xiangyi-wang commented 2 years ago

除了执行xmake update dev还需要其他操作吗 版本好像还是之前的, 怎么确认更新到dev了··

image

xiangyi-wang commented 2 years ago

刚试了下 从vscode插件切换工具链成功过了 image

waruqi commented 2 years ago

source ~/.xmake/profile

或者重新开下终端

xiangyi-wang commented 2 years ago

可以了 谢谢!