cuDNN 7.2 mnist test fails to compile on Ubuntu 16.04

I’m trying to verify my installation of cuDNN 7.2.1 after successfully building CUDA 9.2 on ubuntu 16.04 for python 3.7 with nvidia-396.54 video driver.

When I try to compile the mnistCUDNN example it fails with the following output:

bjarne@huygens-hpc:~/cudnn_samples_v7/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 fp16_dev.cu
/usr/local/cuda/include/cuda_fp16.h(134): error: cannot overload functions distinguished by return type alone

/usr/local/cuda/include/cuda_fp16.hpp(377): error: cannot overload functions distinguished by return type alone

fp16_emu.h(65): error: invalid redeclaration of type name "__half_raw"
/usr/local/cuda/include/cuda_fp16.hpp(122): here

fp16_emu.h(82): error: class "__half" has no member "x"

fp16_emu.h(89): error: class "__half" has no member "x"

fp16_emu.h(97): error: class "__half" has no member "x"

fp16_emu.h(97): error: class "__half" has no member "x"

fp16_emu.h(104): error: class "__half" has no member "x"

fp16_emu.h(104): error: class "__half" has no member "x"

fp16_emu.h(111): error: class "__half" has no member "x"

fp16_emu.h(111): error: class "__half" has no member "x"

fp16_emu.h(118): error: class "__half" has no member "x"

fp16_emu.h(126): error: class "__half" has no member "x"

fp16_emu.h(134): error: class "__half" has no member "x"

fp16_emu.h(143): error: class "__half" has no member "x"

fp16_emu.h(152): error: class "__half" has no member "x"

Segmentation fault (core dumped)
Makefile:203: recipe for target 'fp16_dev.o' failed
make: *** [fp16_dev.o] Error 139

I have no idea how to solve this issue. Trawling through google has yet to give me any indication as to what is the root of this error. I tried switching from gcc-5 to gcc-6 as the default c compiler, but that only seemed to anger it (saying versions above 5 was not supported)

If you need any more information, please don’t hesitate to ask!