Efficient computation and communication management for all-pairs interactions