Skip to content

Commit

Permalink
Merge branch 'doc' into PR-JupyterKernel
Browse files Browse the repository at this point in the history
  • Loading branch information
cindytsai committed Jan 10, 2024
2 parents 8cf99cd + d4d020c commit 4109caa
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,3 @@ We can press "Restart" button (:arrows_counterclockwise:) to reconnect to libyt
- The functionality is limited to taking Python inputs and printing outputs from all the MPI processes only. `libyt` hasn't done implementing Jupyter's full feature, like data streaming, supporting `ipwidgets` yet.
- See [Limitations in MPI Related Python Tasks]({% link InSituPythonAnalysis/Limitations.md %}#limitations-in-mpi-related-python-tasks).

## FAQs
2 changes: 1 addition & 1 deletion doc/InSituPythonAnalysis/UsingYT.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ nav_order: 2
---

## Requirements
- Python package [`yt`](https://yt-project.org/) and [`yt_libyt`](https://github.com/data-exp-lab/yt_libyt).
- Python package [`yt`](https://yt-project.org/) and [`yt_libyt`]({% link HowToInstall.md %}#yt_libyt).

## Use yt for In Situ Python Analysis under Parallel Computation
`libyt` directly borrows parallel computation feature in `yt` using `mpi4py`. You can also refer to [**Parallel Computation With yt**](https://yt-project.org/doc/analyzing/parallel_computation.html#parallel-computation-with-yt).
Expand Down
4 changes: 3 additions & 1 deletion doc/libytAPI/ActivateJupyterKernel.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ int yt_run_JupyterKernel(const char* flag_file_name, bool use_connection_file);
> :information_source: The API only launches a Jupyter kernel that exposes simulation data. For how to connect to the kernel, please go to [Jupyter Notebook Access]({% link InSituPythonAnalysis/JupyterNotebookAccess/JupyterNotebook.md %}#jupyter-notebook-access).
## Connection File
The connection file name must be `libyt_kernel_connection.json`. This is the same connection file used in Jupyter but with different file name. `libyt` use this connection file to bind to ports and construct kernel.
The connection file name must be `libyt_kernel_connection.json`. This is the same connection file used in Jupyter but with different file name.
(Please refer to [Jupyter Client -- Connection files](https://jupyter-client.readthedocs.io/en/stable/kernels.html#connection-files))
`libyt` use this connection file to bind to ports and construct kernel.
For example:
```json
Expand Down
27 changes: 12 additions & 15 deletions doc/libytAPI/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,16 @@ has_toc: false
---

# libyt API
{: .no_toc }
<details open markdown="block">
<summary>
Table of contents
</summary>
{: .text-delta }
- TOC
{:toc}
</details>
---

## Procedure
It can break down into three stages, initialization, loading simulation data into Python and do in situ analysis during the iterative process in simulation,
and finalization.
It can break down into five stages:
- initialization,
- loading simulation data into Python[^1],
- do in situ analysis,
- reset,
- and finalization.

Currently, `libyt` only supports loading simulation data with adaptive mesh refinement grid structure (AMR grid) to Python.[^1]
## libyt API

<table>
<thead>
Expand All @@ -40,7 +34,7 @@ Currently, `libyt` only supports loading simulation data with adaptive mesh refi
<td>Initialize embedded Python and import inline Python script.</td>
</tr>
<tr>
<td rowspan=6><strong>Iteration</strong></td>
<td rowspan=3><strong>Loading data</strong></td>
<td><code>yt_set_Parameters</code>, <code>yt_set_UserParameter*</code></td>
<td>Set yt parameters and user specific parameters.</td>
</tr>
Expand All @@ -53,6 +47,7 @@ Currently, `libyt` only supports loading simulation data with adaptive mesh refi
<td>Tell libyt you're done.</td>
</tr>
<tr>
<td rowspan=3><strong>In situ analysis</strong></td>
<td><code>yt_run_Function</code>, <code>yt_run_FunctionArguments</code></td>
<td>Run Python functions.</td>
</tr>
Expand All @@ -65,6 +60,7 @@ Currently, `libyt` only supports loading simulation data with adaptive mesh refi
<td>Activate interactive prompt. This is only available in Jupyter kernel mode.</td>
</tr>
<tr>
<td rowspan=1><strong>Reset</strong></td>
<td><code>yt_free</code></td>
<td>Free resources for in situ analysis.</td>
</tr>
Expand All @@ -78,6 +74,7 @@ Currently, `libyt` only supports loading simulation data with adaptive mesh refi


----
[^1]: :lizard: Even though we can still activate Python prompt and run in situ Python script with no data loaded ahead in non-AMR grid simulation with just `yt_initialize`, `yt_run_Function`, `yt_run_FunctionArguments`, `yt_run_InteractiveMode`, and `yt_finalize`. We are trying to make `libyt` works with more data structure.
[^1]: :lizard: Currently, `libyt` only supports loading simulation data with adaptive mesh refinement grid structure (AMR grid) to Python. We are trying to make `libyt` works with more data structure.



0 comments on commit 4109caa

Please sign in to comment.