| 258 | } |
| 259 | |
| 260 | void time_divmod() { |
| 261 | auto a = mx::random::normal({1000}); |
| 262 | auto b = mx::random::normal({1000}); |
| 263 | mx::eval({a, b}); |
| 264 | |
| 265 | auto divmod_fused = [&a, &b]() { return mx::divmod(a, b); }; |
| 266 | TIME(divmod_fused); |
| 267 | |
| 268 | auto divmod_separate = [&a, &b]() { |
| 269 | return std::vector<mx::array>{mx::floor_divide(a, b), mx::remainder(a, b)}; |
| 270 | }; |
| 271 | TIME(divmod_separate); |
| 272 | } |
| 273 | |
| 274 | int main() { |
| 275 | std::cout << "Benchmarks for " << mx::default_device() << std::endl; |