0
$\begingroup$

Suppose I have a sequential program of biological, physical, or chemical simulation.

I need a step-by-step algorithm for translating that sequential program into a parallel program.

Can you recommend a book for this?

asked Sep 29, 2024 at 2:01
$\endgroup$

1 Answer 1

3
$\begingroup$

No such book exists.

There are plenty of introductions to parallel programming out there, but there is no general advice for turning a sequential program into a parallel program, because it is impossible. If it were possible, compilers would do it.

Having said that, there are a couple of general approaches that may help for a problem like yours:

  • Many physical simulators have a core mathematical "solver", such as an algebraic multigrid solver, where most of the time is spent. Such solvers are also often iterative, so they converge on the desired solution. Concentrating on parallelising that may be productive, keeping the main simulation loop sequential.
  • Physical simulations tend to not have "action at a distance", so the problem domain can be conceptually split into regions which can then be distributed to different CPUs. The CPUs only have to communicate with each other about what happens at the boundaries. This is a common approach in very large scale simulations, such as weather forecasting and oceanographic simulation.
answered Sep 29, 2024 at 3:31
$\endgroup$
2
  • $\begingroup$ IMO compilers could do quite a lot to parallelize programs. Construct a flow digraph (forming a partial order) and attempt to put operations (represented as vertices) independent of each other on parallel paths. Now, of course that would require tracking whether any function call affects some global variables, including external function calls (e.g. dlls) which is probably the main bottleneck of creating such a compiler. $\endgroup$ Commented Sep 29, 2024 at 8:38
  • $\begingroup$ @rus9384 Well yes, but that's typically to handle instruction-level parallelism and auto-vectorisation. Multiprocessing optimisation typically requires programmer annotations, e.g. OpenMP. $\endgroup$ Commented Sep 29, 2024 at 9:09

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.