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

Build error on Ubuntu 16.04 and Cuda 7.5 #75

Closed
FabbyD opened this issue Mar 10, 2017 · 2 comments
Closed

Build error on Ubuntu 16.04 and Cuda 7.5 #75

FabbyD opened this issue Mar 10, 2017 · 2 comments

Comments

@FabbyD
Copy link

FabbyD commented Mar 10, 2017

As the title says, I fail to build the source files.

$ git clone https://github.com/NVIDIA/nccl.git
$ cd ncll
$ make CUDA_HOME=/usr/local/cuda test
Compiling src/libwrap.cu                      > /home/fabrice/nccl/build/obj/libwrap.o
/usr/include/string.h: In function ‘void* __mempcpy_inline(void*, const void*, size_t)’:
/usr/include/string.h:652:42: error: ‘memcpy’ was not declared in this scope
   return (char *) memcpy (__dest, __src, __n) + __n;
                                          ^
Makefile:109: recipe for target '/home/fabrice/nccl/build/obj/libwrap.o' failed
make: *** [/home/fabrice/nccl/build/obj/libwrap.o] Error 1

My setup:

  • Ubuntu 16.04
  • Cuda 7.5
  • gcc 5.4

Anyone else had that error before?

EDIT:
It seems like others had similar issues (here, here and here). Adding the magic flag CXXFLAGS += -D_FORCE_INLINES allows me to go a bit further but then I get this error:

$ make CUDA_HOME=/usr/local/cuda test
Compiling src/core.cu                         > /home/fabrice/nccl/build/obj/core.o
Compiling src/all_gather.cu                   > /home/fabrice/nccl/build/obj/all_gather.o
Compiling src/all_reduce.cu                   > /home/fabrice/nccl/build/obj/all_reduce.o
Compiling src/broadcast.cu                    > /home/fabrice/nccl/build/obj/broadcast.o
Compiling src/reduce.cu                       > /home/fabrice/nccl/build/obj/reduce.o
Compiling src/reduce_scatter.cu               > /home/fabrice/nccl/build/obj/reduce_scatter.o
Linking   libnccl.so.1.3.3                    > /home/fabrice/nccl/build/lib/libnccl.so.1.3.3
/usr/bin/ld: /home/fabrice/nccl/build/obj/libwrap.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/home/fabrice/nccl/build/obj/libwrap.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:93: recipe for target '/home/fabrice/nccl/build/lib/libnccl.so.1.3.3' failed
make: *** [/home/fabrice/nccl/build/lib/libnccl.so.1.3.3] Error 1

EDIT2:
Adding -D_FORCE_LINES to NVCUFLAGS (line 26) instead of CXXFLAGS made it work:
NVCUFLAGS := -D_FORCE_INLINES -ccbin $(CXX) $(NVCC_GENCODE) -lineinfo -std=c++11 -maxrregcount 96

Output:

$ make CUDA_HOME=/usr/local/cuda test
Grabbing  src/nccl.h                          > /home/fabrice/nccl/build/include/nccl.h
Compiling src/libwrap.cu                      > /home/fabrice/nccl/build/obj/libwrap.o
Compiling src/core.cu                         > /home/fabrice/nccl/build/obj/core.o
Compiling src/all_gather.cu                   > /home/fabrice/nccl/build/obj/all_gather.o
Compiling src/all_reduce.cu                   > /home/fabrice/nccl/build/obj/all_reduce.o
Compiling src/broadcast.cu                    > /home/fabrice/nccl/build/obj/broadcast.o
Compiling src/reduce.cu                       > /home/fabrice/nccl/build/obj/reduce.o
Compiling src/reduce_scatter.cu               > /home/fabrice/nccl/build/obj/reduce_scatter.o
Linking   libnccl.so.1.3.3                    > /home/fabrice/nccl/build/lib/libnccl.so.1.3.3
Building  test/single/all_gather_test.cu      > /home/fabrice/nccl/build/test/single/all_gather_test
Building  test/single/all_gather_scan.cu      > /home/fabrice/nccl/build/test/single/all_gather_scan
Building  test/single/all_reduce_test.cu      > /home/fabrice/nccl/build/test/single/all_reduce_test
Building  test/single/all_reduce_scan.cu      > /home/fabrice/nccl/build/test/single/all_reduce_scan
Building  test/single/broadcast_test.cu       > /home/fabrice/nccl/build/test/single/broadcast_test
Building  test/single/broadcast_scan.cu       > /home/fabrice/nccl/build/test/single/broadcast_scan
Building  test/single/reduce_test.cu          > /home/fabrice/nccl/build/test/single/reduce_test
Building  test/single/reduce_scan.cu          > /home/fabrice/nccl/build/test/single/reduce_scan
Building  test/single/reduce_scatter_test.cu  > /home/fabrice/nccl/build/test/single/reduce_scatter_test
Building  test/single/reduce_scatter_scan.cu  > /home/fabrice/nccl/build/test/single/reduce_scatter_scan

Don't ask me why. Magic.

@FabbyD FabbyD changed the title Build error: error: ‘memcpy’ was not declared in this scope Build error on Ubuntu 16.04 Mar 10, 2017
@FabbyD FabbyD changed the title Build error on Ubuntu 16.04 Build error on Ubuntu 16.04 and Cuda 7.5 Mar 10, 2017
@hsaputra
Copy link

Any update on this?

@sjeaugey
Copy link
Member

From what I can see searching for this online, this is a general issue with recent gcc versions which break the older nvcc in cuda 7.5.

So I would think that it should be a general Ubuntu 16.04+CUDA7.5 recipe to add -D_FORCE_INLINES to nvcc for all situations, not specifically for NCCL. Maybe defining an alias with : alias nvcc='nvcc -D_FORCE_INLINES' would solve the issue on such systems. It seems to me it would be a more sensible solution than adding this define in every CUDA project.

Let me know if you disagree or if I missed a use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants