fixed cuda err: undefined reference to at::cuda::warp_size()

This commit is contained in:
sugarme 2021-07-24 17:33:17 +10:00
parent 8baf32d860
commit 42fe023433
4 changed files with 26 additions and 10 deletions

View File

@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Nofix]
- ctype `long` caused compiling error in MacOS as noted on [#44]. Not working on linux box.
## [0.4.1]
- fixed cuda error `undefined reference to 'at::cuda::warp_size()'`
## [0.4.0]
- **Update libtorch to 1.9**. Generated **1716 APIs**. There are APIs naming changes ie. `Name1` change to `NameDim` or `NameTensor`.

View File

@ -51,7 +51,7 @@ Gotch is in active development mode and may have API breaking changes. Feel free
```bash
wget https://raw.githubusercontent.com/sugarme/gotch/master/setup-gotch.sh
chmod +x setup-gotch.sh
export CUDA_VER=cpu && export GOTCH_VER=v0.4.0 && bash setup-gotch.sh
export CUDA_VER=cpu && export GOTCH_VER=v0.4.1 && bash setup-gotch.sh
```
### GPU
@ -89,9 +89,9 @@ Gotch is in active development mode and may have API breaking changes. Feel free
wget https://raw.githubusercontent.com/sugarme/gotch/master/setup-gotch.sh
chmod +x setup-gotch.sh
# CUDA 10.1
export CUDA_VER=10.1 && export GOTCH_VER=v0.4.0 && bash setup-gotch.sh
export CUDA_VER=10.1 && export GOTCH_VER=v0.4.1 && bash setup-gotch.sh
# CUDA 11.0
export CUDA_VER=11.0 && export GOTCH_VER=v0.4.0 && bash setup-gotch.sh
export CUDA_VER=11.0 && export GOTCH_VER=v0.4.1 && bash setup-gotch.sh
```
## Examples
@ -175,7 +175,7 @@ mul tensor (ts1 x ts2):
// In-place operation
ts3 := ts.MustOnes([]int64{2, 3}, gotch.Float, gotch.CPU)
fmt.Printf("Before:\n%v", ts3)
ts3.MustAdd1_(ts.FloatScalar(2.0))
ts3.MustAddScalar_(ts.FloatScalar(2.0))
fmt.Printf("After (ts3 + 2.0):\n%v", ts3)
/*
@ -277,6 +277,3 @@ Gotch is Apache 2.0 licensed.
- This project has been inspired and used many concepts from [tch-rs](https://github.com/LaurentMazare/tch-rs)
Libtorch Rust binding.

View File

@ -1,12 +1,20 @@
#include<stdio.h>
#include<stdint.h>
using namespace std;
extern "C" {
void dummy_cuda_dependency();
}
struct cublasContext;
namespace at {
namespace cuda {
cublasContext* getCurrentCUDABlasHandle();
int warp_size();
}
}
char * magma_strerror(int err);
void dummy_cuda_dependency() {
at::cuda::warp_size();
at::cuda::getCurrentCUDABlasHandle();
at::cuda::warp_size();
}

View File

@ -1,6 +1,6 @@
#!/bin/bash
GOTCH_VERSION="${GOTCH_VER:-v0.4.0}"
GOTCH_VERSION="${GOTCH_VER:-v0.4.1}"
CUDA_VERSION="${CUDA_VER:-10.1}"
GOTCH_PATH="$GOPATH/pkg/mod/github.com/sugarme/gotch@$GOTCH_VERSION"
@ -67,17 +67,25 @@ EOT
else
echo "creating $DUMMY_CUDA_FILE for GPU"
sudo tee -a $DUMMY_CUDA_FILE > /dev/null <<EOT
#include<stdio.h>
#include<stdint.h>
using namespace std;
extern "C" {
void dummy_cuda_dependency();
}
struct cublasContext;
namespace at {
namespace cuda {
cublasContext* getCurrentCUDABlasHandle();
int warp_size();
}
}
char * magma_strerror(int err);
void dummy_cuda_dependency() {
at::cuda::warp_size();
at::cuda::getCurrentCUDABlasHandle();
at::cuda::warp_size();
}
EOT