Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/cutorch.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/THC
diff options
context:
space:
mode:
authorRui Guo <guorui.xt@gmail.com>2016-10-13 17:22:23 +0300
committerRui Guo <guorui.xt@gmail.com>2016-10-13 17:22:23 +0300
commit01c48cb0966b59b95f7b46334719b2a65fae2bf7 (patch)
treeaf9063f827aad4913001bbeda421c05bbeb8ccba /lib/THC
parentada3cbd4e51788eb3e8999389a4bd6285facbf98 (diff)
changes to make cunn compile on windows with msvc
Diffstat (limited to 'lib/THC')
-rw-r--r--lib/THC/THCDeviceTensor-inl.cuh8
-rw-r--r--lib/THC/THCDeviceTensor.cuh9
-rw-r--r--lib/THC/THCGeneral.h.in2
-rw-r--r--lib/THC/THCTensorTypeUtils.cuh2
4 files changed, 20 insertions, 1 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; \
\