Open main menu

CDOT Wiki β

Changes

DPS921/Franky

613 bytes added, 22:04, 25 November 2018
Multi-thread
std::normal_distribution<double> b_dist(1.0,0.2);
std::normal_distribution<double> x_dist(0.0,1);
#pragma omp parallel for
for(std::size_t i = 0; i < N; i++) {
m_real[i] = m_dist(generator);
return 0;
}
</source>
====Performance====
[[File:lrmp2.png]]
While much of the process are now using multithreading, there are still a good chunk of the code using serial region. Let's try to fix that.
 
====Fix====
The random number generator uses a for-loop. Let's apply OpenMP worksharing to make it more efficient
 
<source>
#pragma omp parallel for
for(std::size_t i = 0; i < N; i++) {
m_real[i] = m_dist(generator);
b_real[i] = b_dist(generator);
c[i].s_x = x_dist(generator);
c[i].s_y = m_real[i] * c[i].s_x + b_real[i];
}
</source>
====Performance====
[[File:lrmp.png]]
vTune Amplifier now shows more percentage of run-time utilizing multiple cores.
==Source==
# [https://software.intel.com/en-us/vtune Intel vTune Amplifier Homepage]
70
edits