473,382 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

OpenMP - dynamic and static?

Hello!
I have a question to OpenMP. In loop parallelisation, there is the option schedule and in this, one can use static and dynamic.
What is the exact difference between them?
Here an example program:
Expand|Select|Wrap|Line Numbers
  1. //---------------------------------------------------------------
  2. #include <omp.h>
  3. #include <valarray>
  4. #define N 1000
  5. #define CHUNKSIZE 100
  6.  
  7. int main() {
  8.   int i,chunk;
  9.   std::valarray<double> a(N);
  10.   std::valarray<double> b(N); 
  11.   std::valarray<double> c(N);
  12.  
  13.   for(i=0; i<N; i++)  a[ i ]  = b[ i ] = i * 1.0;
  14.   chunk = CHUNKSIZE;
  15.  
  16. #pragma omp parallel shared(a,b,c,chunk) private(i) {
  17. #pragma omp for schedule(dynamic,chunk) nowait  
  18.     for(i=0; i<N; i++) c[ i ] = a[ i ] + b[ i ];
  19.   }
  20. }
  21. //---------------------------------------------------------------
  22.  
In place of dynamic, one can use static.
In tutorials is always written, the loop iterations are divided into pieces of size chunk, and than statically or dynamically assigned to threads.
What is the difference between them? If I run this program with dynamic or static, there is (apparently) no difference.

Thank you for help!
May 7 '07 #1
0 2863

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Rodrigo Perottoni | last post by:
I'm trying compiling and running the OpenMP Benchmark, but I have some problems. Anyone knows how I compiling and running OpenMP? Thank You.
5
by: Vladimir_petter | last post by:
Hello guys, Looks like this technology is comming along with VS2005. Anybody has an expirience of using it along with C++? What are the patterns? Thanks, Vladimir.
8
by: Gabest | last post by:
I really like the new openmp implementation of vc, but I ran into a something which may be a bug. Please see the following little example: void funct() { __declspec(align(16)) BYTE buff;...
1
by: Carl J. Van Arsdall | last post by:
Hey everyone, I know I've posted several questions regarding python and python's parallel capabilities so bear with me as I've never attempted to incite discussion. However, today I'm...
0
by: BallCOMET | last post by:
I have an application that I built with Visual Studio 2005 and for which I enabled OpenMP. If I open the compiled binary in Visual Studio, this is the manifest that is embedded in the executable...
2
by: firenet | last post by:
gcc -g -fopenmp openmp.c -o openmp cc1: error: unrecognized command line option "-fopenmp" i wrote a simple openmp.c and wanted to compile it, but i got this error. What should i do ? Thanks
7
by: s.z.s | last post by:
Hi! Is anybody using an openmp compiler under cygwin? I tried to install gcc 4.2.2 without success and now I'm looking for alternatives. Thanks, Steffen
6
by: Renato Perini | last post by:
Hi all!!! I'm trying to find a *good* book about OpenMP and C, but I can't find anything specific. Can you advice me some good (and updated) books about OpenMP using the C interface? I'd like a...
0
by: Alien | last post by:
Hi, I am having bit of confusion about !$OPENMP DO/!$OPENMP END DO and !$OPENMP PARALLEL DO/!$OPENMP END PARALLEL DO directives. Having looked at my notes, the only difference I can find is...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.