| 41 | { |
| 42 | public: |
| 43 | bool do_setup(int argc, char **argv) override |
| 44 | { |
| 45 | NPYLoader npy0; |
| 46 | NPYLoader npy1; |
| 47 | NPYLoader npy2; |
| 48 | alpha = 1.0f; |
| 49 | beta = 0.0f; |
| 50 | |
| 51 | CLScheduler::get().default_init(&tuner); |
| 52 | |
| 53 | std::ifstream stream; |
| 54 | if (argc > 1) |
| 55 | { |
| 56 | stream.open(argv[1], std::fstream::in); |
| 57 | } |
| 58 | |
| 59 | if (argc < 3 || (argc < 4 && stream.bad())) |
| 60 | { |
| 61 | // Print help |
| 62 | std::cout << "Usage: 1) ./build/cl_sgemm input_matrix_1.npy input_matrix_2.npy [input_matrix_3.npy] [alpha " |
| 63 | "= 1] [beta = 0]\n"; |
| 64 | std::cout << " 2) ./build/cl_sgemm M N K [alpha = 1.0f] [beta = 0.0f]\n\n"; |
| 65 | std::cout << "Too few or no input_matrices provided. Using M=7, N=3, K=5, alpha=1.0f and beta=0.0f\n\n"; |
| 66 | |
| 67 | src0.allocator()->init(TensorInfo(TensorShape(5U, 7U), 1, DataType::F32)); |
| 68 | src1.allocator()->init(TensorInfo(TensorShape(3U, 5U), 1, DataType::F32)); |
| 69 | src2.allocator()->init(TensorInfo(TensorShape(3U, 7U), 1, DataType::F32)); |
| 70 | } |
| 71 | else |
| 72 | { |
| 73 | if (stream.good()) /* case file1.npy file2.npy [file3.npy] [alpha = 1.0f] [beta = 0.0f] */ |
| 74 | { |
| 75 | npy0.open(argv[1]); |
| 76 | npy0.init_tensor(src0, DataType::F32); |
| 77 | npy1.open(argv[2]); |
| 78 | npy1.init_tensor(src1, DataType::F32); |
| 79 | |
| 80 | if (argc > 3) |
| 81 | { |
| 82 | stream.close(); |
| 83 | stream.clear(); |
| 84 | stream.open(argv[3], std::fstream::in); |
| 85 | if (stream.good()) /* case with third file */ |
| 86 | { |
| 87 | npy2.open(argv[3]); |
| 88 | npy2.init_tensor(src2, DataType::F32); |
| 89 | |
| 90 | if (argc > 4) |
| 91 | { |
| 92 | // Convert string to float |
| 93 | alpha = strtof(argv[4], nullptr); |
| 94 | |
| 95 | if (argc > 5) |
| 96 | { |
| 97 | // Convert string to float |
| 98 | beta = strtof(argv[5], nullptr); |
| 99 | } |
| 100 | } |
nothing calls this directly
no test coverage detected