vipra-uwf / vipra-1.0

1 stars 1 forks source link

Optimization: Implement OpenMP for Parallelization #57

Closed joemccall86 closed 3 years ago

joemccall86 commented 3 years ago

Add OpenMP constructs to two critical loops in the stack:

  1. The nearest neighbor function
  2. The distance matrix computation

These changes were after several iterations of testing different strategies. I ultimately tried to change as little as possible to ensure correctness. The whitespace changes are from the IDE normalizing the padding.

When running, you can control the behavior of the parallelization by setting the OMP_NUM_THREADS environment variable. To run the simulation serially set this variable to 1. By default it will use the number of cores present on the system.

Finally, this is to complement the MPI work done previously. When we're ready to move this onto a supercomputer we can set OMP_NUM_THREADS to the appropriate amount to take advantage of the capabilities of a particular node.