With the increasing number of heterogeneous resource-constrained devices populating the current wireless ecosystem, enabling ubiquitous computing at the edge of the network requires moving part of the computing burden back to the edge to reduce user-side latency and relieve the backhaul network. Motivated by this challenge, this work investigates edge-facilitated collaborative fog computing to augment the computing capabilities of individual devices while optimizing for energy-efficiency. Collaborativecomputing is modeled using the Map-Reduce framework, consisting in two computing rounds and a communication round. The computing load is optimally distributed among devices, taking into account their diversity in terms of computing and communication capabilities. Devices local parameters such as CPU frequency and RF transmit power are also optimized for energy-efficiency. The corresponding optimization problem is shown to be convex and optimality conditions are obtained through Lagrange duality theory. A waterfilling-like interpretation for the size of the computing load assigned to each device is given. Numerical experiments demonstrate the benefits of the proposed collaborative-computing scheme over various other schemes in several respects. Most notably, the proposed scheme exhibits increased probability of successfully dealing with more demanding computations in time, along with significant energy-efficiency gains. Both improvements come from the scheme ability to advantageously leverage devices diversity.INDEX TERMS wireless collaborative computing, Map-Reduce, energy-efficiency, joint computation and communications optimization, fog computing.