Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
technical:recipes:deepmd [2024-08-18 10:37] – [OpenMM Python Virtual Environment] bkang | technical:recipes:deepmd [2024-08-18 11:30] (current) – [Using the Virtual Environment] bkang | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== DeepMD Python Virtual Environment ====== | ||
+ | This page documents the creation of a Python virtual environment (virtualenv) containing the DeepMD software on the Caviness HPC system((The steps should also work on the DARWIN HPC system, though with different package versions.)). | ||
+ | |||
+ | ===== Prepare Workgroup Directory ===== | ||
+ | |||
+ | Prepare to add software in the standard sub-directories of the workgroup storage: | ||
+ | |||
+ | <code bash> | ||
+ | [user@login01 ~]$ workgroup -g my_workgroup | ||
+ | [(my_workgroup: | ||
+ | [(my_workgroup: | ||
+ | </ | ||
+ | |||
+ | These commands create any missing directories. | ||
+ | |||
+ | ===== Create Virtualenv ===== | ||
+ | |||
+ | The Python distribution will form the basis for the anaconda virtualenv, so add it to the environment: | ||
+ | |||
+ | <code bash> | ||
+ | [(my_workgroup: | ||
+ | Adding package `anaconda/ | ||
+ | </ | ||
+ | |||
+ | The virtual environment is first populated with all packages that **do not** require OpenMM. | ||
+ | |||
+ | <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! | ||
+ | </ | ||
+ | |||
+ | <code bash> | ||
+ | $ conda create --prefix=$WORKDIR/ | ||
+ | Solving environment: | ||
+ | : | ||
+ | Proceed ([y]/n)? y | ||
+ | : | ||
+ | Preparing transaction: | ||
+ | Verifying transaction: | ||
+ | Executing transaction: | ||
+ | # | ||
+ | # To activate this environment, | ||
+ | # | ||
+ | # $ conda activate / | ||
+ | # | ||
+ | # To deactivate an active environment, | ||
+ | # | ||
+ | # $ conda deactivate | ||
+ | # | ||
+ | </ | ||
+ | |||
+ | |||
+ | Before building and installing DeepMD the environment needs to be activated: | ||
+ | |||
+ | <code bash> | ||
+ | $ conda activate $WORKDIR/ | ||
+ | (/ | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Building DeepMD ===== | ||
+ | |||
+ | With the new virtual environment activated, we can now build DeepMD. | ||
+ | |||
+ | <code base> | ||
+ | (/ | ||
+ | Solving environment: | ||
+ | : | ||
+ | Proceed ([y]/n)? y | ||
+ | : | ||
+ | Preparing transaction: | ||
+ | Verifying transaction: | ||
+ | : | ||
+ | |||
+ | done | ||
+ | </ | ||
+ | |||
+ | ===== 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 DeepMD VALET package definition, the following text: | ||
+ | |||
+ | <file deepmd.vpkg_yaml> | ||
+ | openmm: | ||
+ | prefix: / | ||
+ | description: | ||
+ | flags: | ||
+ | - no-standard-paths | ||
+ | actions: | ||
+ | - action: source | ||
+ | script: | ||
+ | sh: anaconda-activate-2020.sh | ||
+ | order: failure-first | ||
+ | success: 0 | ||
+ | versions: | ||
+ | " | ||
+ | description: | ||
+ | dependencies: | ||
+ | - anaconda/ | ||
+ | </ | ||
+ | |||
+ | would be added to '' | ||
+ | |||
+ | ===== Using the Virtual Environment ===== | ||
+ | |||
+ | The versions of the virtual environment declared in the VALET package are listed using the '' | ||
+ | |||
+ | <code bash> | ||
+ | $ vpkg_versions deepmd | ||
+ | |||
+ | Available versions in package (* = default version): | ||
+ | |||
+ | [/ | ||
+ | deepmd | ||
+ | * 20240818 | ||
+ | </ | ||
+ | |||
+ | You can import deepmd, activating the virtual environment is accomplished using the '' | ||
+ | |||
+ | <code bash> | ||
+ | $ vpkg_require deepmd/ | ||
+ | Adding dependency `anaconda/ | ||
+ | Adding package `deepmd/ | ||
+ | (/ | ||
+ | ~/ | ||
+ | Python 3.12.4 | packaged by conda-forge | (main, Jun 17 2024, 10:23:07) [GCC 12.3.0] on linux | ||
+ | Type " | ||
+ | >>> | ||
+ | >>> | ||
+ | </ |