Maskrcnn-benchmark: Build error under Mac OS X 10.13.6 (no instance of function template "THCCeilDiv" matches)

Created on 21 Dec 2018  路  5Comments  路  Source: facebookresearch/maskrcnn-benchmark

馃悰 Bug

To Reproduce

Steps to reproduce the behavior:

  1. Follow the install.md, and when arrive at the last step for Mac OS X, run it:
  2. MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py build develop
  3. 4 errors occured:

/github/maskrcnn-benchmark/maskrcnn_benchmark/csrc/cuda/ROIPool_cuda.cu(129): error: no instance of function template "THCCeilDiv" matches the argument list
argument types are: (long long, long)

/github/maskrcnn-benchmark/maskrcnn_benchmark/csrc/cuda/ROIPool_cuda.cu(129): error: no instance of overloaded function "std::min" matches the argument list
argument types are: (<error-type>, long)

/github/maskrcnn-benchmark/maskrcnn_benchmark/csrc/cuda/ROIPool_cuda.cu(176): error: no instance of function template "THCCeilDiv" matches the argument list
argument types are: (int64_t, long)

/github/maskrcnn-benchmark/maskrcnn_benchmark/csrc/cuda/ROIPool_cuda.cu(176): error: no instance of overloaded function "std::min" matches the argument list
argument types are: (<error-type>, long)

Expected behavior


No build errors.

Environment

Collecting environment information...
PyTorch version: 1.0.0a0+cb79e1b
Is debug build: No
CUDA used to build PyTorch: 9.2

OS: Mac OSX 10.13.6
GCC version: Could not collect
CMake version: version 3.12.4

Python version: 3.6
Is CUDA available: Yes
CUDA runtime version: 9.2.148
GPU models and configuration: Nvidia Gforce GT750M
Nvidia driver version: 387.10.10.10.40.108
cuDNN version: Probably one of the following:
/usr/local/cuda/lib/libcudnn.7.dylib
/usr/local/cuda/lib/libcudnn.dylib
/usr/local/cuda/lib/libcudnn_static.a

Versions of relevant libraries:
[pip] numpy (1.14.0)
[pip] numpydoc (0.7.0)
[pip] torch (1.0.0a0+cb79e1b)
[pip] torchvision (0.2.1)
[conda] mkl 2018.0.1 hfbd8650_4
[conda] mkl-service 1.1.2 py36h7ea6df4_4
[conda] torch 1.0.0a0+cb79e1b
[conda] torch 0.5.0a0+a24163a
[conda] torchvision 0.2.1

Additional context


No.

contributions welcome enhancement needs discussion

Most helpful comment

Finally, I built it successfully.
Modified 4 lines: ROIPool_cuda.cu(Ln129, Ln176), ROIAlign_cuda.cu(Ln275, Ln320).
BTW, when linking ,another error reported:

clang++ -bundle -undefined dynamic_lookup -L/anaconda3/lib -arch x86_64 -L/anaconda3/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.7-x86_64-3.6/Users/enwei/github/maskrcnn-benchmark/maskrcnn_benchmark/csrc/vision.o build/temp.macosx-10.7-x86_64-3.6/Users/enwei/github/maskrcnn-benchmark/maskrcnn_benchmark/csrc/cpu/ROIAlign_cpu.o build/temp.macosx-10.7-x86_64-3.6/Users/enwei/github/maskrcnn-benchmark/maskrcnn_benchmark/csrc/cpu/nms_cpu.o build/temp.macosx-10.7-x86_64-3.6/Users/enwei/github/maskrcnn-benchmark/maskrcnn_benchmark/csrc/cuda/nms.o build/temp.macosx-10.7-x86_64-3.6/Users/enwei/github/maskrcnn-benchmark/maskrcnn_benchmark/csrc/cuda/ROIPool_cuda.o build/temp.macosx-10.7-x86_64-3.6/Users/enwei/github/maskrcnn-benchmark/maskrcnn_benchmark/csrc/cuda/ROIAlign_cuda.o -L/usr/local/cuda/lib64 -lcudart -o build/lib.macosx-10.7-x86_64-3.6/maskrcnn_benchmark/_C.cpython-36m-darwin.so
ld: warning: directory not found for option '-L/usr/local/cuda/lib64'
ld: library not found for -lcudart
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang++' failed with exit status 1

I found libcudart.dylib in /usr/local/cuda/lib, but there is no lib64 directory, so I created a symbolic link to lib, named 'lib64'.

The last 2 lines of the building process are:
Processing dependencies for maskrcnn-benchmark==0.1
Finished processing dependencies for maskrcnn-benchmark==0.1

All 5 comments

Hum, this is interesting, I wonder if this is something that was changed recently in PyTorch.

Can you try replacing
https://github.com/facebookresearch/maskrcnn-benchmark/blob/61ffdb3803db562c23d883439aee16e599c051e6/maskrcnn_benchmark/csrc/cuda/ROIPool_cuda.cu#L129
by

dim3 grid(std::min(THCCeilDiv((long)output_size, 512L), 4096L));

and similarly in the other places and report back?

@fmassa , thanks!
I've tried your modification, added a (long) into the line, before output_size. It compiled, with no error or warning.
I'll try this method to the other places.

Finally, I built it successfully.
Modified 4 lines: ROIPool_cuda.cu(Ln129, Ln176), ROIAlign_cuda.cu(Ln275, Ln320).
BTW, when linking ,another error reported:

clang++ -bundle -undefined dynamic_lookup -L/anaconda3/lib -arch x86_64 -L/anaconda3/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.7-x86_64-3.6/Users/enwei/github/maskrcnn-benchmark/maskrcnn_benchmark/csrc/vision.o build/temp.macosx-10.7-x86_64-3.6/Users/enwei/github/maskrcnn-benchmark/maskrcnn_benchmark/csrc/cpu/ROIAlign_cpu.o build/temp.macosx-10.7-x86_64-3.6/Users/enwei/github/maskrcnn-benchmark/maskrcnn_benchmark/csrc/cpu/nms_cpu.o build/temp.macosx-10.7-x86_64-3.6/Users/enwei/github/maskrcnn-benchmark/maskrcnn_benchmark/csrc/cuda/nms.o build/temp.macosx-10.7-x86_64-3.6/Users/enwei/github/maskrcnn-benchmark/maskrcnn_benchmark/csrc/cuda/ROIPool_cuda.o build/temp.macosx-10.7-x86_64-3.6/Users/enwei/github/maskrcnn-benchmark/maskrcnn_benchmark/csrc/cuda/ROIAlign_cuda.o -L/usr/local/cuda/lib64 -lcudart -o build/lib.macosx-10.7-x86_64-3.6/maskrcnn_benchmark/_C.cpython-36m-darwin.so
ld: warning: directory not found for option '-L/usr/local/cuda/lib64'
ld: library not found for -lcudart
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang++' failed with exit status 1

I found libcudart.dylib in /usr/local/cuda/lib, but there is no lib64 directory, so I created a symbolic link to lib, named 'lib64'.

The last 2 lines of the building process are:
Processing dependencies for maskrcnn-benchmark==0.1
Finished processing dependencies for maskrcnn-benchmark==0.1

Great, thanks for letting me know. I'll try to see what's the best way to fix the error you faced.

The adding 'long' modification works for me. I'm using Pytorch 1.0.

Was this page helpful?
0 / 5 - 0 ratings