Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
lan13005 committed Nov 6, 2023
1 parent 5ce1c7a commit d85bb89
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 153 deletions.
6 changes: 3 additions & 3 deletions _modules/atiSetup.html
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ <h1>Source code for atiSetup</h1><div class="highlight"><pre>
<span class="k">return</span> <span class="n">USE_MPI</span><span class="p">,</span> <span class="n">USE_GPU</span><span class="p">,</span> <span class="n">RANK_MPI</span></div>

<div class="viewcode-block" id="loadLibraries"><a class="viewcode-back" href="../api/atiSetup.html#atiSetup.loadLibraries">[docs]</a><span class="k">def</span> <span class="nf">loadLibraries</span><span class="p">(</span><span class="n">accelerator</span><span class="p">,</span> <span class="n">use_fsroot</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">use_genamp</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&#39;&#39;&#39; Load all libraries and print IS_REQUESTED &#39;&#39;&#39;</span>
<span class="w"> </span><span class="sd">&#39;&#39;&#39; Load all libraries &#39;&#39;&#39;</span>
<span class="n">USE_MPI</span><span class="p">,</span> <span class="n">USE_GPU</span><span class="p">,</span> <span class="n">RANK_MPI</span> <span class="o">=</span> <span class="n">prepare_mpigpu</span><span class="p">(</span><span class="n">accelerator</span><span class="p">)</span>
<span class="n">SUFFIX</span> <span class="o">=</span> <span class="s2">&quot;_GPU&quot;</span> <span class="k">if</span> <span class="n">USE_GPU</span> <span class="k">else</span> <span class="s2">&quot;&quot;</span>
<span class="n">SUFFIX</span> <span class="o">+=</span> <span class="s2">&quot;_MPI&quot;</span> <span class="k">if</span> <span class="n">USE_MPI</span> <span class="k">else</span> <span class="s2">&quot;&quot;</span>
Expand Down Expand Up @@ -463,8 +463,8 @@ <h1>Source code for atiSetup</h1><div class="highlight"><pre>

<div class="viewcode-block" id="prepare_mpigpu"><a class="viewcode-back" href="../api/atiSetup.html#atiSetup.prepare_mpigpu">[docs]</a><span class="k">def</span> <span class="nf">prepare_mpigpu</span><span class="p">(</span><span class="n">accelerator</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> Sets variables to use MPI and/or GPU if requested.</span>
<span class="sd"> Check who called python. If bash (single process). If mpiexec/mpirun (then MPI)</span>
<span class="sd"> Sets environment variables to use MPI and/or GPU if requested.</span>
<span class="sd"> Checks who called the python script. If bash (single process). If mpiexec/mpirun (then MPI)</span>

<span class="sd"> Args:</span>
<span class="sd"> accelerator (str): accelerator flag from argparse ~ [&#39;cpu&#39;, &#39;mpi&#39;, &#39;gpu&#39;, &#39;mpigpu&#39;, &#39;gpumpi&#39;]</span>
Expand Down
109 changes: 6 additions & 103 deletions _sources/notebooks/libraryLoading.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,9 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Welcome to JupyROOT 6.28/06\n"
]
}
],
"outputs": [],
"source": [
"import os\n",
"import atiSetup\n",
Expand All @@ -42,35 +34,9 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"atiSetup| jupyter-lab called python3.9\n",
"\n",
"------------------------------------------------\n",
"atiSetup| MPI is disabled\n",
"atiSetup| GPU is disabled\n",
"------------------------------------------------\n",
"\n",
"\n",
"atiSetup| Loading library libAmpTools.so .............. ON\n",
"atiSetup| Loading library libAmpPlotter.so ............ ON\n",
"atiSetup| Loading library libAmpsDataIO.so ............ ON\n",
"atiSetup| Loading library libFSRoot.so ................ OFF\n",
"atiSetup| Loading library libAmpsGen.so ............... OFF\n",
"\n",
"\n",
"------------------------------------------------\n",
"------------------------------------------------\n",
"\n",
"Initializing AMPTOOLS_AMPS_DATAIO for PyROOT...\n"
]
}
],
"outputs": [],
"source": [
"############## SET ENVIRONMENT VARIABLES ##############\n",
"USE_MPI, USE_GPU, RANK_MPI = atiSetup.setup(globals()) # RANK_MPI defaults to 0 even if not using MPI"
Expand All @@ -85,60 +51,9 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"atiSetup| jupyter-lab called python3.9\n",
"\n",
"------------------------------------------------\n",
"atiSetup| MPI is disabled\n",
"atiSetup| GPU is disabled\n",
"------------------------------------------------\n",
"\n",
"\n",
"atiSetup| Loading library libAmpTools.so .............. ON\n",
"atiSetup| Loading library libAmpPlotter.so ............ ON\n",
"atiSetup| Loading library libAmpsDataIO.so ............ ON\n",
"atiSetup| Loading library libFSRoot.so ................ ON\n",
"atiSetup| Loading library libAmpsGen.so ............... ON\n",
"\n",
"\n",
"------------------------------------------------\n"
]
},
{
"ename": "AttributeError",
"evalue": "Failed to get attribute initialize_fsroot from ROOT",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m/home/lng/WORK/WORK/PyAmpTools/docs/notebooks/libraryLoading.ipynb Cell 7\u001b[0m line \u001b[0;36m2\n\u001b[1;32m <a href='vscode-notebook-cell://ssh-remote%2Bifarm/home/lng/WORK/WORK/PyAmpTools/docs/notebooks/libraryLoading.ipynb#W6sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0'>1</a>\u001b[0m \u001b[39m############## SET ENVIRONMENT VARIABLES ##############\u001b[39;00m\n\u001b[0;32m----> <a href='vscode-notebook-cell://ssh-remote%2Bifarm/home/lng/WORK/WORK/PyAmpTools/docs/notebooks/libraryLoading.ipynb#W6sdnNjb2RlLXJlbW90ZQ%3D%3D?line=1'>2</a>\u001b[0m USE_MPI, USE_GPU, RANK_MPI \u001b[39m=\u001b[39m atiSetup\u001b[39m.\u001b[39;49msetup(\u001b[39mglobals\u001b[39;49m(), use_fsroot\u001b[39m=\u001b[39;49m\u001b[39mTrue\u001b[39;49;00m, use_genamp\u001b[39m=\u001b[39;49m\u001b[39mTrue\u001b[39;49;00m) \u001b[39m# RANK_MPI defaults to 0 even if not using MPI\u001b[39;00m\n",
"File \u001b[0;32m/w/halld-scshelf2101/lng/Mambaforge/envs/PyAmpTools/lib/python3.9/site-packages/atiSetup.py:26\u001b[0m, in \u001b[0;36msetup\u001b[0;34m(calling_globals, accelerator, use_fsroot, use_genamp)\u001b[0m\n\u001b[1;32m 16\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39msetup\u001b[39m(calling_globals, accelerator\u001b[39m=\u001b[39m\u001b[39m'\u001b[39m\u001b[39mmpigpu\u001b[39m\u001b[39m'\u001b[39m, use_fsroot\u001b[39m=\u001b[39m\u001b[39mFalse\u001b[39;00m, use_genamp\u001b[39m=\u001b[39m\u001b[39mFalse\u001b[39;00m):\n\u001b[1;32m 17\u001b[0m \u001b[39m \u001b[39m\u001b[39m'''\u001b[39;00m\n\u001b[1;32m 18\u001b[0m \u001b[39m Performs basic setup, loading libraries and setting aliases\u001b[39;00m\n\u001b[1;32m 19\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 24\u001b[0m \u001b[39m use_genamp (bool): True if GenAmp library should be loaded\u001b[39;00m\n\u001b[1;32m 25\u001b[0m \u001b[39m '''\u001b[39;00m\n\u001b[0;32m---> 26\u001b[0m USE_MPI, USE_GPU, RANK_MPI \u001b[39m=\u001b[39m loadLibraries(accelerator, use_fsroot, use_genamp)\n\u001b[1;32m 27\u001b[0m set_aliases(calling_globals, USE_MPI)\n\u001b[1;32m 29\u001b[0m \u001b[39mreturn\u001b[39;00m USE_MPI, USE_GPU, RANK_MPI\n",
"File \u001b[0;32m/w/halld-scshelf2101/lng/Mambaforge/envs/PyAmpTools/lib/python3.9/site-packages/atiSetup.py:55\u001b[0m, in \u001b[0;36mloadLibraries\u001b[0;34m(accelerator, use_fsroot, use_genamp)\u001b[0m\n\u001b[1;32m 53\u001b[0m \u001b[39mif\u001b[39;00m RANK_MPI \u001b[39m==\u001b[39m \u001b[39m0\u001b[39m: \u001b[39mprint\u001b[39m(\u001b[39m\"\u001b[39m\u001b[39m\\n\u001b[39;00m\u001b[39m\\n\u001b[39;00m\u001b[39m------------------------------------------------\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[1;32m 54\u001b[0m ROOT\u001b[39m.\u001b[39minitialize( RANK_MPI \u001b[39m==\u001b[39m \u001b[39m0\u001b[39m )\n\u001b[0;32m---> 55\u001b[0m \u001b[39mif\u001b[39;00m use_fsroot: ROOT\u001b[39m.\u001b[39;49minitialize_fsroot( RANK_MPI \u001b[39m==\u001b[39m \u001b[39m0\u001b[39m )\n\u001b[1;32m 56\u001b[0m \u001b[39mif\u001b[39;00m RANK_MPI \u001b[39m==\u001b[39m \u001b[39m0\u001b[39m: \u001b[39mprint\u001b[39m(\u001b[39m\"\u001b[39m\u001b[39m------------------------------------------------\u001b[39m\u001b[39m\\n\u001b[39;00m\u001b[39m\"\u001b[39m)\n\u001b[1;32m 58\u001b[0m \u001b[39mreturn\u001b[39;00m USE_MPI, USE_GPU, RANK_MPI\n",
"File \u001b[0;32m/w/halld-scshelf2101/lng/WORK/PyAmpTools/root/root-6.28.06-gcc9.3.0/lib/ROOT/_facade.py:196\u001b[0m, in \u001b[0;36mROOTFacade._fallback_getattr\u001b[0;34m(self, name)\u001b[0m\n\u001b[1;32m 194\u001b[0m \u001b[39mif\u001b[39;00m res:\n\u001b[1;32m 195\u001b[0m \u001b[39mreturn\u001b[39;00m res\n\u001b[0;32m--> 196\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mAttributeError\u001b[39;00m(\u001b[39m\"\u001b[39m\u001b[39mFailed to get attribute \u001b[39m\u001b[39m{}\u001b[39;00m\u001b[39m from ROOT\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m.\u001b[39mformat(name))\n",
"\u001b[0;31mAttributeError\u001b[0m: Failed to get attribute initialize_fsroot from ROOT"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Initializing AMPTOOLS_AMPS_DATAIO for PyROOT...\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"cling::DynamicLibraryManager::loadLibrary(): /w/halld-scshelf2101/lng/WORK/PyAmpTools/external/FSRoot/lib/libFSRoot.so: undefined symbol: _ZTI17IncPiPiHistograms\n"
]
}
],
"outputs": [],
"source": [
"############## SET ENVIRONMENT VARIABLES ##############\n",
"USE_MPI, USE_GPU, RANK_MPI = atiSetup.setup(globals(), use_fsroot=True, use_genamp=True) # RANK_MPI defaults to 0 even if not using MPI"
Expand Down Expand Up @@ -182,18 +97,6 @@
"display_name": "PyAmpTools",
"language": "python",
"name": "pyamptools"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion _sources/notebooks/mcmc.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We also have to define the *Posterior distribution*. In practice this means we have to define the *likelihood* (which is taken from `AmpTools`) and a *prior* distribution. For now, we will ignore the *prior* and run the `emcee` sampler for the *likelihood* distribution. The definition of the log posterior probability used in this tutorial is shown below."
"We also have to define the *Posterior distribution*. In practice this means we have to define the *likelihood* (which is taken from `AmpTools`) and a *prior* distribution. For now, we will ignore the *prior* and run the `emcee` sampler for the *likelihood* distribution. The definition of the log posterior probability used in this tutorial is shown below. A `mcmcManager` class is used to store the probability distributions' definitions, perform the sampling, and drawing the corner plot. We will initialize this manager in a little bit."
]
},
{
Expand Down
8 changes: 5 additions & 3 deletions api/atiSetup.html
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ <h1>atiSetup</h1>
<dl class="py function">
<dt class="sig sig-object py" id="atiSetup.loadLibraries">
<span class="sig-name descname"><span class="pre">loadLibraries</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">accelerator</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">use_fsroot</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">use_genamp</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/atiSetup.html#loadLibraries"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#atiSetup.loadLibraries" title="Permalink to this definition">#</a></dt>
<dd><p>Load all libraries and print IS_REQUESTED</p>
<dd><p>Load all libraries</p>
</dd></dl>

<dl class="py function">
Expand All @@ -398,8 +398,10 @@ <h1>atiSetup</h1>
<dl class="py function">
<dt class="sig sig-object py" id="atiSetup.prepare_mpigpu">
<span class="sig-name descname"><span class="pre">prepare_mpigpu</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">accelerator</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/atiSetup.html#prepare_mpigpu"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#atiSetup.prepare_mpigpu" title="Permalink to this definition">#</a></dt>
<dd><p>Sets variables to use MPI and/or GPU if requested.
Check who called python. If bash (single process). If mpiexec/mpirun (then MPI)</p>
<dd><dl class="simple">
<dt>Sets environment variables to use MPI and/or GPU if requested.</dt><dd><p>Checks who called the python script. If bash (single process). If mpiexec/mpirun (then MPI)</p>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>accelerator</strong> (<em>str</em>) – accelerator flag from argparse ~ [‘cpu’, ‘mpi’, ‘gpu’, ‘mpigpu’, ‘gpumpi’]</p>
Expand Down
Loading

0 comments on commit d85bb89

Please sign in to comment.