Statistical models made in Stan can execute on a central processing unit or a graphical processing unit. Incorrect choice of the device can significantly extend execution time. Our approach chooses the executing device and trains the decision method during program execution. We implemented and tested three such decision methods. The methods adjust to present hardware and make decisions based on the size of the problem instances. We offer a programming architecture, which allows for easy construction of functions with built-in decision methods. We tested the methods by measuring execution times of selected mathematical operations and a realistic statistical model. In every test case, the LinUCB decision method achieved a similar or shorter execution time than the methods with a device selected in advance. We further reduced execution time by training the decision method ahead of time, despite training instances being smaller than those used for testing.
|