-
@@ -14,4 +14,4 @@
var myIframe = document.getElementById("notebook");
iFrameResize({log:true}, myIframe);
});
-
Settings
This document was generated with Documenter.jl version 0.27.25 on Friday 25 August 2023. Using Julia version 1.9.3.
Settings
This document was generated with Documenter.jl version 0.27.25 on Tuesday 29 August 2023. Using Julia version 1.9.3.
-
@@ -14,4 +14,4 @@
var myIframe = document.getElementById("notebook");
iFrameResize({log:true}, myIframe);
});
-
Settings
This document was generated with Documenter.jl version 0.27.25 on Friday 25 August 2023. Using Julia version 1.9.3.
Settings
This document was generated with Documenter.jl version 0.27.25 on Tuesday 29 August 2023. Using Julia version 1.9.3.
Getting started
Introduction
The programming of this course will be done using the Julia programming language. Thus, we start by explaining how to get up and running with Julia. After studying this page, you will be able to:
- Use the Julia REPL,
- Run serial and parallel code,
- Install and manage Julia packages.
Why Julia?
Courses related with high-performance computing (HPC) often use languages such as C, C++, or Fortran. We use Julia instead to make the course accessible to a wider set of students, including the ones that have no experience with C/C++ or Fortran, but are willing to learn parallel programming. Julia is a relatively new programming language specifically designed for scientific computing. It combines a high-level syntax close to interpreted languages like Python with the performance of compiled languages like C, C++, or Fortran. Thus, Julia will allow us to write efficient parallel algorithms with a syntax that is convenient in a teaching setting. In addition, Julia provides easy access to different programming models to write distributed algorithms, which will be useful to learn and experiment with them.
You can run the code in this link to learn how Julia compares to other languages (C and Python) in terms of performance.
Installing Julia
This is a tutorial-like page. Follow these steps before you continue reading the document.
- Download and install Julia from julialang.org;
- Follow the specific instructions for your operating system: Windows, MacOS, or Linux
- Download and install VSCode and its Julia extension;
The Julia REPL
Starting Julia
There are several ways of opening Julia depending on your operating system and your IDE, but it is usually as simple as launching the Julia app. With VSCode, open a folder (File > Open Folder). Then, press Ctrl+Shift+P to open the command bar, and execute Julia: Start REPL. If this does not work, make sure you have the Julia extension for VSCode installed. Independently of the method you use, opening Julia results in a window with some text ending with:
julia>You have just opened the Julia read-evaluate-print loop, or simply the Julia REPL. Congrats! You will spend most of time using the REPL, when working in Julia. The REPL is a console waiting for user input. Just as in other consoles, the string of text right before the input area (julia> in the case) is called the command prompt or simply the prompt.
Basic usage
The usage of the REPL is as follows:
- You write some input
- press enter
- you get the output
For instance, try this
julia> 1 + 1A "Hello world" example looks like this in Julia
julia> println("Hello, world!")Try to run it in the REPL.
Help mode
Curious about what the function println does? Enter into help mode to look into the documentation. This is done by typing a question mark (?) into the input field:
julia> ?After typing ?, the command prompt changes to help?>. It means we are in help mode. Now, we can type a function name to see its documentation.
help?> printlnPackage and shell modes
The REPL comes with two more modes, namely package and shell modes. To enter package mode type
julia> ]Package mode is used to install and manage packages. We are going to discuss the package mode in greater detail later. To return back to normal mode press the backspace key several times.
To enter shell mode type semicolon (;)
julia> ;The prompt should have changed to shell> indicating that we are in shell mode. Now you can type commands that you would normally do on your system command line. For instance,
shell> lswill display the contents of the current folder in Mac or Linux. Using shell mode in Windows is not straightforward, and thus not recommended for beginners.
Running Julia code
Running more complex code
Real-world Julia programs are not typed in the REPL in practice. They are written in one or more files and included in the REPL. To try this, create a new file called hello.jl, write the code of the "Hello world" example above, and save it. If you are using VSCode, you can create the file using File > New File > Julia File. Once the file is saved with the name hello.jl, execute it as follows
julia> include("hello.jl")Make sure that the file "hello.jl" is located in the current working directory of your Julia session. You can query the current directory with function pwd(). You can change to another directory with function cd() if needed. Also, make sure that the file extension is .jl.
The recommended way of running Julia code is using the REPL as we did. But it is also possible to run code directly from the system command line. To this end, open a terminal and call Julia followed by the path to the file containing the code you want to execute.
$ julia hello.jlThe previous line assumes that you have Julia properly installed in the system and that it's usable from the terminal. In UNIX systems (Linux and Mac), the Julia binary needs to be in one of the directories listed in the PATH environment variable. To check that Julia is properly installed, you can use
$ julia --versionIf this runs without error and you see a version number, you are good to go!
In this tutorial, when a code snipped starts with $, it should be run in the terminal. Otherwise, the code is to be run in the Julia REPL.
Avoid calling Julia code from the terminal, use the Julia REPL instead! Each time you call Julia from the terminal, you start a fresh Julia session and Julia will need to compile your code from scratch. This can be time consuming for large projects. In contrast, if you execute code in the REPL, Julia will compile code incrementally, which is much faster. Running code in a cluster (like in DAS-5 for the Julia assignment) is among the few situations you need to run Julia code from the terminal.
Running parallel code
Since we are in a parallel computing course, let's run a parallel "Hello world" example in Julia. Open a Julia REPL and write
julia> using Distributed
+Getting started · XM_40017 Getting started
Introduction
The programming of this course will be done using the Julia programming language. Thus, we start by explaining how to get up and running with Julia. After studying this page, you will be able to:
- Use the Julia REPL,
- Run serial and parallel code,
- Install and manage Julia packages.
Why Julia?
Courses related with high-performance computing (HPC) often use languages such as C, C++, or Fortran. We use Julia instead to make the course accessible to a wider set of students, including the ones that have no experience with C/C++ or Fortran, but are willing to learn parallel programming. Julia is a relatively new programming language specifically designed for scientific computing. It combines a high-level syntax close to interpreted languages like Python with the performance of compiled languages like C, C++, or Fortran. Thus, Julia will allow us to write efficient parallel algorithms with a syntax that is convenient in a teaching setting. In addition, Julia provides easy access to different programming models to write distributed algorithms, which will be useful to learn and experiment with them.
Tip You can run the code in this link to learn how Julia compares to other languages (C and Python) in terms of performance.
Installing Julia
This is a tutorial-like page. Follow these steps before you continue reading the document.
- Download and install Julia from julialang.org;
- Follow the specific instructions for your operating system: Windows, MacOS, or Linux
- Download and install VSCode and its Julia extension;
The Julia REPL
Starting Julia
There are several ways of opening Julia depending on your operating system and your IDE, but it is usually as simple as launching the Julia app. With VSCode, open a folder (File > Open Folder). Then, press Ctrl+Shift+P to open the command bar, and execute Julia: Start REPL. If this does not work, make sure you have the Julia extension for VSCode installed. Independently of the method you use, opening Julia results in a window with some text ending with:
julia>
You have just opened the Julia read-evaluate-print loop, or simply the Julia REPL. Congrats! You will spend most of time using the REPL, when working in Julia. The REPL is a console waiting for user input. Just as in other consoles, the string of text right before the input area (julia> in the case) is called the command prompt or simply the prompt.
Basic usage
The usage of the REPL is as follows:
- You write some input
- press enter
- you get the output
For instance, try this
julia> 1 + 1
A "Hello world" example looks like this in Julia
julia> println("Hello, world!")
Try to run it in the REPL.
Help mode
Curious about what the function println does? Enter into help mode to look into the documentation. This is done by typing a question mark (?) into the input field:
julia> ?
After typing ?, the command prompt changes to help?>. It means we are in help mode. Now, we can type a function name to see its documentation.
help?> println
Package and shell modes
The REPL comes with two more modes, namely package and shell modes. To enter package mode type
julia> ]
Package mode is used to install and manage packages. We are going to discuss the package mode in greater detail later. To return back to normal mode press the backspace key several times.
To enter shell mode type semicolon (;)
julia> ;
The prompt should have changed to shell> indicating that we are in shell mode. Now you can type commands that you would normally do on your system command line. For instance,
shell> ls
will display the contents of the current folder in Mac or Linux. Using shell mode in Windows is not straightforward, and thus not recommended for beginners.
Running Julia code
Running more complex code
Real-world Julia programs are not typed in the REPL in practice. They are written in one or more files and included in the REPL. To try this, create a new file called hello.jl, write the code of the "Hello world" example above, and save it. If you are using VSCode, you can create the file using File > New File > Julia File. Once the file is saved with the name hello.jl, execute it as follows
julia> include("hello.jl")
Warning Make sure that the file "hello.jl" is located in the current working directory of your Julia session. You can query the current directory with function pwd(). You can change to another directory with function cd() if needed. Also, make sure that the file extension is .jl.
The recommended way of running Julia code is using the REPL as we did. But it is also possible to run code directly from the system command line. To this end, open a terminal and call Julia followed by the path to the file containing the code you want to execute.
$ julia hello.jl
The previous line assumes that you have Julia properly installed in the system and that it's usable from the terminal. In UNIX systems (Linux and Mac), the Julia binary needs to be in one of the directories listed in the PATH environment variable. To check that Julia is properly installed, you can use
$ julia --version
If this runs without error and you see a version number, you are good to go!
Note In this tutorial, when a code snipped starts with $, it should be run in the terminal. Otherwise, the code is to be run in the Julia REPL.
Tip Avoid calling Julia code from the terminal, use the Julia REPL instead! Each time you call Julia from the terminal, you start a fresh Julia session and Julia will need to compile your code from scratch. This can be time consuming for large projects. In contrast, if you execute code in the REPL, Julia will compile code incrementally, which is much faster. Running code in a cluster (like in DAS-5 for the Julia assignment) is among the few situations you need to run Julia code from the terminal.
Running parallel code
Since we are in a parallel computing course, let's run a parallel "Hello world" example in Julia. Open a Julia REPL and write
julia> using Distributed
julia> @everywhere println("Hello, world! I am proc $(myid()) from $(nprocs())")
Here, we are using the Distributed package, which is part of the Julia standard library that provides distributed memory parallel support. The code prints the process id and the number of processes in the current Julia session.
You will probably only see output from 1 process. We need to add more processes to run the example in parallel. This is done with the addprocs function.
julia> addprocs(3)
We have added 3 new processes. Plus the old one, we have 4 processes. Run the code again.
julia> @everywhere println("Hello, world! I am proc $(myid()) from $(nprocs())")
Now, you should see output from 4 processes.
It is possible to specify the number of processes when starting Julia from the terminal with the -p argument (useful, e.g., when running in a cluster). If you launch Julia from the terminal as
$ julia -p 3
and then run
julia> @everywhere println("Hello, world! I am proc $(myid()) from $(nprocs())")
You should get output from 4 processes as before.
Installing packages
One of the most useful features of Julia is its package manager. It allows one to install Julia packages in a straightforward and platform independent way. To illustrate this, let us consider the following parallel "Hello world" example. This example uses the Message Passing Interface (MPI). We will learn more about MPI later in the course.
Copy the following block of code into a new file named "hello_mpi.jl"
# file hello_mpi.jl
using MPI
MPI.Init()
@@ -14,4 +14,4 @@ julia> DataFrame(a=[1,2],b=[3,4])
You should get an error or a
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
Copy the contents of previous code block into a file called Project.toml and place it in an empty folder named newproject. It is important that the file is named Project.toml. You can create a new folder from the REPL with
julia> mkdir("newproject")
To install all the packages registered in this file you need to activate the folder containing your Project.toml file
(@v1.8) pkg> activate newproject
and then instantiating it
(newproject) pkg> instantiate
The instantiate command will download and install all listed packages and their dependencies in just one click.
Getting help in package mode
You can get help about a particular package operator by writing help in front of it
(@v1.8) pkg> help activate
You can get an overview of all package commands by typing help alone
(@v1.8) pkg> help
Package operations in Julia code
In some situations it is required to use package commands in Julia code, e.g., to automatize installation and deployment of Julia applications. This can be done using the Pkg package. For instance
julia> using Pkg
-julia> Pkg.status()
is equivalent to calling status in package mode.
(@v1.8) pkg> status
Conclusion
We have learned the basics of how to work with Julia. If you want to further dig into the topics we have covered here, you can take a look at the following links:
Settings
This document was generated with Documenter.jl version 0.27.25 on Friday 25 August 2023. Using Julia version 1.9.3.
+julia> Pkg.status()is equivalent to calling status in package mode.
(@v1.8) pkg> statusConclusion
We have learned the basics of how to work with Julia. If you want to further dig into the topics we have covered here, you can take a look at the following links:
Settings
This document was generated with Documenter.jl version 0.27.25 on Tuesday 29 August 2023. Using Julia version 1.9.3.
Programming Large-Scale Parallel Systems (XM_40017)
Welcome to the interactive lecture notes of the Programming Large-Scale Parallel Systems course at VU Amsterdam!
What
This page contains part of the course material of the Programming Large-Scale Parallel Systems course at VU Amsterdam. We provide several lecture notes in jupyter notebook format, which will help you to learn how to design, analyze, and program parallel algorithms on multi-node computing systems. Further information about the course is found in the study guide (click here) and our Canvas page (for registered students).
Material will be added incrementally to the website as the course advances.
This page will eventually contain only a part of the course material. The rest will be available on Canvas. In particular, the material in this public webpage does not fully cover all topics in the final exam.
How to use this page
You have two main ways of studying the notebooks:
- Download the notebooks and run them locally on your computer (recommended). At each notebook page you will find a green box with links to download the notebook.
- You also have the static version of the notebooks displayed in this webpage for quick reference.
How to run the notebooks locally
To run a notebook locally follow these steps:
- Install Julia (if not done already). More information in Getting started.
- Download the notebook.
- Launch Julia. More information in Getting started.
- Execute these commands in the Julia command line:
julia> using Pkg
+Home · XM_40017 Programming Large-Scale Parallel Systems (XM_40017)
Welcome to the interactive lecture notes of the Programming Large-Scale Parallel Systems course at VU Amsterdam!
What
This page contains part of the course material of the Programming Large-Scale Parallel Systems course at VU Amsterdam. We provide several lecture notes in jupyter notebook format, which will help you to learn how to design, analyze, and program parallel algorithms on multi-node computing systems. Further information about the course is found in the study guide (click here) and our Canvas page (for registered students).
Note Material will be added incrementally to the website as the course advances.
Warning This page will eventually contain only a part of the course material. The rest will be available on Canvas. In particular, the material in this public webpage does not fully cover all topics in the final exam.
How to use this page
You have two main ways of studying the notebooks:
- Download the notebooks and run them locally on your computer (recommended). At each notebook page you will find a green box with links to download the notebook.
- You also have the static version of the notebooks displayed in this webpage for quick reference.
How to run the notebooks locally
To run a notebook locally follow these steps:
- Install Julia (if not done already). More information in Getting started.
- Download the notebook.
- Launch Julia. More information in Getting started.
- Execute these commands in the Julia command line:
julia> using Pkg
julia> Pkg.add("IJulia")
julia> using IJulia
-julia> notebook()
- These commands will open a jupyter in your web browser. Navigate in jupyter to the notebook file you have downloaded and open it.
Authors
This material is created by Francesc Verdugo with the help of Gelieza Kötterheinrich. Part of the notebooks are based on the course slides by Henri Bal.
License
All material on this page that is original to this course may be used under a CC BY 4.0 license.
Acknowledgment
This page was created with the support of the Faculty of Science of Vrije Universiteit Amsterdam in the framework of the project "Interactive lecture notes and exercises for the Programming Large-Scale Parallel Systems course" funded by the "Innovation budget BETA 2023 Studievoorschotmiddelen (SVM) towards Activated Blended Learning".
Settings
This document was generated with Documenter.jl version 0.27.25 on Friday 25 August 2023. Using Julia version 1.9.3.
+julia> notebook()- These commands will open a jupyter in your web browser. Navigate in jupyter to the notebook file you have downloaded and open it.
Authors
This material is created by Francesc Verdugo with the help of Gelieza Kötterheinrich. Part of the notebooks are based on the course slides by Henri Bal.
License
All material on this page that is original to this course may be used under a CC BY 4.0 license.
Acknowledgment
This page was created with the support of the Faculty of Science of Vrije Universiteit Amsterdam in the framework of the project "Interactive lecture notes and exercises for the Programming Large-Scale Parallel Systems course" funded by the "Innovation budget BETA 2023 Studievoorschotmiddelen (SVM) towards Activated Blended Learning".
Settings
This document was generated with Documenter.jl version 0.27.25 on Tuesday 29 August 2023. Using Julia version 1.9.3.
-
@@ -14,4 +14,4 @@
var myIframe = document.getElementById("notebook");
iFrameResize({log:true}, myIframe);
});
-
Settings
This document was generated with Documenter.jl version 0.27.25 on Friday 25 August 2023. Using Julia version 1.9.3.
Settings
This document was generated with Documenter.jl version 0.27.25 on Tuesday 29 August 2023. Using Julia version 1.9.3.
-
@@ -14,4 +14,4 @@
var myIframe = document.getElementById("notebook");
iFrameResize({log:true}, myIframe);
});
-
Settings
This document was generated with Documenter.jl version 0.27.25 on Friday 25 August 2023. Using Julia version 1.9.3.
Settings
This document was generated with Documenter.jl version 0.27.25 on Tuesday 29 August 2023. Using Julia version 1.9.3.
-
@@ -14,4 +14,4 @@
var myIframe = document.getElementById("notebook");
iFrameResize({log:true}, myIframe);
});
-
Settings
This document was generated with Documenter.jl version 0.27.25 on Friday 25 August 2023. Using Julia version 1.9.3.
Settings
This document was generated with Documenter.jl version 0.27.25 on Tuesday 29 August 2023. Using Julia version 1.9.3.
-
@@ -14,4 +14,4 @@
var myIframe = document.getElementById("notebook");
iFrameResize({log:true}, myIframe);
});
-
Settings
This document was generated with Documenter.jl version 0.27.25 on Friday 25 August 2023. Using Julia version 1.9.3.
Settings
This document was generated with Documenter.jl version 0.27.25 on Tuesday 29 August 2023. Using Julia version 1.9.3.
-
@@ -14,4 +14,4 @@
var myIframe = document.getElementById("notebook");
iFrameResize({log:true}, myIframe);
});
-
Settings
This document was generated with Documenter.jl version 0.27.25 on Friday 25 August 2023. Using Julia version 1.9.3.
Settings
This document was generated with Documenter.jl version 0.27.25 on Tuesday 29 August 2023. Using Julia version 1.9.3.
-
@@ -14,4 +14,4 @@
var myIframe = document.getElementById("notebook");
iFrameResize({log:true}, myIframe);
});
-
Settings
This document was generated with Documenter.jl version 0.27.25 on Friday 25 August 2023. Using Julia version 1.9.3.
Settings
This document was generated with Documenter.jl version 0.27.25 on Tuesday 29 August 2023. Using Julia version 1.9.3.
-
@@ -14,4 +14,4 @@
var myIframe = document.getElementById("notebook");
iFrameResize({log:true}, myIframe);
});
-
Settings
This document was generated with Documenter.jl version 0.27.25 on Friday 25 August 2023. Using Julia version 1.9.3.
Settings
This document was generated with Documenter.jl version 0.27.25 on Tuesday 29 August 2023. Using Julia version 1.9.3.
-
@@ -14,4 +14,4 @@
var myIframe = document.getElementById("notebook");
iFrameResize({log:true}, myIframe);
});
-
Settings
This document was generated with Documenter.jl version 0.27.25 on Friday 25 August 2023. Using Julia version 1.9.3.
Settings
This document was generated with Documenter.jl version 0.27.25 on Tuesday 29 August 2023. Using Julia version 1.9.3.
-
@@ -14,4 +14,4 @@
var myIframe = document.getElementById("notebook");
iFrameResize({log:true}, myIframe);
});
-
Settings
This document was generated with Documenter.jl version 0.27.25 on Friday 25 August 2023. Using Julia version 1.9.3.
Settings
This document was generated with Documenter.jl version 0.27.25 on Tuesday 29 August 2023. Using Julia version 1.9.3.
-
@@ -14,4 +14,4 @@
var myIframe = document.getElementById("notebook");
iFrameResize({log:true}, myIframe);
});
-
Settings
This document was generated with Documenter.jl version 0.27.25 on Friday 25 August 2023. Using Julia version 1.9.3.
Settings
This document was generated with Documenter.jl version 0.27.25 on Tuesday 29 August 2023. Using Julia version 1.9.3.
What is MPI ?¶
- MPI stands for the "Message Passing Interface" -
- It is a standardized library specification for communication between parallel processes in distributed memory systems. +
- It is a standardized library specification for communication between parallel processes in distributed-memory systems.
- It is the gold-standard for distributed computing in HPC systems since the 90s -
- It is huge: the MPI standard has above 1k pages (see https://www.mpi-forum.org/docs/mpi-4.0/mpi40-report.pdf) +
- It is huge: the MPI standard has more than 1k pages (see https://www.mpi-forum.org/docs/mpi-4.0/mpi40-report.pdf)
- There are several implementations of this standard (OpenMPI, MPICH, IntelMPI)
- The interface is in C and FORTRAN (C++ was deprecated)
- There are Julia bindings via the package MPI.jl https://github.com/JuliaParallel/MPI.jl @@ -7497,13 +7497,13 @@ a.anchor-link {
Hello-world example¶
+MPI Communicators¶
In MPI, a communicator represents a group of processes that can communicate with each other. MPI_COMM_WORLD (MPI.COMM_WORLD from Julia) is a built-in communicator that represents all processes available in the MPI program. Custom communicators can also be created to group processes based on specific requirements or logical divisions. The rank of a processor is a unique identifier assigned to each process within a communicator. It allows processes to distinguish and address each other in communication operations.
MPI Communicators¶
In MPI, a communicator represents a group of processes that can communicate with each other. MPI_COMM_WORLD (MPI.COMM_WORLD from Julia) is a built-in communicator that represents all processes available in the MPI program. Custom communicators can also be created to group processes based on specific requirements or logical divisions. The rank of a processor is a unique (integer) identifier assigned to each process within a communicator. It allows processes to distinguish and address each other in communication operations.
Duplicating a communicator¶
It is a good practice to not using the built-in communicators directly, and use a copy instead with MPI.Comm_dup. Different libraries using the same communicator can lead to unexpected interferences.
Point-to-Point communication¶
MPI also provides point-to-point communication directives for arbitrary communication between processes. Point-to-point communications are two-sided: there is a sender and a receiver. Here, we will discuss these basic directives:
-
-
MPI.Isend, andMPI.Irecv!
+MPI.Isend, andMPI.Irecv!(non-blocking directives)
+MPI.Send, andMPI.Recv(blocking directives)
which are non-blocking directives.
-MPI also offers blocking directives with different blocking behaviors (communication modes). Blocking communication will be discussed later in the course.
+Non-blocking directives return immediately and return an MPI.Request object. This request object can be queried with functions like MPI.Wait. It is mandatory to wait on the request object before reading the receive buffer, or before writing again on the send buffer.
For blocking directives, it is save to read/write from/to the receive/send buffer once the function has returned. By default, blocking directives might wait (or might not wait) for a matching send/receive. +For fine control, MPI offers advanced blocking directives with different blocking behaviors (called communication modes, see section 3.9 of the MPI standard 4.0). Blocking communication will be discussed later in the course.
License¶
TODO: replace link to website
-This notebook is part of the course Programming Large Scale Parallel Systems at Vrije Universiteit Amsterdam and may be used under a CC BY 4.0 license.
+Example (with blocking directives)¶
+@everywhere workers() begin
+ comm = MPI.Comm_dup(MPI.COMM_WORLD)
+ rank = MPI.Comm_rank(comm)
+ nranks = MPI.Comm_size(comm)
+ snder = 0
+ rcver = nranks-1
+ buffer = Ref(0)
+ if rank == snder
+ msg = 10*(rank+2)
+ println("I am sending: $msg")
+ buffer[] = msg
+ MPI.Send(buffer,comm;dest=rcver,tag=0)
+ MPI.Recv!(buffer,comm,source=rcver,tag=0)
+ msg = buffer[]
+ println("I have received: $msg")
+ end
+ if rank == rcver
+ MPI.Recv!(buffer,comm,source=snder,tag=0)
+ msg = buffer[]
+ println("I have received: $msg")
+ coef = (rank+2)
+ msg = msg*coef
+ println("I am sending: $msg")
+ buffer[] = msg
+ MPI.Send(buffer,comm;dest=snder,tag=0)
+ end
+end
Exercises¶
+Exercise 1¶
Implement this simple algorithm: Rank 0 generates a message (an integer). Rank 0 sends the message to rank 1. Rank 1 receives the message, increments the message by 1, and sends the result to rank 2. Rank 2 receives the message, increments the message by 1, and sends the result to rank 3. Etc. The last rank sends back the message to rank 0 closing the ring. See the next figure. Implement the communications using MPI.
+Exercise 2¶
Implement the same algorithm as in Exercise 1, but now without using MPI. Implement the communications using the native Distributed module provided by Julia. In this case, start using process 1 instead of rank 0.
License¶
This notebook is part of the course Programming Large Scale Parallel Systems at Vrije Universiteit Amsterdam and may be used under a CC BY 4.0 license.
+