technical:recipes:openmm

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
technical:recipes:openmm [2024-07-29 13:49] bkangtechnical:recipes:openmm [2024-07-29 14:50] (current) – [VALET Package Definition] bkang
Line 9: Line 9:
 <code bash> <code bash>
 [user@login01 ~]$ workgroup -g my_workgroup [user@login01 ~]$ workgroup -g my_workgroup
-[(my_workgroup:user)@login01 ~]$ mkdir --mode=2775 --parent ${WORKDIR}/sw/tensorflow+[(my_workgroup:user)@login01 ~]$ mkdir --mode=2775 --parent ${WORKDIR}/sw/openmm
 [(my_workgroup:user)@login01 ~]$ mkdir --mode=2775 --parent ${WORKDIR}/sw/valet [(my_workgroup:user)@login01 ~]$ mkdir --mode=2775 --parent ${WORKDIR}/sw/valet
 </code> </code>
Line 15: Line 15:
 These commands create any missing directories.  All directories created will have group-write and -inherit permissions. These commands create any missing directories.  All directories created will have group-write and -inherit permissions.
  
-===== Create TensorFlow Virtualenv =====+===== Create Virtualenv =====
  
-The Intel Python distribution will form the basis for the Keras virtualenv, so add it to the environment:+The Python distribution will form the basis for the anaconda virtualenv, so add it to the environment:
  
 <code bash> <code bash>
-[(my_workgroup:user)@login01 ~]$ vpkg_require intel-python/2020u2:python3 +[(my_workgroup:user)@login01 ~]$ vpkg_require anaconda/2024.02 
-Adding package `intel-python/2020u2:python3` to your environment +Adding package `anaconda/2024.02` to your environment
-(base) [(my_workgroup:user)@login01 ~]$+
 </code> </code>
  
-Notice the prompt changed:  the text ''(base)'' now prefixes itindicating the directory that contains the active Python virtualenv.+The virtual environment is first populated with all packages that **do not** require OpenMM.  Any packages requiring OpenMM must be installed //after// we build and install our local copy of OpenMM in the virtual environment.  In this exampleneither Numpy nor Scipy require OpenMM.
  
-The ''conda search tensorflow'' command can be used to locate the specific version you wish to install.  Two examples are shown:  TensorFlow release at least 2.0 with GPU support; and an Intel-optimized version of TensorFlow 2.3.+<WRAP center round important 60%> 
 +The two channel options are present to ensure only the default Anaconda channels are consulted -- otherwise the command could still pick packages from the Intel channel, for example, which would still have the binary compatibility issues! 
 +</WRAP>
  
 <code bash> <code bash>
-(base) [frey@login00 ~]$ conda search 'tensorflow>=2.0=gpu*+$ conda create --prefix=$WORKDIR/sw/openmm/20240726 --override-channels --channel conda-forge python'=>3.7numpy scipy 
-Loading channels: done +Solving environment: done 
-# Name                       Version           Build  Channel              +    : 
-tensorflow                     2.0.0 gpu_py27hb041a2f_0  pkgs/main            +Proceed ([y]/n)? y 
-tensorflow                     2.0.0 gpu_py36h6b29c10_0  pkgs/main            +    : 
-tensorflow                     2.0.0 gpu_py37h768510d_0  pkgs/main           +Preparing transaction: done 
-tensorflow                     2.1.0 gpu_py27h9cdf9a9_0  pkgs/main            +Verifying transaction: done 
-tensorflow                     2.1.0 gpu_py36h2e5cdaa_0  pkgs/main            +Executing transaction: done 
-tensorflow                     2.1.0 gpu_py37h7a4bb67_0  pkgs/main            +#                                                                                
-tensorflow                     2.2.0 gpu_py36hf933387_0  pkgs/main            +# To activate this environment, use                                              
-tensorflow                     2.2.0 gpu_py37h1a511ff_0  pkgs/main            +#                                                                                
-tensorflow                     2.2.0 gpu_py38hb782248_0  pkgs/main  +#     $ conda activate /work/it_css/sw/openmm/20240726                           
- +#                                                                                
-(base) [frey@login00 ~]$ conda search 'tensorflow[version=2.3,channel=intel]' +# To deactivate an active environmentuse                                       
-Loading channels: done +#                                                                                
-Name                       Version           Build  Channel              +    $ conda deactivate  
-tensorflow                     2.3.0          py36_0  intel                +#
-tensorflow                     2.3.0          py37_0  intel                +
-tensorflow                     2.3.0          py38_0  intel +
 </code> </code>
  
-All versions of the TensorFlow virtualenv will be stored in the common base directory, ''$WORKDIR/sw/tensorflow''; each virtualenv must have a unique name that will become the VALET version of TensorFlow.  In this tutorial, the latest version of TensorFlow (with GPU support) is version 2.2.0, but the newest non-GPU version available with Python 3.8 is 2.3.0.  An appropriate version for the former would be ''2.2.0:gpu'' and the latter ''2.3.0:intel,python3.8'' Those versions can be translated to VALET-friendly directory names:+ 
 +Before building and installing OpenMM the environment needs to be activated:
  
 <code bash> <code bash>
