mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Extended the tensor benchmark suite to support types other than floats
This commit is contained in:
@@ -9,13 +9,13 @@ Eigen::ThreadPool pool(threads); \
|
||||
Eigen::ThreadPoolDevice device(&pool, threads);
|
||||
|
||||
// Simple functions
|
||||
#define BM_FuncCPU(FUNC, THREADS) \
|
||||
static void BM_##FUNC##_##THREADS##T(int iters, int N) { \
|
||||
StopBenchmarkTiming(); \
|
||||
CREATE_THREAD_POOL(THREADS); \
|
||||
BenchmarkSuite<Eigen::ThreadPoolDevice> suite(device, N); \
|
||||
suite.FUNC(iters); \
|
||||
} \
|
||||
#define BM_FuncCPU(FUNC, THREADS) \
|
||||
static void BM_##FUNC##_##THREADS##T(int iters, int N) { \
|
||||
StopBenchmarkTiming(); \
|
||||
CREATE_THREAD_POOL(THREADS); \
|
||||
BenchmarkSuite<Eigen::ThreadPoolDevice, float> suite(device, N); \
|
||||
suite.FUNC(iters); \
|
||||
} \
|
||||
BENCHMARK_RANGE(BM_##FUNC##_##THREADS##T, 10, 5000);
|
||||
|
||||
BM_FuncCPU(memcpy, 4);
|
||||
@@ -80,19 +80,19 @@ BM_FuncCPU(colReduction, 12);
|
||||
|
||||
|
||||
// Contractions
|
||||
#define BM_FuncWithInputDimsCPU(FUNC, D1, D2, D3, THREADS) \
|
||||
static void BM_##FUNC##_##D1##x##D2##x##D3##_##THREADS##T(int iters, int N) {\
|
||||
StopBenchmarkTiming(); \
|
||||
if (THREADS == 1) { \
|
||||
Eigen::DefaultDevice device; \
|
||||
BenchmarkSuite<Eigen::DefaultDevice> suite(device, D1, D2, D3); \
|
||||
suite.FUNC(iters); \
|
||||
} else { \
|
||||
CREATE_THREAD_POOL(THREADS); \
|
||||
BenchmarkSuite<Eigen::ThreadPoolDevice> suite(device, D1, D2, D3); \
|
||||
suite.FUNC(iters); \
|
||||
} \
|
||||
} \
|
||||
#define BM_FuncWithInputDimsCPU(FUNC, D1, D2, D3, THREADS) \
|
||||
static void BM_##FUNC##_##D1##x##D2##x##D3##_##THREADS##T(int iters, int N) { \
|
||||
StopBenchmarkTiming(); \
|
||||
if (THREADS == 1) { \
|
||||
Eigen::DefaultDevice device; \
|
||||
BenchmarkSuite<Eigen::DefaultDevice, float> suite(device, D1, D2, D3); \
|
||||
suite.FUNC(iters); \
|
||||
} else { \
|
||||
CREATE_THREAD_POOL(THREADS); \
|
||||
BenchmarkSuite<Eigen::ThreadPoolDevice, float> suite(device, D1, D2, D3); \
|
||||
suite.FUNC(iters); \
|
||||
} \
|
||||
} \
|
||||
BENCHMARK_RANGE(BM_##FUNC##_##D1##x##D2##x##D3##_##THREADS##T, 10, 5000);
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ BM_FuncWithInputDimsCPU(contraction, N, N, 1, 16);
|
||||
static void BM_##FUNC##_##DIM1##x##DIM2##_##THREADS##T(int iters, int N) { \
|
||||
StopBenchmarkTiming(); \
|
||||
CREATE_THREAD_POOL(THREADS); \
|
||||
BenchmarkSuite<Eigen::ThreadPoolDevice> suite(device, N); \
|
||||
BenchmarkSuite<Eigen::ThreadPoolDevice, float> suite(device, N); \
|
||||
suite.FUNC(iters, DIM1, DIM2); \
|
||||
} \
|
||||
BENCHMARK_RANGE(BM_##FUNC##_##DIM1##x##DIM2##_##THREADS##T, 128, 5000);
|
||||
|
||||
Reference in New Issue
Block a user