Quantcast
Channel: High Performance Computing Virtual Laboratory - Parallel Programming
Viewing all articles
Browse latest Browse all 8

How can I use multiple threads to get parallel performance out of my serial code?

$
0
0

The compilers running on HPCVL clusters are discussed in our Compiler FAQ. They have options that cause it to attempt to parallelize loops that have no dependencies by multi-threading them. The compiler flags to get this done are

  • -xautopar identifies loops that are obviously non-dependent and creates multithreaded code for them
  • -xreduction reduces variables inside a loop into a single value, for example by summing over them
  • -xloopinfo shows which loops were parallelized, and which not (and why)
  • -stackvar Necessary. Allocates local variables on the stack.

This will only work if the loops to be parallelized do not have any dependencies. Since the compiler is very conservative, even simple function calls from inside a loop cause it to reject auto-parallelization. This is because function calls could hide access to global variables (COMMON blocks or modules in Fortran) that establish dependencies. The result is that auto-parallelization often is not an option.


Viewing all articles
Browse latest Browse all 8

Trending Articles