OPTIMIZATIONS FOR N-BODY PROBLEMS ON HETEROGENOUS SYSTEMS