Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Add compile flag to choose data type for tensor size due to performance degradation #371

Merged
merged 13 commits into from
Apr 12, 2019
6 changes: 5 additions & 1 deletion mshadow/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,11 @@ const unsigned kRandBufferSize = 1000000;
/*! \brief pi */
const float kPi = 3.1415926f;
/*! \brief type that will be used for index */
typedef int64_t index_t;
#if MSHADOW_INT64_TENSOR_SIZE == 1
typedef int64_t index_t;
#else
typedef int32_t index_t;
#endif

#ifdef _WIN32
/*! \brief openmp index for windows */
Expand Down
4 changes: 2 additions & 2 deletions mshadow/tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -1069,10 +1069,10 @@ inline void BatchGEMM(Tensor<Device, 3, DType> dst,
#define MSHADOW_SCALAR_ double
#include "./expr_scalar-inl.h"
#undef MSHADOW_SCALAR_
#define MSHADOW_SCALAR_ int
#define MSHADOW_SCALAR_ int32_t
#include "./expr_scalar-inl.h"
#undef MSHADOW_SCALAR_
#define MSHADOW_SCALAR_ mshadow::index_t
#define MSHADOW_SCALAR_ int64_t
#include "./expr_scalar-inl.h"
#undef MSHADOW_SCALAR_
#define MSHADOW_SCALAR_ mshadow::half::half_t
Expand Down