From 732eb4ee00987467097cb1a8f192dca6dad44b7f Mon Sep 17 00:00:00 2001 From: Gelieza K Date: Fri, 11 Aug 2023 12:56:59 +0200 Subject: [PATCH 1/5] Add tutorial how to use MPI from Julia --- notebooks/mpi_tutorial.ipynb | 401 +++++++++++++++++++++++++++++++++++ 1 file changed, 401 insertions(+) create mode 100644 notebooks/mpi_tutorial.ipynb diff --git a/notebooks/mpi_tutorial.ipynb b/notebooks/mpi_tutorial.ipynb new file mode 100644 index 0000000..bcebddd --- /dev/null +++ b/notebooks/mpi_tutorial.ipynb @@ -0,0 +1,401 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "8d800917", + "metadata": {}, + "source": [ + "# Tutorial: Using MPI in Julia\n", + "Message Passing Interface (MPI) is a standardized and portable library specification for communication between parallel processes in distributed memory systems. Julia offers a convenient way to work with MPI for creating efficient parallel and distributed applications. In this tutorial, you will learn how to use MPI from Julia to perform parallel computing tasks.\n", + "\n", + "## MPI launches separate Julia instances\n", + "When you run an MPI-enabled Julia script, MPI takes care of spawning multiple instances of the Julia executable, each acting as a separate process. These workers can communicate with each other using MPI communication functions. This enables parallel processing and distributed computation. Here's a summary of how it works:\n", + "\n", + "-- TODO: insert picture here --\n", + "\n", + "- **MPI Spawns Processes**: The `mpiexec` command launches multiple instances of the Julia executable, creating separate worker processes. In this example, 4 Julia workers are spawned.\n", + "\n", + "- **Worker Communication**: These workers can communicate with each other using MPI communication functions, allowing them to exchange data and coordinate actions.\n", + "\n", + "- **Parallel Tasks**: The workers execute parallel tasks simultaneously, working on different parts of the computation to potentially speed up the process.\n", + "\n", + "\n", + " \n", + "\n", + "\n", + "## Installing MPI.jl and MPIClusterManagers Packages\n", + "To use MPI in Julia, you'll need the MPI.jl package, and if you intend to run MPI programs in a Jupyter Notebook, you'll also need the MPIClusterManagers package. These packages provide the necessary bindings to the MPI library and cluster management capabilities. To install the packages, open a terminal and run the following commands:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3cb5f151", + "metadata": {}, + "outputs": [], + "source": [ + "using Pkg\n", + "Pkg.add(\"MPI\")\n", + "Pkg.add(\"MPIClusterManagers\")" + ] + }, + { + "cell_type": "markdown", + "id": "ed45a4b2", + "metadata": {}, + "source": [ + "
\n", + " Tip:\n", + "The package MPI.jl is the Julia interface to MPI. Note that it is not a MPI library by itself. It is just a thin wrapper between MPI and Julia. To use this interface, you need an actual MPI library installed in your system such as OpenMPI or MPICH. Julia downloads and installs a MPI library for you, but it is also possible to use a MPI library already available in your system. This is useful, e.g., when running on HPC clusters. See the documentation of MPI.jl for further details.\n", + "
" + ] + }, + { + "cell_type": "markdown", + "id": "7a36916e", + "metadata": {}, + "source": [ + "## Writing a HelloWorld MPI Program in Julia\n", + "Let's start by creating a simple MPI program that prints a message along with the rank of each worker. \n", + "\n", + "Create a new Julia script, for example, `mpi_hello_world.jl`:\n", + "\n", + "```julia\n", + "using MPI\n", + "\n", + "# Initialize MPI\n", + "MPI.Init()\n", + "\n", + "# Get the default communicator (MPI_COMM_WORLD) for all processes\n", + "comm = MPI.COMM_WORLD\n", + "\n", + "# Get the number of processes in this communicator\n", + "nranks = MPI.Comm_size(comm)\n", + "\n", + "# Get the rank of the current process within the communicator\n", + "rank = MPI.Comm_rank(comm)\n", + "\n", + "# Print a message with the rank of the current process\n", + "println(\"Hello, I am process $rank of $nranks processes!\")\n", + "\n", + "# Finalize MPI\n", + "MPI.Finalize()\n", + "```" + ] + }, + { + "cell_type": "markdown", + "id": "6caa8d74", + "metadata": {}, + "source": [ + "### MPI Communicators\n", + "In MPI, a **communicator** is a context in which a group of processes can communicate with each other. `MPI_COMM_WORLD` is one of the MPI standard communicators, it represents all processes in the MPI program. Custom communicators can also be created to group processes based on specific requirements or logical divisions. \n", + "\n", + "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. " + ] + }, + { + "cell_type": "markdown", + "id": "19f41e38", + "metadata": {}, + "source": [ + "## Running the HelloWorld MPI Program\n", + "\n", + "To run MPI applications in parallel, you need a launcher like `mpiexec`. MPI codes written in Julia are not an exception to this rule. From the system terminal, you can run\n", + "```\n", + "$ mpiexec -np 4 mpi_hello_world.jl\n", + "```\n", + "In this command, `-np 4` specifies the desired number of processes. \n", + "But it will probably not work since the version of `mpiexec` needs to match with the MPI version we are using from Julia. You can find the path to the `mpiexec` binary you need to use with these commands\n", + "\n", + "```julia\n", + "julia> using MPI\n", + "julia> MPI.mpiexec_path\n", + "```\n", + "\n", + "and then try again\n", + "```\n", + "$ /path/to/my/mpiexec -np 4 julia mpi_hello_world.jl\n", + "```\n", + "with your particular path.\n", + "\n", + "However, this is not very convenient. Don't worry if you could not make it work! A more elegant way to run MPI code is from the Julia REPL directly, by using these commands:\n", + "```julia\n", + "julia> using MPI\n", + "julia> mpiexec(cmd->run(`$cmd -np 4 julia mpi_hello_world.jl`))\n", + "```\n", + "\n", + "Now, you should see output from 4 ranks.\n" + ] + }, + { + "cell_type": "markdown", + "id": "0592e58c", + "metadata": {}, + "source": [ + "## Running MPI Programs in Jupyter Notebook with MPIClusterManagers\n", + "If you want to run your MPI code from a Jupyter Notebook, you can do so using the `MPIClusterManagers` package.\n", + "\n", + "1. Load the packages and start an MPI cluster with the desired number of workers:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cf66dd39", + "metadata": {}, + "outputs": [], + "source": [ + "using MPIClusterManagers\n", + "# Distributed package is needed for addprocs()\n", + "using Distributed\n", + "\n", + "manager = MPIWorkerManager(4)\n", + "addprocs(manager)" + ] + }, + { + "cell_type": "markdown", + "id": "d40fe3ee", + "metadata": {}, + "source": [ + "2. Run your MPI code inside a `@mpi_do` block to execute it on the cluster workers:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0a51d1f2", + "metadata": {}, + "outputs": [], + "source": [ + "@mpi_do manager begin\n", + " using MPI\n", + " comm = MPI.COMM_WORLD\n", + " rank = MPI.Comm_rank(comm)\n", + " println(\"Hello from process $rank\")\n", + "end\n" + ] + }, + { + "cell_type": "markdown", + "id": "38ed88c1", + "metadata": {}, + "source": [ + "MPI is automatically initialized and finalized within the `@mpi_do` block.\n", + "\n", + "3. Remove processes when done:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e0b53cc1", + "metadata": {}, + "outputs": [], + "source": [ + "rmprocs(manager)" + ] + }, + { + "cell_type": "markdown", + "id": "5466a650", + "metadata": {}, + "source": [ + "## Point-to-Point Communication with MPI\n", + "MPI provides point-to-point communication using blocking send and receiving functions `MPI.send`, `MPI.recv`; or their non-blocking versions `MPI.Isend`, and `MPI.Irecv!`. These functions allow individual processes to send and receive data between each other.\n", + "\n", + "### Blocking communication\n", + "\n", + "Let's demonstrate how to send and receive with an example:\n", + "\n", + "```julia\n", + "using MPI\n", + "\n", + "MPI.Init()\n", + "\n", + "comm = MPI.COMM_WORLD\n", + "rank = MPI.Comm_rank(comm)\n", + "\n", + "# Send and receive messages using blocking MPI.send and MPI.recv\n", + "if rank == 0\n", + " data = \"Hello from process $rank !\"\n", + " MPI.send(data, comm, dest=1)\n", + "elseif rank == 1\n", + " received_data = MPI.recv(comm, source=0)\n", + " println(\"Process $rank received: $received_data\")\n", + "end\n", + "\n", + "MPI.Finalize()\n", + "```" + ] + }, + { + "cell_type": "markdown", + "id": "d4dfe654", + "metadata": {}, + "source": [ + "In this example, process 0 sends a message using `MPI.send`, and process 1 receives it using `MPI.recv`.\n", + "\n", + "### Non-blocking communication\n", + "\n", + "To demonstrate asynchronous communication, let's modify the example using `MPI.Isend` and `MPI.Irecv!`:\n", + "\n", + "```julia\n", + "using MPI\n", + "\n", + "MPI.Init()\n", + "\n", + "comm = MPI.COMM_WORLD\n", + "rank = MPI.Comm_rank(comm)\n", + "\n", + "# Asynchronous communication using MPI.Isend and MPI.Irecv!\n", + "if rank == 0\n", + " data = \"Hello from process $rank !\"\n", + " request = MPI.Isend(data, comm, dest=1)\n", + " # Other computation can happen here\n", + " MPI.Wait(request)\n", + "elseif rank == 1\n", + " received_data = Array{UInt8}(undef, 50) # Preallocate buffer\n", + " request = MPI.Irecv!(received_data, comm, source=0)\n", + " # Other computation can happen here\n", + " MPI.Wait(request)\n", + " println(\"Process $rank received: $(String(received_data))\")\n", + "end\n", + "\n", + "MPI.Finalize()\n", + "```" + ] + }, + { + "cell_type": "markdown", + "id": "024db538", + "metadata": {}, + "source": [ + "In this example, process 0 uses `MPI.Isend` to send the message asynchronously. This function returns immediately, allowing the sender process to continue its execution. However, the actual sending of data is done asynchronously in the background. Similar to `MPI.Isend`, `MPI.Irecv!` returns immediately, allowing the receiver process to continue executing. \n", + "\n", + "
\n", + "Important: In asynchronous communication, always use MPI.Wait() to ensure the communication is finished before accessing the send or receive buffer.\n", + "
\n", + "\n", + "\n", + "## Collective Communication with MPI\n", + "MPI provides collective communication functions for communication involving multiple processes. Let's explore some of these functions:\n", + "\n", + "- MPI.Gather: Gathers data from all processes to a single process.\n", + "- MPI.Scatter: Distributes data from one process to all processes.\n", + "- MPI.Bcast: Broadcasts data from one process to all processes.\n", + "- MPI.Barrier: Synchronizes all processes.\n", + "\n", + "\n", + "Let's illustrate the use of `MPI.Gather` and `MPI.Scatter` with an example:\n", + "\n", + "```julia\n", + "# TODO: check if this runs correctly\n", + "using MPI\n", + "using Random\n", + "\n", + "MPI.Init()\n", + "\n", + "comm = MPI.COMM_WORLD\n", + "rank = MPI.Comm_rank(comm)\n", + "size = MPI.Comm_size(comm)\n", + "\n", + "# Root processor generates random data\n", + "data = rand(rank == 0 ? size * 2 : 0)\n", + "\n", + "# Scatter data to all processes\n", + "local_data = Vector{Float64}(undef, 2)\n", + "MPI.Scatter!(data, local_data, comm, root=0)\n", + "\n", + "# Compute local average\n", + "local_average = sum(local_data) / length(local_data)\n", + "\n", + "# Gather local averages at the root processor\n", + "gathered_averages = Vector{Float64}(undef, size)\n", + "MPI.Gather!(local_average, gathered_averages, comm, root=0)\n", + "\n", + "if rank == 0\n", + " # Compute global average of sub-averages\n", + " global_average = sum(gathered_averages) / size\n", + " println(\"Global average: $global_average\")\n", + "end\n", + "\n", + "MPI.Finalize()\n", + "```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e65cb53f", + "metadata": {}, + "outputs": [], + "source": [ + "using MPI\n", + "using Random\n", + "\n", + "# TODO: check if this runs correctly\n", + "\n", + "MPI.Init()\n", + "\n", + "comm = MPI.COMM_WORLD\n", + "rank = MPI.Comm_rank(comm)\n", + "size = MPI.Comm_size(comm)\n", + "\n", + "# Root processor generates random data\n", + "data = rand(rank == 0 ? size * 2 : 0)\n", + "\n", + "# Scatter data to all processes\n", + "local_data = Vector{Float64}(undef, 2)\n", + "MPI.Scatter!(data, local_data, comm, root=0)\n", + "\n", + "# Compute local average\n", + "local_average = sum(local_data) / length(local_data)\n", + "\n", + "# Gather local averages at the root processor\n", + "gathered_averages = Vector{Float64}(undef, size)\n", + "MPI.Gather!(local_average, gathered_averages, comm, root=0)\n", + "\n", + "if rank == 0\n", + " # Compute global average of sub-averages\n", + " global_average = sum(gathered_averages) / size\n", + " println(\"Global average: $global_average\")\n", + "end\n", + "\n", + "MPI.Finalize()" + ] + }, + { + "cell_type": "markdown", + "id": "dfd5da9e", + "metadata": {}, + "source": [ + "In this example, the root processor generates random data and then scatters it to all processes using MPI.Scatter. Each process calculates the average of its local data, and then the local averages are gathered using MPI.Gather. The root processor computes the global average of all sub-averages and prints it." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fcf34823", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Julia 1.9.1", + "language": "julia", + "name": "julia-1.9" + }, + "language_info": { + "file_extension": ".jl", + "mimetype": "application/julia", + "name": "julia", + "version": "1.9.1" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 7f0f40fa47e2dced7af4a0114e6847eafe22dbb9 Mon Sep 17 00:00:00 2001 From: Gelieza K Date: Fri, 11 Aug 2023 15:41:40 +0200 Subject: [PATCH 2/5] Restructure folders --- docs/.gitignore | 6 +- docs/make.jl | 54 +- docs/src/getting_started_with_julia.md | 2 - .../jacobi_2D.html} | 199 +- docs/src/notebook-html/jacobi_method.html | 15927 +++++++++++++++ .../julia_async.html | 1087 +- .../julia_basics.html | 1253 +- .../julia_distributed.html | 1189 +- .../julia_intro.html | 1087 +- .../julia_jacobi.html} | 199 +- .../julia_tutorial.html} | 199 +- .../matrix_matrix.html | 1115 +- docs/src/notebook-html/mpi_tutorial.html | 15546 ++++++++++++++ .../notebook-hello.html | 985 +- .../sol_matrix_matrix.html | 957 +- docs/src/notebook-html/tsp.html | 15456 ++++++++++++++ .../julia_distributed_test.html | 16868 ---------------- docs/src/notebooks/jacobi_2D.ipynb | 2126 ++ docs/src/{ => notebooks}/jacobi_2D.md | 4 +- docs/src/notebooks/jacobi_method.ipynb | 676 + .../jacobi_method.md} | 8 +- docs/src/notebooks/julia_async.ipynb | 774 + docs/src/{ => notebooks}/julia_async.md | 4 +- docs/src/notebooks/julia_basics.ipynb | 1605 ++ docs/src/{ => notebooks}/julia_basics.md | 4 +- docs/src/notebooks/julia_distributed.ipynb | 1323 ++ docs/src/{ => notebooks}/julia_distributed.md | 4 +- docs/src/notebooks/julia_intro.ipynb | 746 + docs/src/{ => notebooks}/julia_intro.md | 4 +- docs/src/notebooks/julia_jacobi.ipynb | 652 + docs/src/{ => notebooks}/julia_jacobi.md | 4 +- docs/src/notebooks/julia_tutorial.ipynb | 505 + docs/src/{ => notebooks}/julia_tutorial.md | 4 +- docs/src/notebooks/matrix_matrix.ipynb | 1136 ++ docs/src/{ => notebooks}/matrix_matrix.md | 4 +- docs/src/notebooks/mpi_tutorial.ipynb | 401 + docs/src/notebooks/mpi_tutorial.md | 30 + docs/src/notebooks/notebook-hello.ipynb | 187 + docs/src/{ => notebooks}/notebook-hello.md | 4 +- docs/src/notebooks/sol_matrix_matrix.ipynb | 60 + docs/src/{ => notebooks}/sol_matrix_matrix.md | 4 +- docs/src/notebooks/tsp.ipynb | 260 + docs/src/notebooks/tsp.md | 30 + 43 files changed, 63394 insertions(+), 19294 deletions(-) rename docs/src/{notebook-output/Jacobi_2D.html => notebook-html/jacobi_2D.html} (99%) create mode 100644 docs/src/notebook-html/jacobi_method.html rename docs/src/{notebook-output => notebook-html}/julia_async.html (92%) rename docs/src/{notebook-output => notebook-html}/julia_basics.html (91%) rename docs/src/{notebook-output => notebook-html}/julia_distributed.html (96%) rename docs/src/{notebook-output => notebook-html}/julia_intro.html (92%) rename docs/src/{notebook-output/julia_Jacobi.html => notebook-html/julia_jacobi.html} (99%) rename docs/src/{notebook-output/julia_Tutorial.html => notebook-html/julia_tutorial.html} (99%) rename docs/src/{notebook-output => notebook-html}/matrix_matrix.html (96%) create mode 100644 docs/src/notebook-html/mpi_tutorial.html rename docs/src/{notebook-output => notebook-html}/notebook-hello.html (92%) rename docs/src/{notebook-output => notebook-html}/sol_matrix_matrix.html (92%) create mode 100644 docs/src/notebook-html/tsp.html delete mode 100644 docs/src/notebook-output/julia_distributed_test.html create mode 100644 docs/src/notebooks/jacobi_2D.ipynb rename docs/src/{ => notebooks}/jacobi_2D.md (82%) create mode 100644 docs/src/notebooks/jacobi_method.ipynb rename docs/src/{julia_distributed_test.md => notebooks/jacobi_method.md} (69%) create mode 100644 docs/src/notebooks/julia_async.ipynb rename docs/src/{ => notebooks}/julia_async.md (82%) create mode 100644 docs/src/notebooks/julia_basics.ipynb rename docs/src/{ => notebooks}/julia_basics.md (82%) create mode 100644 docs/src/notebooks/julia_distributed.ipynb rename docs/src/{ => notebooks}/julia_distributed.md (81%) create mode 100644 docs/src/notebooks/julia_intro.ipynb rename docs/src/{ => notebooks}/julia_intro.md (82%) create mode 100644 docs/src/notebooks/julia_jacobi.ipynb rename docs/src/{ => notebooks}/julia_jacobi.md (82%) create mode 100644 docs/src/notebooks/julia_tutorial.ipynb rename docs/src/{ => notebooks}/julia_tutorial.md (81%) create mode 100644 docs/src/notebooks/matrix_matrix.ipynb rename docs/src/{ => notebooks}/matrix_matrix.md (81%) create mode 100644 docs/src/notebooks/mpi_tutorial.ipynb create mode 100644 docs/src/notebooks/mpi_tutorial.md create mode 100644 docs/src/notebooks/notebook-hello.ipynb rename docs/src/{ => notebooks}/notebook-hello.md (81%) create mode 100644 docs/src/notebooks/sol_matrix_matrix.ipynb rename docs/src/{ => notebooks}/sol_matrix_matrix.md (81%) create mode 100644 docs/src/notebooks/tsp.ipynb create mode 100644 docs/src/notebooks/tsp.md diff --git a/docs/.gitignore b/docs/.gitignore index a25b4f6..c23089c 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1,7 +1,5 @@ build/ site/ docs/src/notebook-output -Manifest.toml -*.md -!index.md -!getting_started_with_julia.md \ No newline at end of file +docs/src/notebooks +Manifest.toml \ No newline at end of file diff --git a/docs/make.jl b/docs/make.jl index 7d3990b..abd1828 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -13,7 +13,7 @@ EditURL = "https://github.com/fverdugo/XM_40017/blob/main/docs/src/notebooks/SCR
  • - Download this notebook and run it locally on your machine [recommended]. Click here. + Download this notebook and run it locally on your machine [recommended]. Click here.
  • You can also run this notebook in the cloud using Binder. Click here @@ -25,7 +25,7 @@ EditURL = "https://github.com/fverdugo/XM_40017/blob/main/docs/src/notebooks/SCR ``` ```@raw html - + \n"; count = 1 ) - content = replace_colors(content) - open( html_name, "w" ) do html_file + open( html_filepath, "w" ) do html_file write( html_file, content ) end return nothing end -# Replace colors to match Documenter.jl -function replace_colors(content) - #content = replace( content, "--jp-layout-color0: #111111;" => "--jp-layout-color0: #1f2424;") - #content = replace(content, "--md-grey-900: #212121;" => "--md-grey-900: #282f2f;") - return content -end # Loop over notebooks and generate html and markdown -notebook_files = glob("*.ipynb", "docs/src/notebooks/") +notebook_files = glob("*.ipynb", "notebooks/") for filepath in notebook_files convert_embedded_img_to_base64(filepath) - create_md_nb_file(filepath) filename_with_ext = splitpath(filepath)[end] filename = splitext(filename_with_ext)[1] - convert_notebook_to_html(filepath, output_name = filename) - modify_notebook_html("docs/src/notebook-output/$(filename).html") + create_md_nb_file(filename) + convert_notebook_to_html("docs/src/notebooks/$filename_with_ext", output_name = filename) + modify_notebook_html("docs/src/notebook-html/$(filename).html") end makedocs(; @@ -122,12 +114,12 @@ makedocs(; canonical="https://fverdugo.github.io/XM_40017", edit_link="main",), pages=["Home" => "index.md","Getting started"=>"getting_started_with_julia.md", "Notebooks"=>[ - "Julia Basics" => "julia_basics.md", - "Tasks and channels" => "julia_async.md", - "Remote calls and remote channels" => "julia_distributed.md", - "Matrix Multiplication"=>"matrix_matrix.md", - "Jacobi" => "jacobi_method.md", - "Solutions" => "sol_matrix_matrix.md" + "Julia Basics" => "notebooks/julia_basics.md", + "Tasks and channels" => "notebooks/julia_async.md", + "Remote calls and remote channels" => "notebooks/julia_distributed.md", + "Matrix Multiplication"=>"notebooks/matrix_matrix.md", + "Jacobi" => "notebooks/jacobi_method.md", + "Solutions" => "notebooks/sol_matrix_matrix.md" ]], ) diff --git a/docs/src/getting_started_with_julia.md b/docs/src/getting_started_with_julia.md index f0886bc..48d52aa 100644 --- a/docs/src/getting_started_with_julia.md +++ b/docs/src/getting_started_with_julia.md @@ -1,4 +1,3 @@ - # Getting started @@ -381,4 +380,3 @@ We have learned the basics of how to work with Julia. If you want to further dig - [Package manager](https://pkgdocs.julialang.org/v1/getting-started/) - diff --git a/docs/src/notebook-output/Jacobi_2D.html b/docs/src/notebook-html/jacobi_2D.html similarity index 99% rename from docs/src/notebook-output/Jacobi_2D.html rename to docs/src/notebook-html/jacobi_2D.html index 6787d1f..0615cbc 100644 --- a/docs/src/notebook-output/Jacobi_2D.html +++ b/docs/src/notebook-html/jacobi_2D.html @@ -11321,7 +11321,7 @@ body.lm-mod-override-cursor .jp-IFrame:before { --md-grey-600: #757575; --md-grey-700: #616161; --md-grey-800: #424242; - --md-grey-900: #282f2f; + --md-grey-900: #212121; --md-blue-grey-50: #eceff1; --md-blue-grey-100: #cfd8dc; @@ -14582,9 +14582,7 @@ all of MD as it is not optimized for dense, information rich UIs. * https://material-components-web.appspot.com/elevation.html */ - /* The dark theme shadows need a bit of work, but this will probably also require work on the core layout - * colors used in the theme as well. */ - --jp-shadow-base-lightness: 32; + --jp-shadow-base-lightness: 0; --jp-shadow-umbra-color: rgba( var(--jp-shadow-base-lightness), var(--jp-shadow-base-lightness), @@ -14638,10 +14636,10 @@ all of MD as it is not optimized for dense, information rich UIs. */ --jp-border-width: 1px; - --jp-border-color0: var(--md-grey-700); - --jp-border-color1: var(--md-grey-700); - --jp-border-color2: var(--md-grey-800); - --jp-border-color3: var(--md-grey-900); + --jp-border-color0: var(--md-grey-400); + --jp-border-color1: var(--md-grey-400); + --jp-border-color2: var(--md-grey-300); + --jp-border-color3: var(--md-grey-200); --jp-inverse-border-color: var(--md-grey-600); --jp-border-radius: 2px; @@ -14670,20 +14668,20 @@ all of MD as it is not optimized for dense, information rich UIs. */ /* Defaults use Material Design specification */ - --jp-ui-font-color0: rgba(255, 255, 255, 1); - --jp-ui-font-color1: rgba(255, 255, 255, 0.87); - --jp-ui-font-color2: rgba(255, 255, 255, 0.54); - --jp-ui-font-color3: rgba(255, 255, 255, 0.38); + --jp-ui-font-color0: rgba(0, 0, 0, 1); + --jp-ui-font-color1: rgba(0, 0, 0, 0.87); + --jp-ui-font-color2: rgba(0, 0, 0, 0.54); + --jp-ui-font-color3: rgba(0, 0, 0, 0.38); /* * Use these against the brand/accent/warn/error colors. * These will typically go from light to darker, in both a dark and light theme. */ - --jp-ui-inverse-font-color0: rgba(0, 0, 0, 1); - --jp-ui-inverse-font-color1: rgba(0, 0, 0, 0.8); - --jp-ui-inverse-font-color2: rgba(0, 0, 0, 0.5); - --jp-ui-inverse-font-color3: rgba(0, 0, 0, 0.3); + --jp-ui-inverse-font-color0: rgba(255, 255, 255, 1); + --jp-ui-inverse-font-color1: rgba(255, 255, 255, 1); + --jp-ui-inverse-font-color2: rgba(255, 255, 255, 0.7); + --jp-ui-inverse-font-color3: rgba(255, 255, 255, 0.5); /* Content Fonts * @@ -14712,12 +14710,12 @@ all of MD as it is not optimized for dense, information rich UIs. --jp-content-heading-font-weight: 500; /* Defaults use Material Design specification */ - --jp-content-font-color0: rgba(255, 255, 255, 1); - --jp-content-font-color1: rgba(255, 255, 255, 1); - --jp-content-font-color2: rgba(255, 255, 255, 0.7); - --jp-content-font-color3: rgba(255, 255, 255, 0.5); + --jp-content-font-color0: rgba(0, 0, 0, 1); + --jp-content-font-color1: rgba(0, 0, 0, 0.87); + --jp-content-font-color2: rgba(0, 0, 0, 0.54); + --jp-content-font-color3: rgba(0, 0, 0, 0.38); - --jp-content-link-color: var(--md-blue-300); + --jp-content-link-color: var(--md-blue-700); --jp-content-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', @@ -14749,10 +14747,10 @@ all of MD as it is not optimized for dense, information rich UIs. * theme these would go from light to dark. */ - --jp-layout-color0: #1f2424; - --jp-layout-color1: var(--md-grey-900); - --jp-layout-color2: var(--md-grey-800); - --jp-layout-color3: var(--md-grey-700); + --jp-layout-color0: white; + --jp-layout-color1: white; + --jp-layout-color2: var(--md-grey-200); + --jp-layout-color3: var(--md-grey-400); --jp-layout-color4: var(--md-grey-600); /* Inverse Layout @@ -14761,44 +14759,44 @@ all of MD as it is not optimized for dense, information rich UIs. * theme these would go from dark to light. */ - --jp-inverse-layout-color0: white; - --jp-inverse-layout-color1: white; - --jp-inverse-layout-color2: var(--md-grey-200); - --jp-inverse-layout-color3: var(--md-grey-400); + --jp-inverse-layout-color0: #111111; + --jp-inverse-layout-color1: var(--md-grey-900); + --jp-inverse-layout-color2: var(--md-grey-800); + --jp-inverse-layout-color3: var(--md-grey-700); --jp-inverse-layout-color4: var(--md-grey-600); /* Brand/accent */ - --jp-brand-color0: var(--md-blue-700); - --jp-brand-color1: var(--md-blue-500); + --jp-brand-color0: var(--md-blue-900); + --jp-brand-color1: var(--md-blue-700); --jp-brand-color2: var(--md-blue-300); --jp-brand-color3: var(--md-blue-100); --jp-brand-color4: var(--md-blue-50); - --jp-accent-color0: var(--md-green-700); - --jp-accent-color1: var(--md-green-500); + --jp-accent-color0: var(--md-green-900); + --jp-accent-color1: var(--md-green-700); --jp-accent-color2: var(--md-green-300); --jp-accent-color3: var(--md-green-100); /* State colors (warn, error, success, info) */ - --jp-warn-color0: var(--md-orange-700); - --jp-warn-color1: var(--md-orange-500); + --jp-warn-color0: var(--md-orange-900); + --jp-warn-color1: var(--md-orange-700); --jp-warn-color2: var(--md-orange-300); --jp-warn-color3: var(--md-orange-100); - --jp-error-color0: var(--md-red-700); - --jp-error-color1: var(--md-red-500); + --jp-error-color0: var(--md-red-900); + --jp-error-color1: var(--md-red-700); --jp-error-color2: var(--md-red-300); --jp-error-color3: var(--md-red-100); - --jp-success-color0: var(--md-green-700); - --jp-success-color1: var(--md-green-500); + --jp-success-color0: var(--md-green-900); + --jp-success-color1: var(--md-green-700); --jp-success-color2: var(--md-green-300); --jp-success-color3: var(--md-green-100); - --jp-info-color0: var(--md-cyan-700); - --jp-info-color1: var(--md-cyan-500); + --jp-info-color0: var(--md-cyan-900); + --jp-info-color1: var(--md-cyan-700); --jp-info-color2: var(--md-cyan-300); --jp-info-color3: var(--md-cyan-100); @@ -14810,8 +14808,8 @@ all of MD as it is not optimized for dense, information rich UIs. --jp-cell-collapser-min-height: 20px; --jp-cell-collapser-not-active-hover-opacity: 0.6; - --jp-cell-editor-background: var(--jp-layout-color1); - --jp-cell-editor-border-color: var(--md-grey-700); + --jp-cell-editor-background: var(--md-grey-100); + --jp-cell-editor-border-color: var(--md-grey-300); --jp-cell-editor-box-shadow: inset 0 0 2px var(--md-blue-300); --jp-cell-editor-active-background: var(--jp-layout-color0); --jp-cell-editor-active-border-color: var(--jp-brand-color1); @@ -14820,9 +14818,8 @@ all of MD as it is not optimized for dense, information rich UIs. --jp-cell-prompt-font-family: var(--jp-code-font-family-default); --jp-cell-prompt-letter-spacing: 0px; --jp-cell-prompt-opacity: 1; - --jp-cell-prompt-not-active-opacity: 1; - --jp-cell-prompt-not-active-font-color: var(--md-grey-300); - + --jp-cell-prompt-not-active-opacity: 0.5; + --jp-cell-prompt-not-active-font-color: var(--md-grey-700); /* A custom blend of MD grey and blue 600 * See https://meyerweb.com/eric/tools/color-blend/#546E7A:1E88E5:5:hex */ --jp-cell-inprompt-font-color: #307fc1; @@ -14834,7 +14831,7 @@ all of MD as it is not optimized for dense, information rich UIs. --jp-notebook-padding: 10px; --jp-notebook-select-background: var(--jp-layout-color1); - --jp-notebook-multiselected-color: rgba(33, 150, 243, 0.24); + --jp-notebook-multiselected-color: var(--md-blue-50); /* The scroll padding is calculated to fill enough space at the bottom of the notebook to show one single-line cell (with appropriate padding) at the top @@ -14849,13 +14846,13 @@ all of MD as it is not optimized for dense, information rich UIs. /* Rendermime styles */ - --jp-rendermime-error-background: rgba(244, 67, 54, 0.28); - --jp-rendermime-table-row-background: var(--md-grey-900); - --jp-rendermime-table-row-hover-background: rgba(3, 169, 244, 0.2); + --jp-rendermime-error-background: #fdd; + --jp-rendermime-table-row-background: var(--md-grey-100); + --jp-rendermime-table-row-hover-background: var(--md-light-blue-50); /* Dialog specific styles */ - --jp-dialog-background: rgba(0, 0, 0, 0.6); + --jp-dialog-background: rgba(0, 0, 0, 0.25); /* Console specific styles */ @@ -14863,12 +14860,12 @@ all of MD as it is not optimized for dense, information rich UIs. /* Toolbar specific styles */ - --jp-toolbar-border-color: var(--jp-border-color2); + --jp-toolbar-border-color: var(--jp-border-color1); --jp-toolbar-micro-height: 8px; --jp-toolbar-background: var(--jp-layout-color1); - --jp-toolbar-box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.8); + --jp-toolbar-box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.24); --jp-toolbar-header-margin: 4px 4px 0px 4px; - --jp-toolbar-active-background: var(--jp-layout-color0); + --jp-toolbar-active-background: var(--md-grey-300); /* Statusbar specific styles */ @@ -14877,43 +14874,43 @@ all of MD as it is not optimized for dense, information rich UIs. /* Input field styles */ --jp-input-box-shadow: inset 0 0 2px var(--md-blue-300); - --jp-input-active-background: var(--jp-layout-color0); - --jp-input-hover-background: var(--jp-layout-color2); - --jp-input-background: var(--md-grey-800); + --jp-input-active-background: var(--jp-layout-color1); + --jp-input-hover-background: var(--jp-layout-color1); + --jp-input-background: var(--md-grey-100); --jp-input-border-color: var(--jp-inverse-border-color); --jp-input-active-border-color: var(--jp-brand-color1); --jp-input-active-box-shadow-color: rgba(19, 124, 189, 0.3); /* General editor styles */ - --jp-editor-selected-background: var(--jp-layout-color2); - --jp-editor-selected-focused-background: rgba(33, 150, 243, 0.24); + --jp-editor-selected-background: #d9d9d9; + --jp-editor-selected-focused-background: #d7d4f0; --jp-editor-cursor-color: var(--jp-ui-font-color0); /* Code mirror specific styles */ - --jp-mirror-editor-keyword-color: var(--md-green-500); - --jp-mirror-editor-atom-color: var(--md-blue-300); - --jp-mirror-editor-number-color: var(--md-green-400); - --jp-mirror-editor-def-color: var(--md-blue-600); - --jp-mirror-editor-variable-color: var(--md-grey-300); - --jp-mirror-editor-variable-2-color: var(--md-blue-400); - --jp-mirror-editor-variable-3-color: var(--md-green-600); - --jp-mirror-editor-punctuation-color: var(--md-blue-400); - --jp-mirror-editor-property-color: var(--md-blue-400); + --jp-mirror-editor-keyword-color: #008000; + --jp-mirror-editor-atom-color: #88f; + --jp-mirror-editor-number-color: #080; + --jp-mirror-editor-def-color: #00f; + --jp-mirror-editor-variable-color: var(--md-grey-900); + --jp-mirror-editor-variable-2-color: #05a; + --jp-mirror-editor-variable-3-color: #085; + --jp-mirror-editor-punctuation-color: #05a; + --jp-mirror-editor-property-color: #05a; --jp-mirror-editor-operator-color: #aa22ff; --jp-mirror-editor-comment-color: #408080; - --jp-mirror-editor-string-color: #ff7070; - --jp-mirror-editor-string-2-color: var(--md-purple-300); + --jp-mirror-editor-string-color: #ba2121; + --jp-mirror-editor-string-2-color: #708; --jp-mirror-editor-meta-color: #aa22ff; --jp-mirror-editor-qualifier-color: #555; - --jp-mirror-editor-builtin-color: var(--md-green-600); + --jp-mirror-editor-builtin-color: #008000; --jp-mirror-editor-bracket-color: #997; - --jp-mirror-editor-tag-color: var(--md-green-700); - --jp-mirror-editor-attribute-color: var(--md-blue-700); - --jp-mirror-editor-header-color: var(--md-blue-500); - --jp-mirror-editor-quote-color: var(--md-green-300); - --jp-mirror-editor-link-color: var(--md-blue-700); + --jp-mirror-editor-tag-color: #170; + --jp-mirror-editor-attribute-color: #00c; + --jp-mirror-editor-header-color: blue; + --jp-mirror-editor-quote-color: #090; + --jp-mirror-editor-link-color: #00c; --jp-mirror-editor-error-color: #f00; --jp-mirror-editor-hr-color: #999; @@ -14923,17 +14920,17 @@ all of MD as it is not optimized for dense, information rich UIs. and the icon of the user. */ - --jp-collaborator-color1: #ad4a00; - --jp-collaborator-color2: #7b6a00; - --jp-collaborator-color3: #007e00; - --jp-collaborator-color4: #008772; - --jp-collaborator-color5: #0079b9; - --jp-collaborator-color6: #8b45c6; - --jp-collaborator-color7: #be208b; + --jp-collaborator-color1: #ffad8e; + --jp-collaborator-color2: #dac83d; + --jp-collaborator-color3: #72dd76; + --jp-collaborator-color4: #00e4d0; + --jp-collaborator-color5: #45d4ff; + --jp-collaborator-color6: #e2b1ff; + --jp-collaborator-color7: #ff9de6; /* Vega extension styles */ - --jp-vega-background: var(--md-grey-400); + --jp-vega-background: white; /* Sidebar-related styles */ @@ -14941,30 +14938,16 @@ all of MD as it is not optimized for dense, information rich UIs. /* Search-related styles */ - --jp-search-toggle-off-opacity: 0.6; + --jp-search-toggle-off-opacity: 0.5; --jp-search-toggle-hover-opacity: 0.8; --jp-search-toggle-on-opacity: 1; - --jp-search-selected-match-background-color: rgb(255, 225, 0); + --jp-search-selected-match-background-color: rgb(245, 200, 0); --jp-search-selected-match-color: black; --jp-search-unselected-match-background-color: var( --jp-inverse-layout-color0 ); --jp-search-unselected-match-color: var(--jp-ui-inverse-font-color0); - /* scrollbar related styles. Supports every browser except Edge. */ - - /* colors based on JetBrain's Darcula theme */ - - --jp-scrollbar-background-color: #3f4244; - --jp-scrollbar-thumb-color: 88, 96, 97; /* need to specify thumb color as an RGB triplet */ - - --jp-scrollbar-endpad: 3px; /* the minimum gap between the thumb and the ends of a scrollbar */ - - /* hacks for setting the thumb shape. These do nothing in Firefox */ - - --jp-scrollbar-thumb-margin: 3.5px; /* the space in between the sides of the thumb and the track */ - --jp-scrollbar-thumb-radius: 9px; /* set to a large-ish value for rounded endcaps on the thumb */ - /* Icon colors that work well with light or dark backgrounds */ --jp-icon-contrast-color0: var(--md-purple-600); --jp-icon-contrast-color1: var(--md-green-600); @@ -14974,15 +14957,15 @@ all of MD as it is not optimized for dense, information rich UIs. /* File or activity icons and switch semantic variables */ --jp-jupyter-icon-color: #f37626; --jp-notebook-icon-color: #f37626; - --jp-json-icon-color: var(--md-orange-500); - --jp-console-icon-background-color: var(--md-blue-500); + --jp-json-icon-color: var(--md-orange-700); + --jp-console-icon-background-color: var(--md-blue-700); --jp-console-icon-color: white; - --jp-terminal-icon-background-color: var(--md-grey-200); - --jp-terminal-icon-color: var(--md-grey-800); - --jp-text-editor-icon-color: var(--md-grey-200); - --jp-inspector-icon-color: var(--md-grey-200); + --jp-terminal-icon-background-color: var(--md-grey-800); + --jp-terminal-icon-color: var(--md-grey-200); + --jp-text-editor-icon-color: var(--md-grey-700); + --jp-inspector-icon-color: var(--md-grey-700); --jp-switch-color: var(--md-grey-400); - --jp-switch-true-position-color: var(--md-orange-700); + --jp-switch-true-position-color: var(--md-orange-900); } @@ -15121,7 +15104,7 @@ body[data-format='mobile'] .jp-OutputArea-child .jp-OutputArea-output { init_mathjax(); - + - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -