diff options
author | Soumith Chintala <soumith@gmail.com> | 2016-10-13 19:11:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-13 19:11:32 +0300 |
commit | a5778ec9cf3e560cae49b0006c42b40106aedfa3 (patch) | |
tree | af9063f827aad4913001bbeda421c05bbeb8ccba | |
parent | ada3cbd4e51788eb3e8999389a4bd6285facbf98 (diff) | |
parent | 01c48cb0966b59b95f7b46334719b2a65fae2bf7 (diff) |
Merge pull request #543 from BTNC/win-msvc
changes to make cunn compile on windows with msvc
-rw-r--r-- | lib/THC/THCDeviceTensor-inl.cuh | 8 | ||||
-rw-r--r-- | lib/THC/THCDeviceTensor.cuh | 9 | ||||
-rw-r--r-- | lib/THC/THCGeneral.h.in | 2 | ||||
-rw-r--r-- | lib/THC/THCTensorTypeUtils.cuh | 2 | ||||
-rw-r--r-- | torch/utils.h | 2 |
5 files changed, 21 insertions, 2 deletions
diff --git a/lib/THC/THCDeviceTensor-inl.cuh b/lib/THC/THCDeviceTensor-inl.cuh index 9237d07..84cad81 100644 --- a/lib/THC/THCDeviceTensor-inl.cuh +++ b/lib/THC/THCDeviceTensor-inl.cuh @@ -28,7 +28,11 @@ template <typename T, int Dim, typename IndexT, template <typename U> class PtrTraits> __host__ __device__ THCDeviceTensor<T, Dim, IndexT, PtrTraits>:: +#ifdef _MSC_VER +THCDeviceTensor(DataPtrType data, const IndexT (&sizes)[Dim]) +#else THCDeviceTensor(DataPtrType data, const IndexT sizes[Dim]) +#endif : data_(data) { thc_static_assert(Dim > 0); @@ -46,7 +50,11 @@ template <typename T, int Dim, typename IndexT, template <typename U> class PtrTraits> __host__ __device__ THCDeviceTensor<T, Dim, IndexT, PtrTraits>::THCDeviceTensor( +#ifdef _MSC_VER + DataPtrType data, const IndexT (&sizes)[Dim], const IndexT (&strides)[Dim]) +#else DataPtrType data, const IndexT sizes[Dim], const IndexT strides[Dim]) +#endif : data_(data) { thc_static_assert(Dim > 0); diff --git a/lib/THC/THCDeviceTensor.cuh b/lib/THC/THCDeviceTensor.cuh index c6b7899..3122d08 100644 --- a/lib/THC/THCDeviceTensor.cuh +++ b/lib/THC/THCDeviceTensor.cuh @@ -70,12 +70,21 @@ class THCDeviceTensor { /// Constructor that calculates strides with no padding __host__ __device__ THCDeviceTensor(DataPtrType data, +#ifdef _MSC_VER + const IndexT (&sizes)[Dim]); +#else const IndexT sizes[Dim]); +#endif /// Constructor that takes arbitrary size/stride arrays __host__ __device__ THCDeviceTensor(DataPtrType data, +#ifdef _MSC_VER + const IndexT (&sizes)[Dim], + const IndexT (&strides)[Dim]); +#else const IndexT sizes[Dim], const IndexT strides[Dim]); +#endif /// Returns true if the two tensors are of the same dimensionality, /// size and stride. diff --git a/lib/THC/THCGeneral.h.in b/lib/THC/THCGeneral.h.in index ce3ffc5..515b616 100644 --- a/lib/THC/THCGeneral.h.in +++ b/lib/THC/THCGeneral.h.in @@ -20,8 +20,10 @@ #ifdef _WIN32 # ifdef THC_EXPORTS # define THC_API THC_EXTERNC __declspec(dllexport) +# define THC_CLASS __declspec(dllexport) # else # define THC_API THC_EXTERNC __declspec(dllimport) +# define THC_CLASS __declspec(dllimport) # endif #else # define THC_API THC_EXTERNC diff --git a/lib/THC/THCTensorTypeUtils.cuh b/lib/THC/THCTensorTypeUtils.cuh index 4f5d516..81051f7 100644 --- a/lib/THC/THCTensorTypeUtils.cuh +++ b/lib/THC/THCTensorTypeUtils.cuh @@ -33,7 +33,7 @@ struct TensorUtils { #define TENSOR_UTILS(TENSOR_TYPE, DATA_TYPE, ACC_DATA_TYPE) \ template <> \ - struct TensorUtils<TENSOR_TYPE> { \ + struct THC_CLASS TensorUtils<TENSOR_TYPE> { \ typedef DATA_TYPE DataType; \ typedef ACC_DATA_TYPE AccDataType; \ \ diff --git a/torch/utils.h b/torch/utils.h index a11b842..ae959b7 100644 --- a/torch/utils.h +++ b/torch/utils.h @@ -17,7 +17,7 @@ #endif #ifdef _WIN32 -# ifdef torch_EXPORTS +# ifdef cutorch_EXPORTS # define TORCH_API TORCH_EXTERNC __declspec(dllexport) # else # define TORCH_API TORCH_EXTERNC __declspec(dllimport) |