Installation Error: `__USE_FAST_MATH__` was undefined (GPU Version)
- Dominant language
- C++
- Stars
- 3.4k
- Forks
- 701
- PR merge metrics
- No merged PRs in 30d
Description
I was trying to manually install the GPU version on Ubuntu 16.04 but with the following issue when `make -j 1`:
```txt
/usr/local/cuda-8.0/include/device_functions.hpp(1469): error: identifier "__USE_FAST_MATH__" is undefined
/usr/local/cuda-8.0/include/math_functions.hpp(1236): error: identifier "__USE_FAST_MATH__" is undefined in device code
/usr/local/cuda-8.0/include/math_functions.hpp(1245): error: identifier "__USE_FAST_MATH__" is undefined in device code
/usr/local/cuda-8.0/include/math_functions.hpp(1254): error: identifier "__USE_FAST_MATH__" is undefined in device code
/usr/local/cuda-8.0/include/math_functions.hpp(1278): error: identifier "__USE_FAST_MATH__" is undefined in device code
/usr/local/cuda-8.0/include/math_functions.hpp(1287): error: identifier "__USE_FAST_MATH__" is undefined in device code
/usr/local/cuda-8.0/include/math_functions.hpp(1296): error: identifier "__USE_FAST_MATH__" is undefined in device code
/usr/local/cuda-8.0/include/math_functions.hpp(1305): error: identifier "__USE_FAST_MATH__" is undefined in device code
/usr/local/cuda-8.0/include/math_functions.hpp(1349): error: identifier "__USE_FAST_MATH__" is undefined in device code
/usr/local/cuda-8.0/include/math_functions.hpp(1358): error: identifier "__USE_FAST_MATH__" is undefined in device code
/usr/local/cuda-8.0/include/math_functions.hpp(1585): error: identifier "__USE_FAST_MATH__" is undefined in device code
11 errors detected in the compilation of "/tmp/tmpxft_001a09fd_00000000-23_gpu-merge3.compute_30.cpp3.i".
CMake Error at dynet_generated_gpu-merge3.cu.o.cmake:262 (message):
Error generating file
/public/bowenmao2/anaconda3/envs/dynet-gpu-py36/dynet-base/dynet/build/dynet/CMakeFiles/dynet.dir//./dynet_generated_gpu-merge3.cu.o
dynet/CMakeFiles/dynet.dir/build.make:661: recipe for target 'dynet/CMakeFiles/dynet.dir/dynet_generated_gpu-merge3.cu.o' failed
make[2]: *** [dynet/CMakeFiles/dynet.dir/dynet_generated_gpu-merge3.cu.o] Error 1
CMakeFiles/Makefile2:85: recipe for target 'dynet/CMakeFiles/dynet.dir/all' failed
make[1]: *** [dynet/CMakeFiles/dynet.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
```
The full logs are here: https://gist.github.com/maobowen/1b0c15c11419810f20954451ef0c72ef.
It seems that macro `__USE_FAST_MATH__` was undefined somewhere. Any idea to fix that? Thanks.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the GPU build with make -j 1 on Ubuntu 16.04 and CUDA 8.0, then review the linked full log around the generated dynet_generated_gpu-merge3.cu.o failure and the CUDA headers. Done means the GPU build completes without the __USE_FAST_MATH__ compilation errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100