Skip to content

Chem284Materials/2-2_omp_selectsort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Implementing Selection Sort With OpenMP

In src/main.cpp, you will find a code that initializes each rank with a random vector (named sortvec) of size nvalues.

Currently, the code calls std::sort to sort the vector. You must replace the std::sort call with your own implementation of a selection sort, which must be parallelized using OpenMP. Be careful not to use excessive amounts of memory; in particular, you should avoid creating a situation in which each thread has private variables that are of similar size to sortvec.

Hint: At some point, you will likely find that you need to do a custom reduction operation. One option for doing this would be to define a new reduction operation with #pragma omp declare reduction. An alternate approach would be to use an omp single section and/or omp critical region and perform the reduction there - but if you take this approach, make sure that most of the work is not inside a single/critical region, and that this region is not encountered more frequently than necessary!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors