CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   abt Parallel Coding (https://www.cfd-online.com/Forums/main/5943-abt-parallel-coding.html)

AMV April 4, 2003 13:32

abt Parallel Coding
 
HI to all, I want to learn parallel coding . What is the best starting point for reading ?

Nashat April 4, 2003 18:14

Re: abt Parallel Coding
 
If you are interested in MPI,

http://www-unix.mcs.anl.gov/mpi/index.html

http://HTTP.CS.Berkeley.EDU/~demmel/cs267/

Regards

kenn April 6, 2003 00:42

Re: abt Parallel Coding
 
i only read first three chapters of

"using MPI "

by William Gropp et al

and programmed my C++ FEM code in parallel.

programming in MPI (for distributed computer system) is extremely simple. each computer has its own CPU, own memory, and own disk. the way for them to comminicate is like a Message Passing. and MPI provides you those commands for comminicate. and you can use Fortran, C, and C++.

parallel computing has two things for you. one is for you to learn: some simple syntax, which can be found in the book I mentioned. in my case, I used less than 10 commands and can handle everything I want.

the second thing is for you to think by yourself: domain decomposition. some people use physical domain decomposition with their numerical method such like finite difference. but in the case of Finite element, you can use logical domain decomposition which is what I am using. it's very simple. because FEM is inherently suitable for parallelization.

in the case of FEM, we are mainly doing two things: get a matrix, then solve it iteratively. the process of iteratively solving a system of equations is actually a process of matrix-vector multiplications.

now, please view the matrix (denoted as AA) as a superposition of a bunch of matrices (denoted as aa)with exactly the same size.

then, ask each processor to do his part of duty: get aa and multiple with a vector common to every processor. then collect results from all processors.

that's the whole story of parallel computing in a distributed computer system. starting from ground zero, I finished all the business in less than one week. I believe you can do better.

AMV April 6, 2003 03:27

Re: abt Parallel Coding
 
Kenn thats right. I am completely zero right now. But I work with finite volume method and am implementing the SIMPLE algorithm. As you must be aware, this is a segragated method of solving the N-S and other scalar equations. Unlike FEM where we have usually a big global matrix, here due to the use of TDMA, we have no big matrices.

In parallelising this system, is it possible that I use one processor for 1 equation. i.e. I will assign calculation of the coefficients and its solutuion of u momentum equation to 1st processor, V momentum equation to 2nd and W momentum equation to the 3rd. In my view this will speed up the solution process 3 times.

So this way, instead of domain decomposition, we have parallized the algorithm itself.

AMV April 6, 2003 03:27

Re: abt Parallel Coding
 
Kenn thats right. I am completely zero right now. But I work with finite volume method and am implementing the SIMPLE algorithm. As you must be aware, this is a segragated method of solving the N-S and other scalar equations. Unlike FEM where we have usually a big global matrix, here due to the use of TDMA, we have no big matrices.

In parallelising this system, is it possible that I use one processor for 1 equation. i.e. I will assign calculation of the coefficients and its solutuion of u momentum equation to 1st processor, V momentum equation to 2nd and W momentum equation to the 3rd. In my view this will speed up the solution process 3 times.

So this way, instead of domain decomposition, we have parallized the algorithm itself.

Thanks for all your time and interest !

kenn April 14, 2003 03:17

Re: abt Parallel Coding
 
it's a misunderstanding of FEM.

without big global matrix is not the patent of non-FEM methods.

in iterative FEM, my code has two options: one with global assembling, the other absent from global asembling and global matrix. both cases use the technique of "element-by-element". the trick is: get element matrix then apply BC on this element immediately. parallization becomes extremely natural in EBE finite element.

in the case of fv, I believe you can do similar things. but I don't believe the way you mentioned is a good one. it needs much more communications and is very restrictive.

the physical domain decomposition being practiced by some people is not a wise one either. the good one is logical domain decomposition. however, if the problem you are solving indeed has components separated naturally, the physical domain decomposition becomes a nice choice.

whether or not parallization can be applied is less relevant to fem, fd, fv, or spectral element. as long as you are using an iterative process or solver, you should be able to find a way of parallization. in direct method, a global matrix is really needed, and parallization is often difficult.

now, let's talk about something about FV:

one misconception: some poeple claim that SIMPLER procedure is absent of linear solver. it's somewhat true, but the more accurate cliam should be: in FV, the linear solver is outside all loops, inside time advancement. so we can't see it, but it is still there.

such an arragement may be effective in some situations, but could be less effective, and surely is against priciple of software engineering. because, in contrast, FEM uses a separate routine for linear solver.

in fact, SIMPLER is using a stationary type of iterative linear solver. for diagonal dominant matrix or positive definite matrix it usually converges. for axisymmetric indefinite matrix they either are slow or break down.

there is another category of iterative solvers: modern Krylov space based iterative solvers. now, SIMPLER simply finds itself hard to take this kind of new technology while FEM is doing that routinely.

in Simpler FV, the nonlinear source term is treated in the differential equation level. FEM treats nonlinearity in discrete level. the former is less accurate.

the SIMPLER treats the nonlinear convection term in an explicit way, so a nonlinear iterative procedure such as Newton-Ralphson is skipped. this is good. but, for many steady problems, in SIMPLER you must use a time marching. in FEM, I programmed all cases, and it's not a difficult work.

and, in many cases, time marching steps must be very small because of explict (in time advancement). you save time in each step, but you pay the price: more steps. and, according to most people, it turns out implict methods are more efficient ( to meet the same accuracy requirement )

and even in the category of using these kinds of splitting methods like SIMPLER, projection procedure is faster and better. some people worry about BC for pressure poisson equations in projection procedure, but I found in fact that is not a problem. many FEM code are implemented with a projection procedure.



All times are GMT -4. The time now is 22:39.