ParMAC: distributed optimisation of nested functions, with application to learning binary autoencoders