identifier "__float2half_rn" is undefined

Hi all,

I am trying to install cuda-9.1 in my system. So I am following the installation steps provided in the site.
In cuDNN installation step 2.4 for verifying it is mention that:

To verify that cuDNN is installed and is running properly, compile the mnistCUDNN

Following show the procedure:

~/cuda_CNN_9.1/mnistCUDNN$ make clean && make
rm -rf *o
rm -rf mnistCUDNN
/usr/local/cuda/bin/nvcc -ccbin g++ -I/usr/local/cuda/include -IFreeImage/include -m64 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_53,code=compute_53 -o fp16_dev.o -c error: identifier “__float2half_rn” is undefined
detected during instantiation of “void gpu_float2half_rn(int, const value_type *, half1 *) [with value_type=float]”
(36): here

1 error detected in the compilation of “/tmp/tmpxft_00005a41_00000000-9_fp16_dev.compute_53.cpp1.ii”.
Makefile:203: recipe for target ‘fp16_dev.o’ failed
make: *** [fp16_dev.o] Error 1

I could not find solution for this error. Please help me if anybody have occured and solve this issue. Thanks

I am facing the same issue.

I have CUDA 9.1 and CUDA 8.0 installed in parallel and likewise cuDNN 7 & 6 installed together. When I try to compile the mnist sample code from version 7 cuDNN - everything is fine and I get test passed but I get the above error as mentioned by @gyanendro19 while I run the sample for version 6 cuDNN.

Any help will be appreciated !

The error mentioned first in this thread is a compile error, not something you would see when running a compiled code.

CUDNN versions are additionally versioned against the version of CUDA that they are supposed to be used with.

I don’t see a CUDNN v6 on that is versioned against CUDA 9 or CUDA 9.1, so if you are attempting to build mnist from CUDNN 6 on a system that is set up to use CUDA 9 or CUDA 9.1, that is an unsupported scenario.

I totally understand that this is a compile error. the current active version I have is CUDA 8.0 (changed my .bashrc to reflect this) but the nvidia drivers are the same from 9.1.

Now with that when I compile the mnist sample from cuDNN v7 i don’t see any compile errors but the above mentioned errors reflect when I compile the sample code from v6 of cuDNN.

what output do you get when you type

nvcc --version

at a command prompt?

what is the exact name of the cudnn 6 file that you downloaded from

output from nvcc --version

nvcc: NVIDIA ® Cuda compiler driver
Copyright © 2005-2016 NVIDIA Corporation
Built on Tue_Jan_10_13:22:03_CST_2017
Cuda compilation tools, release 8.0, V8.0.61

for cuDNN this is the debian file that I downloaded:


what is the result of running

/usr/local/cuda/bin/nvcc --version


I was able to reproduce this.

Install CUDA 8
Install CUDNN 6
here you can successfully make the mnistCUDNN sample
Install CUDA 9
now if you try to make the sample, you get the error reported (even if you set your PATH to point to /usr/local/cuda-8.0/bin)

This is due to the fact that the mnistCUDNN sample Makefile assumes /usr/local/cuda/bin is the correct path to CUDA 8 nvcc. However, when you install CUDA 9, the /usr/local/cuda symlink is changed.

I can think of two options:

  1. modify the Makefile to change all references to /usr/local/cuda to /usr/local/cuda-8.0
  1. change your /usr/local/cuda symlink which is pointing to CUDA 9 to point to CUDA 8.

The Makefile change is really easy.

The second line of the Makefile reads like this:

CUDA_PATH ?= /usr/local/cuda

change it to this:

CUDA_PATH ?= /usr/local/cuda-8.0

even easier (no changes to the Makefile), just do:

CUDA_PATH=/usr/local/cuda-8.0 make

Can Ubuntu install two different versions of cuda, if the scenario happened that cndnn v5 doesn’t compare to cuda 9.1? Can I install cuda8 on the computer that has installed cuda9.1? because now the nvidia web is under maintanence, the user can’t download cudnn 7 …

I am able to download cudnn software right at this moment (just checked). I’m in the US so possibly it may be different if you are elsewhere, but I’m not aware of maintenance affecting one country but not another.

Anyway yes its possible to do side-by-side CUDA installs. I just did that exact thing while working on this.

However, the methodology will be different depending on if you are using the runfile installer method vs. the .deb install method.

For a deb install, if you have CUDA 9.1 already properly installed and running, you should be able to install CUDA 8 alongside it by:

sudo apt-get install cuda-toolkit-8-0

My issue got solved. It was due to a different version of cuda. I have installed cuda8.0 first and then when I installed cuda9.1 it didn’t update /usr/local/cuda folder, therefore, there was compilation error above. When I copied all content of cuda9.1 to cuda folder the issued resolved.

Now I have another issue.

I was installing in same manner on a new system but cuda was not installed before and on doing the same process without checking I have deleted the /usr/local/cuda content and it was actually a link folder where got deleted all the content from cuda9.1. So cuda9.1 folder is empty now. I am unable to install or uninstall now. How could I resolved this? Please suggest me. Thank you

If you are located in PRC, yours is not the first report of encountering what appears to be a fake maintenance message when trying to download CUDNN.

Based on messages posted in these forums this seems to affect only people in PRC, so my guess is that this a problem related to internet limitations originating in the PRC. Some PRC residents have found that CUDNN downloads work without problems when attempted using VPN via sites outside PRC. From what I understand, the PRC government imposes legal restrictions on the use of VPN …

@txbob - Thanks for looking into the issue and clarifying it. It works when I make the changes to the Makefile. Thanks !!