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 3451796
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:11:03+00:00 2026-05-18T09:11:03+00:00

So Im doing a bit of Parallel Programming of the Trapezoidal Rule for my

  • 0

So Im doing a bit of Parallel Programming of the Trapezoidal Rule for my OS class, this is a homework question but im not looking for source code.

after a bit of research I decided to use each thread to compute a subinterval.
using:

 g = (b-a)/n;
   integral += (func(a) + func(b))/2.0;

#  pragma omp parallel for schedule(static) default(none) \
      shared(a, h, n) private(i, x) \
      reduction(+: integral) num_threads(thread_count)
   for (i = 1; i <= n-1; i++) {
      x = a + i*g;
      integral += func(x);
   }

in my integral function, func(x) is the function that I read in from the file.

So I email my professor to ask how he wants to go about choosing the number of threads. (since they will need to be evenly divisible by N (for the trapezoidal rule)

but he is saying I dont need to define them, and it will define them based on the number of cores on my machine……..So needless to say Im a bit confused.

  • 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-18T09:11:03+00:00Added an answer on May 18, 2026 at 9:11 am

    Your professor is correct: OpenMP will choose an optimum number of threads by default, which is usually the number of cores.

    You don’t need to worry about the number of threads being exactly divisible by N: OpenMP will automatically distribute the iterations among the threads, and if they’re not evenly divisible, one thread will end up performing a little more or less work.

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

Sidebar

Related Questions

I'm doing a bit of programming here and there in Emacs Lisp, but I'm
I have been doing a bit of reading on this, but I am starting
I'm doing a bit of coding, where I have to write this sort of
I was doing a bit research and I came across this comment. I have
After doing my bit of research and some looking around and researching I cannot
I have been doing a bit of research, but I cannot seem to find
Ok. So I've been doing a bit of looking at gestures and such and
I have some SIMD code in Altivec processing 32 bit integer values in parallel.
I've been doing a bit of network programming these days in Python and would
I'm doing a bit of retro programming for fun. What I want to create

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.