当我们有2个带有NVLink硬件组件的NVIDIA/CUDA GPU卡时,如何正确使用-Xnvlink编译器选项



在Debian 10上,我有两个带有NVlink硬件组件的GPU卡RTX A6000,我想利用这两个卡的潜在组合功能。

目前,我有以下magma.make被Makefile调用:

CXX = nvcc -std=c++17 -O3
LAPACK = /opt/intel/oneapi/mkl/latest
LAPACK_ANOTHER=/opt/intel/mkl/lib/intel64
MAGMA = /usr/local/magma
INCLUDE_CUDA=/usr/local/cuda/include
LIBCUDA=/usr/local/cuda/lib64
SEARCH_DIRS_INCL=-I${MAGMA}/include -I${INCLUDE_CUDA} -I${LAPACK}/include
SEARCH_DIRS_LINK=-L${LAPACK}/lib/intel64 -L${LAPACK_ANOTHER} -L${LIBCUDA} -L${MAGMA}/lib
CXXFLAGS = -c -DMAGMA_ILP64 -DMKL_ILP64 -m64 ${SEARCH_DIRS_INCL}
LDFLAGS = ${SEARCH_DIRS_LINK} -lmkl_intel_lp64 -lmkl_gnu_thread -lmkl_core -lgomp -lcuda -lcudart -lcublas -lmagma -lpthread -lm -ldl -Xnvlink
SOURCES = main_magma.cpp XSAF_C_magma.cpp
EXECUTABLE = main_magma.exe

正如你所看到的,我使用了最后一个标志-Xnvlink,但它在编译时会产生以下错误:

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [Makefile:10: main_magma.exe] Error 1

如何使用正确的标志或选项将2个GPU与NVLink的组合电源调用包括在可执行文件中?

我使用了最后一个标志-Xnvlink。。。

让我们查阅一些文档:

The following table lists some useful nvlink options which can be specified with nvcc option --nvlink-options.
4.2.9.2.1. --disable-warnings (-w)
Inhibit all warning messages.
4.2.9.2.2. --preserve-relocs (-preserve-relocs)
Preserve resolved relocations in linked executable.
4.2.9.2.3. --verbose (-v)
Enable verbose mode which prints code generation statistics.
4.2.9.2.4. --warning-as-error (-Werror)
Make all warnings into errors.
4.2.9.2.5. --suppress-arch-warning (-suppress-arch-warning)
Suppress the warning that otherwise is printed when object does not contain code for target arch.
4.2.9.2.6. --suppress-stack-size-warning (-suppress-stack-size-warning)
Suppress the warning that otherwise is printed when stack size cannot be determined.
4.2.9.2.7. --dump-callgraph (-dump-callgraph)
Dump information about the callgraph and register usage.

从文本中可以明显看出,该选项用于控制编译期间的设备链接器行为,而这些都与NVLINK无关,NVLINK是一种硬件互连技术。

如何使用正确的标志或选项将2个GPU与NVLink的组合电源调用包括在可执行文件中?

没有标志或选项。没有编译器辅助的多gpu支持。你必须编写自己的多gpu代码,或者使用别人为你编写的库。如果这样的多gpu代码存在于可执行文件中,则在编译过程中无需任何特殊的编译器选项或标志即可工作。

相关内容

最新更新