Writing massively parallel code for heterogeneous platforms with OpenCL