deleted dummy_cuda and bump version

This commit is contained in:
sugarme 2021-07-26 18:00:24 +10:00
parent dd03baa6b0
commit 6c38d54cec
8 changed files with 10 additions and 93 deletions

View File

@ -10,6 +10,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.4]
- Dropped libtch `dummy_cuda_dependency()` and `fake_cuda_dependency()` as libtorch ldd linking Okay now.
## [0.4.3]
- Export nn/scheduler DefaultSchedulerOptions()

View File

@ -22,7 +22,7 @@ Gotch is in active development mode and may have API breaking changes. Feel free
## Installation
- Default CUDA version is `10.2` if CUDA is available otherwise using CPU version.
- Default CUDA version is `11.1` if CUDA is available otherwise using CPU version.
- Default Pytorch C++ API version is `1.9.0`
**NOTE**: `libtorch` will be installed at **`/usr/local/lib`**
@ -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.3 && bash setup-gotch.sh
export CUDA_VER=cpu && export GOTCH_VER=v0.4.4 && 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.2
export CUDA_VER=10.2 && export GOTCH_VER=v0.4.3 && bash setup-gotch.sh
export CUDA_VER=10.2 && export GOTCH_VER=v0.4.4 && bash setup-gotch.sh
# CUDA 11.1
export CUDA_VER=11.1 && export GOTCH_VER=v0.4.3 && bash setup-gotch.sh
export CUDA_VER=11.1 && export GOTCH_VER=v0.4.4 && bash setup-gotch.sh
```
## Examples

View File

@ -1,20 +0,0 @@
#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::getCurrentCUDABlasHandle();
at::cuda::warp_size();
}

View File

@ -1,5 +0,0 @@
extern "C" {
void dummy_cuda_dependency();
}
void dummy_cuda_dependency() {}

View File

@ -1,11 +0,0 @@
package libtch
// #cgo CFLAGS: -I${SRCDIR} -O3 -Wall -Wno-unused-variable -Wno-deprecated-declarations -Wno-c++11-narrowing -g -Wno-sign-compare -Wno-unused-function
// #cgo CFLAGS: -I/usr/local/include
// #cgo CFLAGS: -D_GLIBCXX_USE_CXX11_ABI=1
// #cgo LDFLAGS: -lstdc++ -ltorch -lc10 -ltorch_cpu -L/lib64
// #cgo CXXFLAGS: -std=c++17 -I${SRCDIR} -g -O3
// #cgo CFLAGS: -I${SRCDIR}/libtorch/lib -I${SRCDIR}/libtorch/include -I${SRCDIR}/libtorch/include/torch/csrc/api/include -I${SRCDIR}/libtorch/include/torch/csrc
// #cgo LDFLAGS: -L${SRCDIR}/libtorch/lib
// #cgo CXXFLAGS: -I${SRCDIR}/libtorch/lib -I${SRCDIR}/libtorch/include -I${SRCDIR}/libtorch/include/torch/csrc/api/include -I${SRCDIR}/libtorch/include/torch/csrc
import "C"

View File

@ -1,9 +0,0 @@
package libtch
// #cgo LDFLAGS: -lstdc++ -ltorch -lc10 -ltorch_cpu
// #cgo LDFLAGS: -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcudnn -lcaffe2_nvrtc -lnvrtc-builtins -lnvrtc -lnvToolsExt -lc10_cuda -ltorch_cuda
// #cgo CFLAGS: -I${SRCDIR} -O3 -Wall -Wno-unused-variable -Wno-deprecated-declarations -Wno-c++11-narrowing -g -Wno-sign-compare -Wno-unused-function
// #cgo CFLAGS: -D_GLIBCXX_USE_CXX11_ABI=1
// #cgo CFLAGS: -I/usr/local/cuda/include
// #cgo CXXFLAGS: -std=c++17 -I${SRCDIR} -g -O3
import "C"

View File

@ -1,7 +1,7 @@
#!/bin/bash
GOTCH_VERSION="${GOTCH_VER:-v0.4.3}"
CUDA_VERSION="${CUDA_VER:-10.2}"
GOTCH_VERSION="${GOTCH_VER:-v0.4.4}"
CUDA_VERSION="${CUDA_VER:-11.1}"
GOTCH_PATH="$GOPATH/pkg/mod/github.com/sugarme/gotch@$GOTCH_VERSION"
# Install gotch
@ -24,14 +24,6 @@ cd $cwd
# Setup gotch for CUDA or non-CUDA device:
#=========================================
DUMMY_CUDA_FILE="$GOTCH_PATH/libtch/dummy_cuda_dependency.cpp"
# Check and delete old file if existing
if [ -f $DUMMY_CUDA_FILE ]
then
echo "$DUMMY_CUDA_FILE existing. Deleting..."
sudo rm $DUMMY_CUDA_FILE
fi
GOTCH_LIB_FILE="$GOTCH_PATH/libtch/lib.go"
if [ -f $GOTCH_LIB_FILE ]
then
@ -41,15 +33,6 @@ fi
# Create files for CUDA or non-CUDA device
if [ $CUDA_VERSION == "cpu" ]; then
echo "creating $DUMMY_CUDA_FILE for CPU"
sudo tee -a $DUMMY_CUDA_FILE > /dev/null <<EOT
extern "C" {
void dummy_cuda_dependency();
}
void dummy_cuda_dependency() {}
EOT
echo "creating $GOTCH_LIB_FILE for CPU"
sudo tee -a $GOTCH_LIB_FILE > /dev/null <<EOT
package libtch
@ -65,30 +48,6 @@ package libtch
import "C"
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::getCurrentCUDABlasHandle();
at::cuda::warp_size();
}
EOT
echo "creating $GOTCH_LIB_FILE for GPU"
sudo tee -a $GOTCH_LIB_FILE > /dev/null <<EOT
package libtch

View File

@ -1,7 +1,7 @@
#!/bin/bash
LIBTORCH_VERSION="${LIBTORCH_VER:-1.9.0}"
CUDA_VERSION="${CUDA_VER:-10.2}"
CUDA_VERSION="${CUDA_VER:-11.1}"
if [[ -z "${CUDA_VERSION}"=="cpu" ]]; then
CU_VERSION="cpu"