De-macro-ize and move internal some hpc helpers.

Needed for easier debugging of an issue related to #500.