From d6d7e8baa6937362e0cdf6bd8c8f83993978f3fa Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Thu, 17 Aug 2023 12:55:29 +0000 Subject: [PATCH] build based on fc54959 --- dev/getting_started_with_julia/index.html | 2 +- dev/index.html | 2 +- dev/notebook-html/solutions.html | 118 +++++++++++++++++++++ dev/notebooks/jacobi_2D/index.html | 2 +- dev/notebooks/jacobi_method/index.html | 2 +- dev/notebooks/julia_async/index.html | 2 +- dev/notebooks/julia_basics/index.html | 2 +- dev/notebooks/julia_distributed/index.html | 2 +- dev/notebooks/julia_intro/index.html | 2 +- dev/notebooks/julia_jacobi/index.html | 2 +- dev/notebooks/julia_tutorial/index.html | 2 +- dev/notebooks/matrix_matrix/index.html | 2 +- dev/notebooks/mpi_tutorial/index.html | 2 +- dev/notebooks/notebook-hello/index.html | 2 +- dev/notebooks/solutions.ipynb | 104 ++++++++++++++++++ dev/notebooks/solutions/index.html | 2 +- dev/notebooks/tsp/index.html | 2 +- dev/search/index.html | 2 +- 18 files changed, 238 insertions(+), 16 deletions(-) diff --git a/dev/getting_started_with_julia/index.html b/dev/getting_started_with_julia/index.html index 2674232..5d28244 100644 --- a/dev/getting_started_with_julia/index.html +++ b/dev/getting_started_with_julia/index.html @@ -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:

+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:

diff --git a/dev/index.html b/dev/index.html index 65cf263..557f26c 100644 --- a/dev/index.html +++ b/dev/index.html @@ -2,4 +2,4 @@ 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

This page contains only a part of the course material. The rest is available on Canvas. In particular, the lecture notes in this public webpage do not fully cover all topics in the final exam.

How to use this page

You have two main ways of running the notebooks:

  • Download the notebooks and run them locally on your computer (recommended)
  • Run the notebooks on the cloud via mybinder.org (high startup time).

You also have the static version of the notebooks displayed in this webpage for quick reference. At each notebook page you will find a green box with links to download the notebook or to open in on mybinder.

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".

+julia> notebook()

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".

