Tuesday, January 12, 2016

Intel optimization contest contestants Experience Sharing




            


I learned to talk about their knowledge of OpenMP:
1, OpenMP threads set in two ways:
(1) Use the OpenMP compiler precautionary statements
#omp parallel num_threads (n)
n is the following statement in the block parallel threads

(2) use OpenMP API function to set environment variables, you need to use the two functions and a header file
#include & lt; omp.h & gt; // right after Intel compiler environment should be able to find this header file
int num_threads;
num_threads = omp_get_num_procs (); // this function to obtain the number of CPU
omp_set_num_threads (num_threads); // set after thread encountered #omp parallel compiler directives can turn the thread of the
// This will set the number of CPU threads generated can detect dual-core, of course, can be set according to their needs

2, priority
on threadUnlike native thread OpenMP threads priorities can be set directly, but can be improved by increasing the thread priority
original process priorityUse function SetPriorityClass, relevant content is described in the windows SDK.

Author: Li Zidong
Reply:
Welcome everyone together to exchange and share their experiences
Reply:
Can be set in the system environment variable in the code does not need to specify
Windows: set OMP_THREAD_NUMS = 4

Reply:
After using the Thread Checker analysis thread load If a load imbalance, then you can adjust the load statement by schedule situation, there are three adjustment strategy: static, dynamic, guided
.
Example:
int p = 0;
#pragma omp parallel reduction (+: p)
#pragma schedule (guided, 1)
for (int i = 0; i & lt; 100; ++ i) {
++ P;
}


Reply:
My code after adjusting load performance improved by 40 percent. I hope that everyone has to help
Reply:
attention
Reply:
Summed up the experience of optimization, optimization wrote a manual, I hope to help newcomers avoid trouble optimization encountered.
Download http://space.uwants.com/batch.download.php?aid=365474
Please give me advice m2213232omp@yahoo.com.cn
Thank you:)
Reply:
I also wrote a simple, parallel computing brief (not an ordinary Jane :) and a simple programming multicore CPU Demo;
http://blog.csdn.net/housisong/archive/2007/01/17/1485166.aspx
Reply:
I suggest that you look at the "Parallel Programming Mode" This book, on various aspects of parallel there are ways to put in place.
Reply:
Summed up the experience of optimization, optimization wrote a manual, I hope to help newcomers avoid trouble optimization encountered.
Download http://space.uwants.com/batch.download.php?aid=365474
-------------------------------

I also wrote a simple, parallel computing brief (not an ordinary Jane :) and a simple programming multicore CPU Demo;
http://blog.csdn.net/housisong/archive/2007/01/17/1485166.aspx
--------------------------------

Upstairs are two very good article. Especially for the novice .celineshi is not in the future be able to advertise. Oh :-)

Reply:
No problem, Oh, I hope the authors can agree, I hope to publish two works in the forum, Intel zone and csdn website, I do not know if you can?
Reply:
Welcome to reprint :)
Reply:
Thank you very much, I hope the other players are also able to share their own experiences and skills came out, when I will be everyone's article was published to the website for everyone to learn
Reply:
Welcome to reprint :)

No comments:

Post a Comment