From d85bb89fbacc700cac5522c9d3406303e0e62219 Mon Sep 17 00:00:00 2001 From: lan13005 Date: Sun, 5 Nov 2023 19:18:42 -0500 Subject: [PATCH] Update documentation --- _modules/atiSetup.html | 6 +- _sources/notebooks/libraryLoading.ipynb | 109 ++---------------------- _sources/notebooks/mcmc.ipynb | 2 +- api/atiSetup.html | 8 +- notebooks/libraryLoading.html | 41 +-------- notebooks/mcmc.html | 12 +-- searchindex.js | 2 +- 7 files changed, 27 insertions(+), 153 deletions(-) diff --git a/_modules/atiSetup.html b/_modules/atiSetup.html index 6b9f997..58ac783 100644 --- a/_modules/atiSetup.html +++ b/_modules/atiSetup.html @@ -362,7 +362,7 @@

Source code for atiSetup

     return USE_MPI, USE_GPU, RANK_MPI
[docs]def loadLibraries(accelerator, use_fsroot=False, use_genamp=False): - ''' Load all libraries and print IS_REQUESTED ''' + ''' Load all libraries ''' USE_MPI, USE_GPU, RANK_MPI = prepare_mpigpu(accelerator) SUFFIX = "_GPU" if USE_GPU else "" SUFFIX += "_MPI" if USE_MPI else "" @@ -463,8 +463,8 @@

Source code for atiSetup

 
 
[docs]def prepare_mpigpu(accelerator): ''' - Sets variables to use MPI and/or GPU if requested. - Check who called python. If bash (single process). If mpiexec/mpirun (then MPI) + Sets environment variables to use MPI and/or GPU if requested. + Checks who called the python script. If bash (single process). If mpiexec/mpirun (then MPI) Args: accelerator (str): accelerator flag from argparse ~ ['cpu', 'mpi', 'gpu', 'mpigpu', 'gpumpi'] diff --git a/_sources/notebooks/libraryLoading.ipynb b/_sources/notebooks/libraryLoading.ipynb index 4f440d4..59ec5e1 100644 --- a/_sources/notebooks/libraryLoading.ipynb +++ b/_sources/notebooks/libraryLoading.ipynb @@ -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", @@ -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" @@ -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 1\u001b[0m \u001b[39m############## SET ENVIRONMENT VARIABLES ##############\u001b[39;00m\n\u001b[0;32m----> 2\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" @@ -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, diff --git a/_sources/notebooks/mcmc.ipynb b/_sources/notebooks/mcmc.ipynb index 34f7c4d..085c34c 100644 --- a/_sources/notebooks/mcmc.ipynb +++ b/_sources/notebooks/mcmc.ipynb @@ -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." ] }, { diff --git a/api/atiSetup.html b/api/atiSetup.html index 4fcf875..b545cf8 100644 --- a/api/atiSetup.html +++ b/api/atiSetup.html @@ -386,7 +386,7 @@

atiSetup

loadLibraries(accelerator, use_fsroot=False, use_genamp=False)[source]#
-

Load all libraries and print IS_REQUESTED

+

Load all libraries

@@ -398,8 +398,10 @@

atiSetup

prepare_mpigpu(accelerator)[source]#
-

Sets variables to use MPI and/or GPU if requested. -Check who called python. If bash (single process). If mpiexec/mpirun (then MPI)

+
+
Sets environment variables to use MPI and/or GPU if requested.

Checks who called the python script. If bash (single process). If mpiexec/mpirun (then MPI)

+
+
Parameters:

accelerator (str) – accelerator flag from argparse ~ [‘cpu’, ‘mpi’, ‘gpu’, ‘mpigpu’, ‘gpumpi’]

diff --git a/notebooks/libraryLoading.html b/notebooks/libraryLoading.html index 5b69d46..5212019 100644 --- a/notebooks/libraryLoading.html +++ b/notebooks/libraryLoading.html @@ -460,43 +460,10 @@

Loading Libraries
---------------------------------------------------------------------------
-AttributeError                            Traceback (most recent call last)
-Cell In[3], line 2
-      1 ############## SET ENVIRONMENT VARIABLES ##############
-----> 2 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
-
-File /w/halld-scshelf2101/lng/Mambaforge/envs/PyAmpTools/lib/python3.9/site-packages/atiSetup.py:26, in setup(calling_globals, accelerator, use_fsroot, use_genamp)
-     16 def setup(calling_globals, accelerator='mpigpu', use_fsroot=False, use_genamp=False):
-     17     '''
-     18     Performs basic setup, loading libraries and setting aliases
-     19 
-   (...)
-     24         use_genamp (bool): True if GenAmp library should be loaded
-     25     '''
----> 26     USE_MPI, USE_GPU, RANK_MPI = loadLibraries(accelerator, use_fsroot, use_genamp)
-     27     set_aliases(calling_globals, USE_MPI)
-     29     return USE_MPI, USE_GPU, RANK_MPI
-
-File /w/halld-scshelf2101/lng/Mambaforge/envs/PyAmpTools/lib/python3.9/site-packages/atiSetup.py:55, in loadLibraries(accelerator, use_fsroot, use_genamp)
-     53 if RANK_MPI == 0: print("\n\n------------------------------------------------")
-     54 ROOT.initialize( RANK_MPI == 0 )
----> 55 if use_fsroot: ROOT.initialize_fsroot( RANK_MPI == 0 )
-     56 if RANK_MPI == 0: print("------------------------------------------------\n")
-     58 return USE_MPI, USE_GPU, RANK_MPI
-
-File /w/halld-scshelf2101/lng/WORK/PyAmpTools/root/root-6.28.06-gcc9.3.0/lib/ROOT/_facade.py:196, in ROOTFacade._fallback_getattr(self, name)
-    194     if res:
-    195         return res
---> 196 raise AttributeError("Failed to get attribute {} from ROOT".format(name))
-
-AttributeError: Failed to get attribute initialize_fsroot from ROOT
-
-

-
Initializing AMPTOOLS_AMPS_DATAIO for PyROOT...
-
-
-
cling::DynamicLibraryManager::loadLibrary(): /w/halld-scshelf2101/lng/WORK/PyAmpTools/external/FSRoot/lib/libFSRoot.so: undefined symbol: _ZTI17IncPiPiHistograms
+
------------------------------------------------
+
+Initializing AMPTOOLS_AMPS_DATAIO for PyROOT...
+Initializing FSRoot for PyROOT...
 
diff --git a/notebooks/mcmc.html b/notebooks/mcmc.html index 42e8e83..3918f51 100644 --- a/notebooks/mcmc.html +++ b/notebooks/mcmc.html @@ -430,7 +430,10 @@

Markov Chain Monte Carlo @@ -502,7 +504,7 @@

Markov Chain Monte CarloAmpTools) 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.

PrintSourceCode(mcmcManager.LogProb)
@@ -871,7 +873,7 @@ 

Markov Chain Monte Carlo