Parallel Programming using OpenMP and SIMD
April 1, 2019High-dimensional sphere using OpenMP
High-dimensional space is non-intuive in a number of ways. In particular, it turns out that most of the volume of a sphere lies near the surface of the sphere. For this part, implemented a program, parallelized with OpenMP, that confirms this.
To do this, sampled uniformly distributed, random points within the volume of a unit sphere (radius 1). Then computed a histogram of distance from the surface. The histogram are with 100 intervals, i.e., from 0 to 1 in steps of 0.01. Shown output for dimensionality from 2 to 16.
Both a sequential and parallelized implementation has been done. With Sequential implementation, the nature of OpenMP is such that our parallel version is almost identical (or even 100% identical).
Used a package such at matplotlib to visualize this.
SIMD
Used SIMD (AVX specification) to accelerate the computation of the lengths of a sequence of line segments. Each segment is represented by two 4-D points. Thus, for N segments, there would be a total of 2N points. Used Euclidean distance. Used 32-bit floats for the coordinates. Shown speedup by implementing both a sequential and a parallel version.
Technologies: C++, OpenMP, SIMD, MatPlotLib
Check out the Project Source Code for more detailed info on implementation.