#ifdef USE_OPENCL #include "opencl/tensor.hpp" OpenCL openCL; // TODO: Scalar mult #elif USE_CPU #include "cpu/tensor.hpp" #endif #include #include #include // TODO: TMult >2 class Profiler { public: static void measure(const std::string &operation, std::function op) { auto start = std::chrono::high_resolution_clock::now(); op(); auto end = std::chrono::high_resolution_clock::now(); auto duration = std::chrono::duration_cast(end - start); std::cout << operation << ": " << duration.count() / 1000000.0f << "s\n"; } }; int main() { #ifdef USE_OPENCL openCL.init(); #endif Tensor a = Tensor({2, 3}, 0, 1); std::cout << a.toString() << std::endl; Tensor b = Tensor({2, 3}, 0, 1); std::cout << b.toString() << std::endl; Profiler::measure("Time", [&]() { auto result = a * b; std::cout << result.toString() << std::endl; }); return 0; }