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

  • SEARCH
  • Home
  • 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 7025961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:03:16+00:00 2026-05-28T00:03:16+00:00

I want to do this: omp_set_nested(1); #pragma omp parallel for private(j) for (i =

  • 0

I want to do this:

omp_set_nested(1);
#pragma omp parallel for private(j)
for (i = 0; i < n; ++i) {
    #pragma omp parallel for
    for (j = 0; j < m; ++j) {
    /* do smth */
    }
}

It means, if I have 8 threads, and first loop uses only 4 threads, I want internal loop to use other 4 threads too. How can I do this?

  • 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-28T00:03:16+00:00Added an answer on May 28, 2026 at 12:03 am

    You can specify the number of threads that you want in a region.

    So if you did this:

    omp_set_nested(1);
    #pragma omp parallel for private(j) num_threads(2)
    for (i = 0; i < n; ++i) {
        #pragma omp parallel for num_threads(4)
        for (j = 0; j < m; ++j) {
            /* do smth */
        }
    }
    

    Then the outer-loop will have 2 threads. And then each of those 2 threads will spawn 4 threads for the inner loop. (for a total of 8)

    Your description is somewhat confusing since you want each loop to use 4 threads. Don’t forget that it’s nested, so they multiply.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a loop in my C++/OpenMP code that looks like this: #pragma omp
I only want this function to run if .toolbar li does not have the
I have this div: <div class=inauguration-image> I do not want this text to display,
I have the following piece of code, which I want to make parallel in
I want this usercontrol to be Created via MEF but also to have the
I have a for loop, which I don't want to parallelise, which calls a
I want this loop to decrement from the value I set it to from
I have C++ code with OpenMP pragmas inside. I want to test this code
I want this : I am building a few screens where I will have
I want this url http://www.youtube.com/watch?v=dgNgODPIO0w&feature=rec-HM-fresh+div to be transformed to: http://www.youtube.com/v/dgNgODPIO0w with php.

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.