Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Network & Security Expert

#include

void subdomain(float x[ ], int istart, int ipoints)

{

int i;

for (i = 0; i < ipoints; i++)

x[istart+i] = 123.456;

}

void sub(float x[ 10000], int npoints)

{

int t_num, num_t, ipoints, istart;

#pragma omp parallel default(shared) private(t_num , num_t, ipoints, istart)

{

t_num = omp_get_thread_num(); //thread number of current thread num_t = omp_get_num_threads(); //number of threads

ipoints = npoints / num_t; /* size of partition */

istart = t_num * ipoints; /* starting array index */

if (t_num == num_t-1) /* last thread may do more */

ipoints = npoints - istart;

subdomain(x, istart, ipoints);

}

}

int main()

{

float array[10000];

sub(array, 10000);

 return 0;

}

In this example we used two library methods : omp_get_num_threads() and

omp_get_thread_num().

omp_get_num_threads() returns number of threads that are currently being used in parallel directive.

omp_get_thread_num() returns thread number (an integer from 0 to omp_get_num_threads() - 1 where thread 0 is the master thread).

Computer Network & Security, Computer Science

  • Category:- Computer Network & Security
  • Reference No.:- M9525921

Have any Question?


Related Questions in Computer Network & Security

Overview of network security assessment - security

Overview of Network Security Assessment - Security Challenges in Emerging Networks Purpose of the assessment - The purpose of this assignment is to develop skills to independently think of innovation. Students will be ab ...

Question suppose public-key cryptography is used to encrypt

Question : Suppose public-key cryptography is used to encrypt the communications between Alice and Bob. Alice's public key is eA, private key is dA; Bob's public key is private key is de. Now Bob wants to send a message ...

Assignment descriptionproject scope a typical

Assignment Description Project Scope: A typical network layout diagram of a firm is given below for illustrative purposes only. The service requirements are enclosed. Figure. Network layout of a firm Service requirements ...

You just signed a 30-year lease agreement for a business

You just signed a 30-year lease agreement for a business property. The monthly rent for the first year is $1,000/month, with the ?rst month's rent due today. Starting from the second year onward, the monthly rent will be ...

Describe 2 variables a government will look at to predict

Describe 2 variables a government will look at to predict where the economy will be in the next six months.

It networking assignment - networking project areamajor lab

IT Networking Assignment - Networking Project Area Major Lab Scenario - Instructions This lab has a time limit of one term The lab must be completed by individual students, and the completed assessment returned to the as ...

Data model development and implementationpurpose of the

Data model development and implementation Purpose of the assessment The purpose of this assignment is to develop data models and map Database System into a standard development environment to gain understanding of data m ...

Backgroundyou have obtained a contract position at a small

Background: You have obtained a contract position at a small marketing and advertising firm called the Colour Ability Corporation (CAC). Your contract responsibilities are to help them plan their emerging networking and ...

What is the difference between a positive economic

What is the difference between a positive economic statement and a normative one.

Sms use short message peer to peer smpp protocolimessage

SMS use Short Message Peer to Peer (SMPP) protocol IMessage based on Apple push notifications (APNS) - binary protocol WhatsApp uses standard Extensible Messaging and Presence Protocol (XMPP) Write a pragraph explaining ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As