Skip to content

Commit

Permalink
Added some more documentation, and support for cuda 10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
chewxy committed May 5, 2020
1 parent a587ef5 commit 5b83640
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 7 deletions.
40 changes: 33 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This package mostly depends on built-in packages. There are two external depende
* [errors](https://github.com/pkg/errors), which is licenced under a [MIT-like](https://github.com/pkg/errors/blob/master/LICENSE) licence. This package is used for wrapping errors and providing a debug trail.
* [assert](https://github.com/stretchr/testify), which is licenced under a [MIT-like](https://github.com/stretchr/testify/blob/master/LICENSE) licence. This package is used for quick and easy testing.

However, package `cu` DOES depend on one major external dependency: CUDA. Specifically, it requires the CUDA driver. Thankfully nvidia has made this rather simple - everything that is required can be installed with one click: [CUDA Toolkit 8.0](https://developer.nvidia.com/cuda-toolkit)
However, package `cu` DOES depend on one major external dependency: CUDA. Specifically, it requires the CUDA driver. Thankfully nvidia has made this rather simple - everything that is required can be installed with one click: [CUDA Toolkit](https://developer.nvidia.com/cuda-toolkit).


To verify that this library works, install and run the `cudatest` program, which accompanies this package:
Expand All @@ -31,14 +31,15 @@ cudatest
You should see something like this if successful:

```
CUDA version: 8000
CUDA version: 10020
CUDA devices: 1
Device 0
========
Name : "GeForce GTX 960"
Clock Rate: 1177500 kHz
Memory : 4233297920 bytes
Compute : 5.2
Name : "TITAN RTX"
Clock Rate: 1770000 kHz
Memory : 25393561600 bytes
Compute : 7.5
```

## Windows ##
Expand All @@ -55,6 +56,31 @@ To setup the compiler:
2. In `c:\msys64\msys2_shell.cmd` uncomment the line with `set MSYS2_PATH_TYPE=inherit` (this makes Windows PATH variable visible)
3. Install `go` in MSYS2 (64 bit) with `pacman -S go`

## FAQ ##

Here is a common list of problems that you may encounter.

### ld: cannot find -lcuda (Linux) ###

Checklist:

* [ ] Installed CUDA and applied the relevant [post-installation steps](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions)?
* [ ] Checked that the sample programs in the CUDA install all works?
* [ ] Checked the output of `ld -lcuda --verbose`?
* [ ] Checked that there is a `libcuda.so` in the given search paths?
* [ ] Checked that the permissions on `libcuda.so` is correct?

**Note**, depending on how you install CUDA on Linux, sometimes the `.so` file is not properly linked. For example: in CUDA 10.2 on Ubuntu, the default `.deb` installation installs the shared object file to `/usr/lib/x86_64-linux-gnu/libcuda.so.1`. However `ld` searches only for `libcuda.so`. So the solution is to symlink `libcuda.so.1` to `libcuda.so`, like so:

```
sudo ln -s /PATH/TO/libcuda.so.1 /PATH/TO/libcuda.so
```

Be careful when using `ln`. This author spent several hours being tripped up by permissions issues.




# Progress #
The work to fully represent the CUDA Driver API is a work in progress. At the moment, it is not complete. However, most of the API that are required for GPGPU purposes are complete. None of the texture, surface and graphics related APIs are handled yet. Please feel free to send a pull request.

Expand All @@ -79,4 +105,4 @@ We understand that this package is an interfacing package with a third party API


# Licence #
The package is licenced with a MIT-like licence. Ther is one file (`cgoflags.go`) where code is directly copied and two files (`execution.go` and `memory.go`) where code was partially copied from Arne Vansteenkiste's package, which is unlicenced (but to be safe, just assume a GPL-like licence, as [mumax/3](https://github.com/mumax/3) is licenced under GPL).
The package is licenced with a MIT-like licence. Ther is one file (`cgoflags.go`) where code is directly copied and two files (`execution.go` and `memory.go`) where code was partially copied from Arne Vansteenkiste's package, which is unlicenced (but to be safe, just assume a GPL-like licence, as [mumax/3](https://github.com/mumax/3) is licenced under GPL).
1 change: 1 addition & 0 deletions cgoflags.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package cu
//#cgo linux,windows CFLAGS: -I/usr/local/cuda/include/
//
////default location if not properly symlinked:
//#cgo linux LDFLAGS:-L/usr/local/cuda-10.2/lib64 -L/usr/local/cuda-10.2/lib
//#cgo linux LDFLAGS:-L/usr/local/cuda-10.1/lib64 -L/usr/local/cuda-10.1/lib
//#cgo linux LDFLAGS:-L/usr/local/cuda-6.0/lib64 -L/usr/local/cuda-6.0/lib
//#cgo linux LDFLAGS:-L/usr/local/cuda-5.5/lib64 -L/usr/local/cuda-5.5/lib
Expand Down

0 comments on commit 5b83640

Please sign in to comment.