Multithreading benchmarks

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
User avatar
cyboryxmen
Posts: 171
Joined: November 14th, 2014, 2:03 am

Multithreading benchmarks

Post by cyboryxmen » April 19th, 2019, 2:34 pm

I have made a repository that contains a collection of projects that benchmark high performance multithreaded implementations of common algorithms. It's a CMake project that compiles both the serial and concurrent versions of the project.

Right now, I have only managed to upload a project that benchmarks the filter algorithm. The algorithm simply copies elements from one array to another if the element meets a cetain condition. In this case, it checks numbers from the array to see if it is below a certain threshold and copies it over if so.

The multithreaded implementation is pretty basic as far as high performance multithreaded code go. I ran it on my quad core hyperthreaded i7 and the results are quite satisfying. It helps to show the capabilities of multithreading and its potential in the future as we get more and more cores in our CPUs. Hopefully it manages to run as well on your CPU as it did on mine. It should work even if you have a single core CPU but really, what's the point of running this on a CPU like that.

I'll upload the merge sort and quick sort project once I'm done optimizing them.
Zekilk

BobsCrabShack
Posts: 5
Joined: April 19th, 2019, 7:52 pm

Re: Multithreading benchmarks

Post by BobsCrabShack » April 19th, 2019, 8:03 pm

Im curious how this would compare using reduce with copy_if and back_inserter into a reserved vector. Or for sorting sort. The c++ 17 versions have an execution policy parameter that you can specify multithreaded.

User avatar
chili
Site Admin
Posts: 3850
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Multithreading benchmarks

Post by chili » April 20th, 2019, 7:20 am

Am I losing my mfing mind

I swear I posted last night about std::copy_if and execution policy.
Chili

albinopapa
Posts: 3822
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Multithreading benchmarks

Post by albinopapa » April 20th, 2019, 10:16 am

@chili, Maybe you posted it to discord?
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

User avatar
chili
Site Admin
Posts: 3850
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Multithreading benchmarks

Post by chili » April 22nd, 2019, 2:17 am

Nah, twas on this thread. But must not have hit submit or something.
Chili

User avatar
cyboryxmen
Posts: 171
Joined: November 14th, 2014, 2:03 am

Re: Multithreading benchmarks

Post by cyboryxmen » April 22nd, 2019, 8:15 am

I added another executable to the build to benchmark the STL. It only preformed slightly better than the basic serial algorithm. Also, the debugger shows that no additional threads were launched when executing. Maybe Visual Studio doesn't support it? 🤷
Zekilk

Post Reply