| 788 | } |
| 789 | |
| 790 | static std::pair<int, int> test_backend(ggml_backend_sched_t backend_sched, ggml_backend_t backend) { |
| 791 | int npass = 0; |
| 792 | int ntest = 0; |
| 793 | |
| 794 | for (bool shuffle : {false, true}) { |
| 795 | std::pair<int, int> partial = test_dataset(backend_sched, backend, shuffle); |
| 796 | npass += partial.first; |
| 797 | ntest += partial.second; |
| 798 | } |
| 799 | { |
| 800 | std::pair<int, int> partial = test_grad(backend_sched, backend); |
| 801 | npass += partial.first; |
| 802 | ntest += partial.second; |
| 803 | } |
| 804 | for (bool high_level : {false, true}){ |
| 805 | for (bool shuffle : {false, true}) { |
| 806 | if (!high_level && shuffle) { |
| 807 | continue; |
| 808 | } |
| 809 | |
| 810 | std::pair<int, int> partial = test_forward_backward(backend_sched, backend, high_level, shuffle); |
| 811 | npass += partial.first; |
| 812 | ntest += partial.second; |
| 813 | } |
| 814 | } |
| 815 | { |
| 816 | std::pair<int, int> partial = test_epoch_vs_fit(backend_sched, backend); |
| 817 | npass += partial.first; |
| 818 | ntest += partial.second; |
| 819 | } |
| 820 | for (bool high_level : {false, true}){ |
| 821 | std::pair<int, int> partial = test_idata_split(backend_sched, backend, high_level); |
| 822 | npass += partial.first; |
| 823 | ntest += partial.second; |
| 824 | } |
| 825 | for (int32_t nbatch_physical : {2, 1}) { |
| 826 | for (enum ggml_opt_loss_type loss_type : {GGML_OPT_LOSS_TYPE_SUM, GGML_OPT_LOSS_TYPE_MEAN}) { |
| 827 | std::pair<int, int> partial = test_gradient_accumulation(backend_sched, backend, nbatch_physical, loss_type); |
| 828 | npass += partial.first; |
| 829 | ntest += partial.second; |
| 830 | } |
| 831 | } |
| 832 | { |
| 833 | std::pair<int, int> partial = test_regression(backend_sched, backend); |
| 834 | npass += partial.first; |
| 835 | ntest += partial.second; |
| 836 | } |
| 837 | |
| 838 | return std::make_pair(npass, ntest); |
| 839 | } |
| 840 | |
| 841 | int main(void) { |
| 842 | const size_t dev_count = ggml_backend_dev_count(); |
no test coverage detected