Change how MPI is initialised/finalised/aborted.

This takes advantage of the fact that more recent CUDA-aware MPI
libraries do not require CUDA to be initialised before calling
MPI_Initalize.
Make device selection more flexible.

For the CUDA backend there is now an option:

[backend-cuda]
device-id = round-robin | local-rank | int

to select the CUDA device to use.  The default is round-robin.
For the OpenCL backend the following options are now available:

[backend-opencl]
platform-id = name | int
device-type = all | cpu | gpu | accelerator
device-id = name | local-rank | int

where the default platform-id is 0, the default device-type is
all, and the default device-id is local-rank.  Further, the
local rank code has been enhanced to support all MPI platforms.