Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6888397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:00:37+00:00 2026-05-27T06:00:37+00:00

I have a parrallelized C++ program that does brute force optimization. For some reason

  • 0

I have a parrallelized C++ program that does brute force optimization. For some reason I get diminishing returns per core up to ~6 cores, at which point I hit a wall where further cores add ~no speed. This is consistent when run on an 8 or 16 core machine.

When I run strace -f ./progname I get a whole ton of the following that occur specifically during the multithreaded section of the program: [pid 2646] mprotect(0x7ffe7c030000, 4096, PROT_READ|PROT_WRITE) = 0

and a few of these that occur one after the other: [pid 2645] mprotect(0x7ffe78030000, 4096, PROT_READ|PROT_WRITE <unfinished ...> — [pid 2646] <... mprotect resumed> ) = 0

Their not always from the same pid though.

When I decrease the number of cores I get fewer of the above messages, and at 2 or 3 cores I don’t get any.

The only thing I can guess is that maybe it has to do with the massive quantity of vector allocations and accessing that gets done in each thread. I’m not using any other memory management libraries if that’s relevant.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:00:37+00:00Added an answer on May 27, 2026 at 6:00 am

    I have a parrallelized C++ program that does brute force optimization.
    For some reason I get diminishing returns per core up to ~6 cores, at
    which point I hit a wall where further cores add ~no speed. This is
    consistent when run on an 8 or 16 core machine.

    Can you describe the algorithm? Lots of computation algorithms are memory bound.

    Try profiling your application with oprofile, perf, or if those aren’t possible, gprof.

    The only thing I can guess is that maybe it has to do with the massive
    quantity of vector allocations and accessing that gets done in each
    thread. I’m not using any other memory management libraries if that’s
    relevant.

    A super easy way to relieve TLB pressure is to use huge pages (presumably your hardware supports it). On linux you can use libhugetlbfs and its morecore hook.

    HUGETLB_MORECORE=yes LD_PRELOAD=libhugetlbfs.so  ./brute_force_optimization
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program that needs to run a function M times per iteration,
I have a python program that does something like this: Read a row from
I'm (re)writing a program that does generic unit test scheduling. The current program is
We have a fairly simple program that's used for creating backups. I'm attempting to
I have a program which draws some terrain and simulates water flowing over it
I have a little sample application I was working on trying to get some
I have some serial code like this that computes word concordances i.e. counting collocated
I have a section of a Fortran90 program that should be parallelized with OpenMP.
I have recorded some interactions with windmill and when I hit save I get
I have R code that I need to get to A parallelization stage. Im

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.