hsuan221 / ntustcfdlab Goto Github PK
View Code? Open in Web Editor NEW3d Finite Volume Method based coded with hybrid OpenMP/MPI
3d Finite Volume Method based coded with hybrid OpenMP/MPI
In the file solver.f90
at lines 81 and 125 appears this block:
!$OMP PARALLEL DO
do i=1,n; norm=norm+r(i)*r(i); end do
!$OMP END PARALLEL DO
There is a data race here as threads handling different iterations of the reduction loop are trying to update the same variable concurrently. In order to restore correctness, the OpenMP reduction
clause can be used, it will ensure that each thread sum its r(i)*r(i)
increments into a thread-local temporary variable. At the end of the loop, OpenMP will make those threads sum the final value of their thread-local temporary variable back into the original norm
variable, taking care of potential data races in the process. The corrected block would look as follows:
!$OMP PARALLEL DO REDUCTION(+:norm)
do i=1,n; norm=norm+r(i)*r(i); end do
!$OMP END PARALLEL DO
There might be other blocks in a similar situation, for which the same fix applies, such as the one at line 113 in the same file solver.f90
:
!$OMP PARALLEL DO
do i=1,n; x(i)=x(i)+alpha*p(i)+omega*ss(i); end do
!$OMP END PARALLEL DO
You can refer to https://rookiehpc.github.io/openmp/docs/reduction/index.html for more information.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.