-[(my_workgroup:user)@login01 ~]$ vpkg_id2path --version-id=2.2.0:gpu +conda activate $WORKDIR/sw/openmm/20240726 
-2.2.0-gpu +(/work/it_css/sw/openmm/20240726)$ 
-[(my_workgroup:user)@login01 ~]mkdir --mode=3750 ${WORKDIR}/sw/tensorflow/2.2.0-gpu +
- +
-[(my_workgroup:user)@login01 ~]$ vpkg_id2path --version-id=2.3.0:intel,python3.8 +
-2.3.0-intel-python3.8 +
-[(my_workgroup:user)@login01 ~]$ mkdir --mode=3750 ${WORKDIR}/sw/tensorflow/2.3.0-intel-python3.8+
 </code> </code>
  
-The virtualenvs are created using the ''%%--%%prefix'' option to specify the directories created above: 
  
-<code bash> +===== Building OpenMM =====
-(base) [(my_workgroup:user)@login01 ~]$ conda create --prefix=${WORKDIR}/sw/tensorflow/2.2.0-gpu 'tensorflow[version=2.2.0,build=gpu_py38hb782248_0]' +
-WARNING: A directory already exists at the target location '/work/it_nss/sw/tensorflow/2.2.0-gpu' +
-but it is not a conda environment. +
-Continue creating environment (y/[n])? y+
  
-   :+With the new virtual environment activated, we can now build OpenMM.
  
-Preparing transaction: done +<code base> 
-Verifying transaction: done +(/work/it_css/sw/openmm/20240726)$ conda install -c conda-forge openmm 
-Executing transaction: done +Solving environment: done 
-+    : 
-# To activate this environment, use +Proceed ([y]/n)? y 
-+    : 
-#     conda activate /work/it_nss/sw/tensorflow/2.2.0-gpu +Preparing transaction: done                                                      
-# +Verifying transaction: done                                                      
-# To deactivate an active environment, use +Executing transaction: \ By downloading and using the CUDA Toolkit conda packages, you accept the terms and conditions of the CUDA End User License Agreement (EULA): https://docs.nvidia.com/cuda/eula/index.html 
-+ 
-#     $ conda deactivate+done
 </code> </code>
  
-We're **not** going to activate that virtualenv -- we will install the other one next:+===== VALET Package Definition ===== 
 + 
 +The new virtual environment can easily be added to your login shell and job runtime environments using VALET. 
 +Assuming the workgroup does //not// already have a OpenMM VALET package definition, the following text: 
 + 
 +<file openmm.vpkg_yaml> 
 +openmm: 
 +    prefix: /work/my_workgroup/sw/openmm 
 +    description: openmm within a conda virtualenv 
 +    flags: 
 +        no-standard-paths 
 +    actions: 
 +        - action: source 
 +          script: 
 +              sh: anaconda-activate-2020.sh 
 +          order: failure-first 
 +          success: 0 
 +    versions: 
 +          "20240726": 
 +              description: environment built July 26, 2024 
 +              dependencies: 
 +                  - anaconda/2024.02 
 +</file> 
 + 
 +would be added to ''${WORKDIR}/sw/valet/openmm.vpkg_yaml''
 + 
 +===== Using the Virtual Environment ===== 
 + 
 +The versions of the virtual environment declared in the VALET package are listed using the ''vpkg_versions'' command:
  
 <code bash> <code bash>
-(base) [(it_nss:frey)@login00 ~]conda create --prefix=${WORKDIR}/sw/tensorflow/2.3.0-intel-python3.8 'tensorflow[version=2.3.0,build=py38_0,channel=intel]' +vpkg_versions openmm
-WARNING: A directory already exists at the target location '/work/it_nss/sw/tensorflow/2.3.0-intel-python3.8' +
-but it is not a conda environment. +
-Continue creating environment (y/[n])? y+
  
-   :+Available versions in package (* = default version):
  
-Preparing transaction: done +[/work/it_css/sw/valet/openmm.vpkg_yaml] 
-Verifying transaction: done +openmm      openmm within a conda virtualenv 
-Executing transaction: done +* 20240726  environment built July 262024
-+
-# To activate this environment, use +
-+
-#     $ conda activate /work/it_nss/sw/tensorflow/2.3.0-intel-python3.8 +
-# +
-# To deactivate an active environment, use +
-+
-#     $ conda deactivate+
 </code> </code>
  
-Ignore that ''conda activate'' command as well.  Rollback the ''intel-python'' environment changes before proceeding:+You can import openmm, activating the virtual environment is accomplished using the ''vpkg_require'' command (in your login shell or inside job scripts):
  
 <code bash> <code bash>
-(base[(my_workgroup:user)@login01 ~]vpkg_rollback +$ vpkg_require openmm/20240726 
-[(my_workgroup:user)@login01 ~]+Adding dependency `anaconda/2024.02` to your environment 
 +Adding package `openmm/20240726` to your environment 
 +(/work/it_css/sw/openmm/20240726)$ python 
 +~/conda-envs/my-sci-app/20201102/bin/python3 
 +Python 3.12.4 | packaged by conda-forge | (main, Jun 17 2024, 10:23:07[GCC 12.3.0on linux 
 +Type "help", "copyright", "credits" or "license" for more information. 
 +>>> import openmm as mm 
 +>>>
 </code> </code>
- 
-Notice the ''(base)'' has disappeared from the prompt, indicating that the baseline virtualenv has been deactivated. 
- 
- 
  • technical/recipes/openmm.1722275399.txt.gz
  • Last modified: 2024-07-29 13:49
  • by bkang