サブロウ丸

Sabrou-mal サブロウ丸

主にプログラミングと数学

Compile error when compiling NCCL with debug mode.

I encountered the following error when I compiled NCCL project.

/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o: in function `_init':
(.init+0xb): relocation truncated to fit: R_X86_64_REX_GOTPCRELX against undefined symbol `__gmon_start__'
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:79: /data/fsdp_overlap/nccl/build/lib/libnccl.so.2.23.4] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/data/fsdp_overlap/nccl/src'
make: *** [Makefile:24: src.build] Error 2 
/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o: in function `_init':
(.init+0xb): relocation truncated to fit: R_X86_64_REX_GOTPCRELX against undefined symbol `__gmon_start__'
/usr/local/cuda/lib64/libcudart_static.a(cudart_static.o): in function `libcudart_static_a6f94ab6c0ab06444b7d93049ccab17f47eb1566':
cuda_runtime_api.cpp:(.text+0x25b): relocation truncated to fit: R_X86_64_REX_GOTPCRELX against symbol `libcudart_static_00c95bd0daa30e5e04ad9822277d74b5bdfbbdfa' defined in .bss section in /usr/local/cuda/lib64/libcudart_static.a(cudart_static.o)
cuda_runtime_api.cpp:(.text+0x2c3): relocation truncated to fit: R_X86_64_REX_GOTPCRELX against symbol `libcudart_static_d211a754ef80c6c38861197c159b6b43c845ba82' defined in .bss section in /usr/local/cuda/lib64/libcudart_static.a(cudart_static.o)
/usr/local/cuda/lib64/libcudart_static.a(cudart_static.o): in function `libcudart_static_313079ffd4d4c60f08b253dd9bf8b37a4f02b768':
cuda_runtime_api.cpp:(.text+0x5fa): relocation truncated to fit: R_X86_64_REX_GOTPCRELX against symbol `libcudart_static_4ba376da84bda8657797681f0a03623f86f70480' defined in .bss section in /usr/local/cuda/lib64/libcudart_static.a(cudart_static.o)
cuda_runtime_api.cpp:(.text+0x663): relocation truncated to fit: R_X86_64_REX_GOTPCRELX against symbol `libcudart_static_ba144f499f77bb129af4093295a2a2e31a537bde' defined in .bss section in /usr/local/cuda/lib64/libcudart_static.a(cudart_static.o)
/usr/local/cuda/lib64/libcudart_static.a(cudart_static.o): in function `libcudart_static_bbbe87671eb47a7d9f8d6fb11b7c043e5ef03630':
(.text+0x1c63): relocation truncated to fit: R_X86_64_REX_GOTPCRELX against symbol `libcudart_static_a05bbe6bad19560d08008f4ac61d197dbc42498e' defined in .bss section in /usr/local/cuda/lib64/libcudart_static.a(cudart_static.o)
/usr/local/cuda/lib64/libcudart_static.a(cudart_static.o): in function `libcudart_static_1db67a9dec28a6380c73db65a619c7e501ce60b7':
(.text+0x1d95): relocation truncated to fit: R_X86_64_REX_GOTPCRELX against symbol `libcudart_static_a05bbe6bad19560d08008f4ac61d197dbc42498e' defined in .bss section in /usr/local/cuda/lib64/libcudart_static.a(cudart_static.o)
/usr/local/cuda/lib64/libcudart_static.a(cudart_static.o): in function `libcudart_static_fd32aa02e459c221f1c5b50c874669578f6a167c':
(.text+0x1dc7): relocation truncated to fit: R_X86_64_REX_GOTPCRELX against symbol `libcudart_static_e3840b81e9f2a2d2ae1bcdecb5df73cbcf25daa8' defined in .bss section in /usr/local/cuda/lib64/libcudart_static.a(cudart_static.o)
/usr/local/cuda/lib64/libcudart_static.a(cudart_static.o): in function `libcudart_static_ff466e58390a44a174cd1b2084ede65f6033356c':
(.text+0x1e17): relocation truncated to fit: R_X86_64_REX_GOTPCRELX against symbol `libcudart_static_e3840b81e9f2a2d2ae1bcdecb5df73cbcf25daa8' defined in .bss section in /usr/local/cuda/lib64/libcudart_static.a(cudart_static.o)
/usr/local/cuda/lib64/libcudart_static.a(cudart_static.o): in function `libcudart_static_5b9bf64834f73ef3a1285c34464d5f5005838db4':
(.text+0x1e71): relocation truncated to fit: R_X86_64_REX_GOTPCRELX against symbol `libcudart_static_aa29f87abcfdc654650132f98a6bd70cd2d0e2c1' defined in .bss section in /usr/local/cuda/lib64/libcudart_static.a(cudart_static.o)
/usr/local/cuda/lib64/libcudart_static.a(cudart_static.o): in function `libcudart_static_0c6abe493211a3a1958f04ab2c2c1b8f0e3a30eb':
(.text+0x1ee1): additional relocation overflows omitted from the output
/data/nccl/build/lib/libnccl.so.2.23.4: PC-relative offset overflow in PLT entry for `sem_destroy@@GLIBC_2.2.5'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:79: /data/nccl/build/lib/libnccl.so.2.23.4] Error 1
make[1]: Leaving directory '/data/nccl/src'
make: *** [Makefile:24: src.build] Error 2

After changing the compile command, the make process was successful. To specify the architecture, the binary size became small.

make NVCC_GENCODE="-gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_80,code=sm_80"