| 840 | } |
| 841 | |
| 842 | static std::pair<int, int> test_backend( |
| 843 | ggml_backend_sched_t backend_sched, ggml_backend_t backend, enum ggml_opt_optimizer_type optim) { |
| 844 | int npass = 0; |
| 845 | int ntest = 0; |
| 846 | |
| 847 | for (bool shuffle : {false, true}) { |
| 848 | std::pair<int, int> partial = test_dataset(optim, backend_sched, backend, shuffle); |
| 849 | npass += partial.first; |
| 850 | ntest += partial.second; |
| 851 | } |
| 852 | { |
| 853 | std::pair<int, int> partial = test_grad(optim, backend_sched, backend); |
| 854 | npass += partial.first; |
| 855 | ntest += partial.second; |
| 856 | } |
| 857 | for (bool high_level : {false, true}){ |
| 858 | for (bool shuffle : {false, true}) { |
| 859 | if (!high_level && shuffle) { |
| 860 | continue; |
| 861 | } |
| 862 | |
| 863 | std::pair<int, int> partial = test_forward_backward(optim, backend_sched, backend, high_level, shuffle); |
| 864 | npass += partial.first; |
| 865 | ntest += partial.second; |
| 866 | } |
| 867 | } |
| 868 | { |
| 869 | std::pair<int, int> partial = test_epoch_vs_fit(optim, backend_sched, backend); |
| 870 | npass += partial.first; |
| 871 | ntest += partial.second; |
| 872 | } |
| 873 | for (bool high_level : {false, true}){ |
| 874 | std::pair<int, int> partial = test_idata_split(optim, backend_sched, backend, high_level); |
| 875 | npass += partial.first; |
| 876 | ntest += partial.second; |
| 877 | } |
| 878 | bool const adamw = optim == GGML_OPT_OPTIMIZER_TYPE_ADAMW; |
| 879 | if (adamw) { |
| 880 | for (int32_t nbatch_physical : { 2, 1 }) { |
| 881 | for (enum ggml_opt_loss_type loss_type : { GGML_OPT_LOSS_TYPE_SUM, GGML_OPT_LOSS_TYPE_MEAN }) { |
| 882 | std::pair<int, int> partial = |
| 883 | test_gradient_accumulation(optim, backend_sched, backend, nbatch_physical, loss_type); |
| 884 | npass += partial.first; |
| 885 | ntest += partial.second; |
| 886 | } |
| 887 | } |
| 888 | } |
| 889 | { |
| 890 | std::pair<int, int> partial = test_regression(optim, backend_sched, backend); |
| 891 | npass += partial.first; |
| 892 | ntest += partial.second; |
| 893 | } |
| 894 | |
| 895 | return std::make_pair(npass, ntest); |
| 896 | } |
| 897 | |
| 898 | |
| 899 | int main(void) { |
no test coverage detected