diff --git a/dev/notebook-html/solutions.html b/dev/notebook-html/solutions.html index 6ba0eca..196dff6 100644 --- a/dev/notebook-html/solutions.html +++ b/dev/notebook-html/solutions.html @@ -7658,6 +7658,124 @@ a.anchor-link { +
+ +
+ +
+
+ +
+ +
+
diff --git a/dev/notebooks/jacobi_method/index.html b/dev/notebooks/jacobi_method/index.html index 16f98a6..cb70246 100644 --- a/dev/notebooks/jacobi_method/index.html +++ b/dev/notebooks/jacobi_method/index.html @@ -18,4 +18,4 @@ var myIframe = document.getElementById("notebook"); iFrameResize({log:true}, myIframe); }); - + diff --git a/dev/notebooks/julia_async/index.html b/dev/notebooks/julia_async/index.html index 392c6b4..3a8400a 100644 --- a/dev/notebooks/julia_async/index.html +++ b/dev/notebooks/julia_async/index.html @@ -18,4 +18,4 @@ var myIframe = document.getElementById("notebook"); iFrameResize({log:true}, myIframe); }); - + diff --git a/dev/notebooks/julia_basics/index.html b/dev/notebooks/julia_basics/index.html index 88c636d..a16ab91 100644 --- a/dev/notebooks/julia_basics/index.html +++ b/dev/notebooks/julia_basics/index.html @@ -18,4 +18,4 @@ var myIframe = document.getElementById("notebook"); iFrameResize({log:true}, myIframe); }); - + diff --git a/dev/notebooks/julia_distributed/index.html b/dev/notebooks/julia_distributed/index.html index c227501..b2225f4 100644 --- a/dev/notebooks/julia_distributed/index.html +++ b/dev/notebooks/julia_distributed/index.html @@ -18,4 +18,4 @@ var myIframe = document.getElementById("notebook"); iFrameResize({log:true}, myIframe); }); - + diff --git a/dev/notebooks/julia_intro/index.html b/dev/notebooks/julia_intro/index.html index 762b4b8..b4c8f21 100644 --- a/dev/notebooks/julia_intro/index.html +++ b/dev/notebooks/julia_intro/index.html @@ -18,4 +18,4 @@ var myIframe = document.getElementById("notebook"); iFrameResize({log:true}, myIframe); }); - + diff --git a/dev/notebooks/julia_jacobi/index.html b/dev/notebooks/julia_jacobi/index.html index 7b73d70..3cff7c0 100644 --- a/dev/notebooks/julia_jacobi/index.html +++ b/dev/notebooks/julia_jacobi/index.html @@ -18,4 +18,4 @@ var myIframe = document.getElementById("notebook"); iFrameResize({log:true}, myIframe); }); - + diff --git a/dev/notebooks/julia_tutorial/index.html b/dev/notebooks/julia_tutorial/index.html index 13093cc..4122154 100644 --- a/dev/notebooks/julia_tutorial/index.html +++ b/dev/notebooks/julia_tutorial/index.html @@ -18,4 +18,4 @@ var myIframe = document.getElementById("notebook"); iFrameResize({log:true}, myIframe); }); - + diff --git a/dev/notebooks/matrix_matrix/index.html b/dev/notebooks/matrix_matrix/index.html index 78fffad..5e359c0 100644 --- a/dev/notebooks/matrix_matrix/index.html +++ b/dev/notebooks/matrix_matrix/index.html @@ -18,4 +18,4 @@ var myIframe = document.getElementById("notebook"); iFrameResize({log:true}, myIframe); }); - + diff --git a/dev/notebooks/mpi_tutorial/index.html b/dev/notebooks/mpi_tutorial/index.html index a152eba..a1903c3 100644 --- a/dev/notebooks/mpi_tutorial/index.html +++ b/dev/notebooks/mpi_tutorial/index.html @@ -18,4 +18,4 @@ var myIframe = document.getElementById("notebook"); iFrameResize({log:true}, myIframe); }); - + diff --git a/dev/notebooks/notebook-hello/index.html b/dev/notebooks/notebook-hello/index.html index 21435d9..7fb2fdc 100644 --- a/dev/notebooks/notebook-hello/index.html +++ b/dev/notebooks/notebook-hello/index.html @@ -18,4 +18,4 @@ var myIframe = document.getElementById("notebook"); iFrameResize({log:true}, myIframe); }); - + diff --git a/dev/notebooks/solutions.ipynb b/dev/notebooks/solutions.ipynb index 94812bf..64b99de 100644 --- a/dev/notebooks/solutions.ipynb +++ b/dev/notebooks/solutions.ipynb @@ -187,6 +187,110 @@ "end" ] }, + { + "cell_type": "markdown", + "id": "2f343157", + "metadata": {}, + "source": [ + "## Exercise: Ring communication - MPI" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a49be691", + "metadata": {}, + "outputs": [], + "source": [ + "using MPI\n", + "using Test\n", + "\n", + "MPI.Init()\n", + "comm = MPI.COMM_WORLD\n", + "rank = MPI.Comm_rank(comm)\n", + "id = rank + 1\n", + "root = 0\n", + "size = MPI.Comm_size(comm)\n", + "\n", + "dst = mod(rank + 1, size)\n", + "src = mod(rank - 1, size)\n", + "\n", + "send_buf = id\n", + "recv_buf = 1\n", + "\n", + "if rank == root \n", + " # Proc 1: Send id async to destination, then wait for receive\n", + " MPI.isend(send_buf, comm; dest=dst, tag=0)\n", + " recv_buf = MPI.recv(comm; source=src, tag=0)\n", + " @show recv_buf == factorial(size)\n", + " @test recv_buf == factorial(size)\n", + "else\n", + " # Other procs: receive sync and send async to next process\n", + " recv_buf = MPI.recv(comm; source=src, tag=0)\n", + " send_buf = recv_buf * id\n", + " MPI.isend(send_buf, comm; dest=dst, tag=0)\n", + "end\n", + "\n", + "MPI.Finalize()" + ] + }, + { + "cell_type": "markdown", + "id": "6cbbf074", + "metadata": {}, + "source": [ + "## Exercise: Ring communication - Distributed.jl" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dc156523", + "metadata": {}, + "outputs": [], + "source": [ + "using Distributed \n", + "using Test\n", + "\n", + "np = 4\n", + "add_n = np - nprocs() \n", + "addprocs(add_n)\n", + "worker_ids = workers()\n", + "@assert nprocs() > nworkers()\n", + "\n", + "# Initialize id channel\n", + "id_chnl = RemoteChannel(()->Channel{Int}(1))\n", + "put!(id_chnl, 1)\n", + "\n", + "# Initialize data channel\n", + "job_chnl = RemoteChannel(()->Channel{Int}(1))\n", + "put!(job_chnl, 1)\n", + "\n", + "@sync for w in workers()\n", + " @spawnat w begin\n", + " pos = findfirst(worker_ids .== w) + 1\n", + " dst = mod(pos, np) + 1\n", + " src = mod(pos-2, np) + 1\n", + " while true \n", + " pred = fetch(id_chnl)\n", + " if pred == src\n", + " take!(id_chnl)\n", + " value = take!(job_chnl)\n", + " put!(job_chnl, value * pos) \n", + " put!(id_chnl, pos) \n", + " break\n", + " end\n", + " end\n", + " end\n", + "end\n", + "\n", + "res = take!(job_chnl)\n", + "@show res\n", + "@test res == factorial(np)\n", + "\n", + "rmprocs(workers())" + ] + }, { "cell_type": "markdown", "id": "47d88e7a", diff --git a/dev/notebooks/solutions/index.html b/dev/notebooks/solutions/index.html index 2ce7c6b..339d1bc 100644 --- a/dev/notebooks/solutions/index.html +++ b/dev/notebooks/solutions/index.html @@ -18,4 +18,4 @@ var myIframe = document.getElementById("notebook"); iFrameResize({log:true}, myIframe); }); - + diff --git a/dev/notebooks/tsp/index.html b/dev/notebooks/tsp/index.html index f4e2f42..8d6ad20 100644 --- a/dev/notebooks/tsp/index.html +++ b/dev/notebooks/tsp/index.html @@ -18,4 +18,4 @@ var myIframe = document.getElementById("notebook"); iFrameResize({log:true}, myIframe); }); - + diff --git a/dev/search/index.html b/dev/search/index.html index 9576283..78a6b3d 100644 --- a/dev/search/index.html +++ b/dev/search/index.html @@ -1,2 +1,2 @@ -Search · XM_40017

Loading search...

    +Search · XM_40017

    Loading search...