Skip to content

Commit

Permalink
Remove tutorials category from documentation (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
ytdHuang authored Jan 11, 2025
2 parents 6085242 + 52950ae commit 6716a52
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 220 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ and [Y.-T. Huang](https://github.com/ytdHuang).
- **Quantum State and Operator Manipulation:** Easily handle quantum states and operators with a rich set of tools, with the same functionalities as `QuTiP`.
- **Dynamical Evolution:** Advanced solvers for time evolution of quantum systems, thanks to the powerful [`DifferentialEquations.jl`](https://github.com/SciML/DifferentialEquations.jl) package.
- **GPU Computing:** Leverage GPU resources for high-performance computing. Simulate quantum dynamics directly on the GPU with the same syntax as the CPU case.
- **Distributed Computing:** Distribute the computation over multiple nodes (e.g., a cluster). For example, you can run hundreds of quantum trajectories in parallel on a cluster, with, again, the same syntax as the simple case. See [this tutorial](https://qutip.org/QuantumToolbox.jl/stable/tutorials/cluster) for more information.
- **Distributed Computing:** Distribute the computation over multiple nodes (e.g., a cluster). For example, you can run hundreds of quantum trajectories in parallel on a cluster, with, again, the same syntax as the simple case. See [here](https://qutip.org/QuantumToolbox.jl/stable/users_guide/cluster) for more information.
- **Easy Extension:** Easily extend the package, taking advantage of the `Julia` language features, like multiple dispatch and metaprogramming.

## Installation
Expand Down
11 changes: 2 additions & 9 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const PAGES = [
"Brief Example" => "getting_started/brief_example.md",
"Key differences from QuTiP" => "getting_started/qutip_differences.md",
"The Importance of Type-Stability" => "getting_started/type_stability.md",
"Example: Create QuantumToolbox.jl Logo" => "getting_started/logo.md",
# "Cite QuantumToolbox.jl" => "getting_started/cite.md",
],
"Users Guide" => [
Expand All @@ -54,6 +55,7 @@ const PAGES = [
"Stochastic Solver" => "users_guide/time_evolution/stochastic.md",
"Solving Problems with Time-dependent Hamiltonians" => "users_guide/time_evolution/time_dependent.md",
],
"Intensive parallelization on a Cluster" => "users_guide/cluster.md",
"Hierarchical Equations of Motion" => "users_guide/HEOM.md",
"Solving for Steady-State Solutions" => "users_guide/steadystate.md",
"Two-time correlation functions" => "users_guide/two_time_corr_func.md",
Expand All @@ -62,15 +64,6 @@ const PAGES = [
"users_guide/extensions/cairomakie.md",
],
],
"Tutorials" => [
"Time Evolution" => [
"Low Rank Master Equation" => "tutorials/lowrank.md",
],
"Miscellaneous Tutorials" => [
"tutorials/logo.md",
"tutorials/cluster.md",
],
],
"Resources" => [
"API" => "resources/api.md",
"Bibliography" => "resources/bibliography.md",
Expand Down
1 change: 1 addition & 0 deletions docs/src/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const navTemp = {

const nav = [
...navTemp.nav,
{ text: 'Tutorials', link: 'https://qutip.org/qutip-julia-tutorials/' },
{ text: 'Benchmarks', link: 'https://qutip.org/QuantumToolbox.jl/benchmarks/' },
{
component: 'VersionPicker'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# [Create QuantumToolbox.jl logo](@id doc-tutor:Create-QuantumToolbox.jl-logo)
# [Example: Create QuantumToolbox.jl logo](@id doc:Create-QuantumToolbox.jl-logo)

## Introduction

In this tutorial, we will demonstrate how to create the logo for the **QuantumToolbox.jl** package. The logo represents the Wigner function of the triangular cat state, which is a linear superposition of three coherent states. The resulting Wigner function has a triangular shape that resembles the Julia logo. We will also define a custom colormap that varies based on the value of the Wigner function and the spatial coordinates, such that the three blobs corresponding to the coherent states have different colors (matching the colors of the Julia logo).
In this example, we will demonstrate how to create the logo for the **QuantumToolbox.jl** package. The logo represents the Wigner function of the triangular cat state, which is a linear superposition of three coherent states. The resulting Wigner function has a triangular shape that resembles the Julia logo. We will also define a custom colormap that varies based on the value of the Wigner function and the spatial coordinates, such that the three blobs corresponding to the coherent states have different colors (matching the colors of the Julia logo).

### Triangular Cat State

Expand Down Expand Up @@ -196,4 +196,4 @@ fig

## Conclusion

This tutorial demonstrates how to generate the [QuantumToolbox.jl](https://github.com/qutip/QuantumToolbox.jl) logo using the package itself and [Makie.jl](https://github.com/MakieOrg/Makie.jl) for visualization. The logo is a visualization of the Wigner function of a triangular cat state, with a custom colormap that highlights the different coherent states with colors matching the Julia logo.
This example demonstrates how to generate the [QuantumToolbox.jl](https://github.com/qutip/QuantumToolbox.jl) logo using the package itself and [Makie.jl](https://github.com/MakieOrg/Makie.jl) for visualization. The logo is a visualization of the Wigner function of a triangular cat state, with a custom colormap that highlights the different coherent states with colors matching the Julia logo.
9 changes: 6 additions & 3 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@ hero:
text: Users Guide
link: /users_guide/QuantumObject/QuantumObject
- theme: alt
text: View on Github
link: https://github.com/qutip/QuantumToolbox.jl
text: Tutorials
link: https://qutip.org/qutip-julia-tutorials/
- theme: alt
text: API
link: /resources/api
- theme: alt
text: View on Github
link: https://github.com/qutip/QuantumToolbox.jl
- theme: alt
text: Visit QuTiP.org
link: https://qutip.org/
Expand All @@ -39,7 +42,7 @@ features:
- icon: <img width="64" height="64" src="https://img.icons8.com/?size=100&id=1W4Bkj363ov0&format=png&color=000000" />
title: Distributed Computing
details: Distribute the computation over multiple nodes (e.g., a cluster). Simulate hundreds of quantum trajectories in parallel on a cluster, with, again, the same syntax as the simple case.
link: /tutorials/cluster
link: /users_guide/cluster
---
```

Expand Down
177 changes: 0 additions & 177 deletions docs/src/tutorials/lowrank.md

This file was deleted.

62 changes: 35 additions & 27 deletions docs/src/tutorials/cluster.md → docs/src/users_guide/cluster.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,16 @@
# [Intensive parallelization on a Cluster](@id doc-tutor:Intensive-parallelization-on-a-Cluster)
# [Intensive parallelization on a Cluster](@id doc:Intensive-parallelization-on-a-Cluster)

## Introduction

In this tutorial, we will demonstrate how to seamlessly perform intensive parallelization on a cluster using the **QuantumToolbox.jl** package. Indeed, thanks to the [**Distributed.jl**](https://docs.julialang.org/en/v1/manual/distributed-computing/) and [**ClusterManagers.jl**](https://github.com/JuliaParallel/ClusterManagers.jl) packages, it is possible to parallelize on a cluster with minimal effort. The following examples are applied to a cluster with the [SLURM](https://slurm.schedmd.com/documentation.html) workload manager, but the same principles can be applied to other workload managers, as the [**ClusterManagers.jl**](https://github.com/JuliaParallel/ClusterManagers.jl) package is very versatile.
In this example, we will demonstrate how to seamlessly perform intensive parallelization on a cluster using the **QuantumToolbox.jl** package. Indeed, thanks to the [**Distributed.jl**](https://docs.julialang.org/en/v1/manual/distributed-computing/) and [**ClusterManagers.jl**](https://github.com/JuliaParallel/ClusterManagers.jl) packages, it is possible to parallelize on a cluster with minimal effort. The following examples are applied to a cluster with the [SLURM](https://slurm.schedmd.com/documentation.html) workload manager, but the same principles can be applied to other workload managers, as the [**ClusterManagers.jl**](https://github.com/JuliaParallel/ClusterManagers.jl) package is very versatile.

We will consider two examples:
## SLURM batch script

1. **Parallelization of a Monte Carlo quantum trajectories**
2. **Parallelization of a Master Equation by sweeping over parameters**

### Monte Carlo Quantum Trajectories

Let's consider a 2-dimensional transverse field Ising model with 4x3 spins. The Hamiltonian is given by

```math
\hat{H} = \frac{J_z}{2} \sum_{\langle i,j \rangle} \hat{\sigma}_i^z \hat{\sigma}_j^z + h_x \sum_i \hat{\sigma}_i^x \, ,
```

where the sums are over nearest neighbors, and the collapse operators are given by

```math
\hat{c}_i = \sqrt{\gamma} \hat{\sigma}_i^- \, .
```

We start by creating a file named `run.batch` with the following content:
To submit a batch script to [SLURM](https://slurm.schedmd.com/documentation.html), we start by creating a file named `run.batch` with the following content:

```bash
#!/bin/bash
#SBATCH --job-name=tutorial
#SBATCH --job-name=example
#SBATCH --output=output.out
#SBATCH --account=your_account
#SBATCH --nodes=10
Expand All @@ -44,9 +27,34 @@ export PATH=/home/username/.juliaup/bin:$PATH
julia --project script.jl
```

where we have to replace `your_account` with the name of your account. This script will be used to submit the job to the cluster. Here, we are requesting 10 nodes with 72 threads each (720 parallel jobs). The `--time` flag specifies the maximum time that the job can run. To see all the available options, you can check the [SLURM documentation](https://slurm.schedmd.com/documentation.html). We also export the path to the custom Julia installation, which is necessary to run the script (replace `username` with your username). Finally, we run the script `script.jl` with the command `julia --project script.jl`.
where we have to replace `your_account` with the name of your account. This script will be used to submit the job to the cluster by using the following command in terminal:

```shell
sbatch run.batch
```

Here, we are requesting `10` nodes with `72` threads each (`720` parallel jobs). The `--time` flag specifies the maximum time that the job can run. To see all the available options, you can check the [SLURM documentation](https://slurm.schedmd.com/documentation.html). We also export the path to the custom Julia installation, which is necessary to run the script (replace `username` with your username). Finally, we run the script `script.jl` with the command `julia --project script.jl`.

In the following, we will consider two examples:

1. **Parallelization of a Monte Carlo quantum trajectories**
2. **Parallelization of a Master Equation by sweeping over parameters**

## Monte Carlo Quantum Trajectories

Let's consider a `2`-dimensional transverse field Ising model with `4x3` spins. The Hamiltonian is given by

```math
\hat{H} = \frac{J_z}{2} \sum_{\langle i,j \rangle} \hat{\sigma}_i^z \hat{\sigma}_j^z + h_x \sum_i \hat{\sigma}_i^x \, ,
```

where the sums are over nearest neighbors, and the collapse operators are given by

```math
\hat{c}_i = \sqrt{\gamma} \hat{\sigma}_i^- \, .
```

The `script.jl` contains the following content:
In this case, the `script.jl` contains the following content:

```julia
using Distributed
Expand Down Expand Up @@ -121,7 +129,7 @@ With the
println("Hello! You have $(nworkers()) workers with $(remotecall_fetch(Threads.nthreads, 2)) threads each.")
```

command, we test that the distributed network is correctly initialized. The `remotecall_fetch(Threads.nthreads, 2)` command returns the number of threads of the worker with ID 2.
command, we test that the distributed network is correctly initialized. The `remotecall_fetch(Threads.nthreads, 2)` command returns the number of threads of the worker with ID `2`.

We then write the main part of the script, where we define the lattice through the [`Lattice`](@ref) function. We set the parameters and define the Hamiltonian and collapse operators with the [`DissipativeIsing`](@ref) function. We also define the expectation operators `e_ops` and the initial state `ψ0`. Finally, we perform the Monte Carlo quantum trajectories with the [`mcsolve`](@ref) function. The `ensemble_method=EnsembleSplitThreads()` argument is used to parallelize the Monte Carlo quantum trajectories, by splitting the ensemble of trajectories among the workers. For a more detailed explanation of the different ensemble methods, you can check the [official documentation](https://docs.sciml.ai/DiffEqDocs/stable/features/ensemble/) of the [**DifferentialEquations.jl**](https://github.com/SciML/DifferentialEquations.jl/) package. Finally, the `rmprocs(workers())` command is used to remove the workers after the computation is finished.

Expand All @@ -140,7 +148,7 @@ FINISH!

where we can see that the computation **lasted only 21 seconds**.

### Master Equation by Sweeping Over Parameters
## Master Equation by Sweeping Over Parameters

In this example, we will consider a driven Jaynes-Cummings model, describing a two-level atom interacting with a driven cavity mode. The Hamiltonian is given by

Expand All @@ -154,7 +162,7 @@ and the collapse operators are given by
\hat{c}_1 = \sqrt{\gamma} \hat{a} \, , \quad \hat{c}_2 = \sqrt{\gamma} \hat{\sigma}_- \, .
```

The SLURM file is the same as before, but the `script.jl` file now contains the following content:
The SLURM batch script file is the same as before, but the `script.jl` file now contains the following content:

```julia
using Distributed
Expand Down

0 comments on commit 6716a52

Please sign in to comment.