bmsherman/cublas

Build failure: Cannot find a definition for `cusparseSolvePolicy_t' in the header file.

cjeast opened this issue · 4 comments

Using:

  • commit 78267cb
  • CUDA 6.5
  • Ubuntu 14.04.1 LTS
  • c2hs version 0.20.1
Building cublas-0.2.1.0...
Preprocessing library cublas-0.2.1.0...
c2hs: Errors during expansion of binding hooks:


./Foreign/CUDA/Cusparse/Types.chs:42: (column 9) [ERROR]  >>> Unknown identifier!
  Cannot find a definition for `cusparseSolvePolicy_t' in the header file.
./Foreign/CUDA/Cusparse/Types.chs:38: (column 60) [ERROR]  >>> Unknown identifier!
  Cannot find a definition for `bsrsm2Info_t' in the header file.
./Foreign/CUDA/Cusparse/Types.chs:37: (column 66) [ERROR]  >>> Unknown identifier!
  Cannot find a definition for `bsrilu02Info_t' in the header file.
./Foreign/CUDA/Cusparse/Types.chs:36: (column 63) [ERROR]  >>> Unknown identifier!
  Cannot find a definition for `bsric02Info_t' in the header file.
./Foreign/CUDA/Cusparse/Types.chs:35: (column 60) [ERROR]  >>> Unknown identifier!
  Cannot find a definition for `bsrsv2Info_t' in the header file.
./Foreign/CUDA/Cusparse/Types.chs:34: (column 66) [ERROR]  >>> Unknown identifier!
  Cannot find a definition for `csrilu02Info_t' in the header file.
./Foreign/CUDA/Cusparse/Types.chs:33: (column 63) [ERROR]  >>> Unknown identifier!
  Cannot find a definition for `csric02Info_t' in the header file.
./Foreign/CUDA/Cusparse/Types.chs:32: (column 60) [ERROR]  >>> Unknown identifier!
  Cannot find a definition for `csrsv2Info_t' in the header file.

The definitions seem to be there:

$ nl /usr/local/cuda-6.5/targets/x86_64-linux/include/cusparse.h | grep cusparseSolvePolicy_t | head
   151  } cusparseSolvePolicy_t;
$ nl /usr/local/cuda-6.5/targets/x86_64-linux/include/cusparse.h | grep bsrilu02Info_t
   102  typedef struct bsrilu02Info *bsrilu02Info_t;

Thanks for your detailed bug report! I actually am also running Ubuntu 14.04 and so I just tested building the cublas package with the same commit, CUDA version, Ubuntu version, and c2hs version as you listed. The package builds successfully for me.

I would imagine that the issue might be due to your having an unexpected directory structure for your CUDA install. The autoconf program which configures the relevant directories finds your CUDA installation by figuring out where the nvcc program is on your path. If nvcc has the following path:

f1/f2/f3/nvcc

, then the directory

f1/f2/include/

is set as the include path for c2hs. If this doesn't match the directory structure of your CUDA installation, then I imagine that explains the reason the cublas package doesn't build.

It's hard for me to imagine a perfect solution to this issue. You should be able to hack around the issue to fix it for yourself by editing the configure.ac file appropriately and recompiling the configure script with autoconf.

(My installation, for example, has the nvcc and cusparse.h files located in

/usr/local/cuda-6.5/bin/nvcc
/usr/local/cuda-6.5/include/cusparse.h

)

Brilliant, thank you very much.

As you guessed, the issue here was the path to nvcc. On my system:

  • the package nvidia-cuda-toolkit provides /usr/bin/nvcc
  • the package cuda-core-6-5 provides /usr/local/cuda-6.5/bin/nvcc

The script was finding the wrong nvcc binary. The fix was to alter the path to put /usr/local/cuda-6.5/bin in ahead of /usr/bin

Are there plans for a hackage release of cublas-0.2.1.0?

I'm glad that you were able to work it out. It's too bad I can't think of a neater way to do the installation. I've been told about pkgconfig but I can attest that even my CUDA installation didn't produce a pkgconfig record.

I hadn't noticed that I never pushed the CUDA 6.5 updates to Hackage. Thanks for pointing that out! I'll put cublas-0.2.1.0 up on Hackage within the next week.

Okay, I have added some documentation to the README regarding PATH issues, and I uploaded cublas-0.2.1.0 up to Hackage.