// Copyright Naoki Shibata and contributors 2010 - 2021. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #define _DEFAULT_SOURCE #define _XOPEN_SOURCE 700 #include #include #include #include #include #include #include #include #include #include "sleef.h" #include "sleefdft.h" static uint64_t gettime() { struct timespec tp; clock_gettime(CLOCK_MONOTONIC, &tp); return (uint64_t)tp.tv_sec * 1000000000 + ((uint64_t)tp.tv_nsec); } int mode[] = { SLEEF_MODE_MEASURE | SLEEF_MODE_NO_MT, SLEEF_MODE_MEASURE}; #define ENABLE_SP //#define ROUNDTRIP #define REPEAT 2 //#define ENABLE_SLEEP //#define WARMUP int main(int argc, char **argv) { int start = 1, end = 18; if (argc > 1) start = atoi(argv[1]); if (argc > 2) end = atoi(argv[2]); double *din = (double *)Sleef_malloc((1 << 18)*2 * sizeof(double)); double *dout = (double *)Sleef_malloc((1 << 18)*2 * sizeof(double)); float *sin = (float *)Sleef_malloc((1 << 18)*2 * sizeof(float)); float *sout = (float *)Sleef_malloc((1 << 18)*2 * sizeof(float)); SleefDFT_setPlanFilePath(NULL, NULL, SLEEF_PLAN_RESET | SLEEF_PLAN_READONLY); for(int log2n=start;log2n<=end;log2n++) { const int n = 1 << log2n; int64_t niter = (int64_t)(1000000000.0 / REPEAT / n / log2n); printf("%d ", n); for(int m=0;m<2;m++) { #ifdef ENABLE_SLEEP sleep(1); #endif struct SleefDFT *pf = SleefDFT_double_init1d(n, NULL, NULL, mode[m]); #ifdef ROUNDTRIP struct SleefDFT *pb = SleefDFT_double_init1d(n, NULL, NULL, mode[m] | SLEEF_MODE_BACKWARD); #endif for(int i=0;i