"How do you write pseudo-code for parallel programming? Especially, how do you differentiate local and shared variables? How do you represent operations like scatter, gather, reduce, broadcast, and point-to-point communications? Is there some standards about that?"

Please, note the original question was asked here but it still does NOT have a good acceptable answer.

Re-elaborating other questions, summarizing and keeping the things easy: is there a way of saying in pseudocode "DO ALL THESE THINGS IN PARALLEL"?

I am using the package algorithm2e with TeXStudio. How to typeset the parallel code using them?

  • What is the link between your question and LaTeX. If it is how to typeset source code, it may be a LaTex question. The package listing may then be of interest. Have a look at this question and it answers and also this question. – Sveinung Aug 7 '19 at 16:10
  • If this question is regarding formatting and typesetting pseudocode, it is probably a duplicate of many question, in particular this one. So I vote for closing. – Sveinung Aug 7 '19 at 16:16
  • I agree that all of they are kind of duplicate. But I have never seen a good aswer. Should we re-propose the question, as I said in above? there is a please note at the end of the question, right? – Leos313 Aug 7 '19 at 16:19
  • 1
    I see the update, but is this a question on how to typeset pseudocode using LaTeX? – Sveinung Aug 7 '19 at 16:43
  • 2
    I suggest that you add this comment to your question, i.e. that the question is how to typeset this using algorithm2e. I have voted for reopening and edited the tags – Sveinung Aug 7 '19 at 18:52

After some web research, I have realized that a kind of "standard" still does not exits. So here is my personal solution using algorithm2e:

    \SetKwBlock{DoParallel}{do in parallel}{end}
    \KwIn{Some inputs}
    \KwOut{The ouput}
        Compute a \;
        Compute b \;
        Compute c \;
    \Return{the solution}\;
    \caption{Parallel Algo}

The result is:

enter image description here

It is based on defining a new command using the expression \SetKwBlock. The manual of the package can be found here. Also, I have just added almost the same solution to a similar question on StackOverflow. The answer and the question can be foundhere.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.