Merge branch 'offline_builds' of github.com:rbberger/lammps into offline_builds

This commit is contained in:
Richard Berger 2021-04-29 14:00:40 -04:00
commit 3bf2dbd45c
No known key found for this signature in database
GPG Key ID: A9E83994E0BA0CAB
1 changed files with 16 additions and 11 deletions

View File

@ -2,14 +2,13 @@
In some situations it might be necessary to build LAMMPS on a system without In some situations it might be necessary to build LAMMPS on a system without
internet. The scripts in this folder allow you to preload external dependencies internet. The scripts in this folder allow you to preload external dependencies
for both the documentation build for building with CMake into a folder and then for both the documentation build and for building with CMake.
use that folder on an offline system.
It does so by It does so by
1.) Downloading necessary pip packages 1. Downloading necessary pip packages
2.) Cloning git repositories 2. Cloning git repositories
3.) Downloading tarballs 3. Downloading tarballs
As of April 2021, all of these downloads make up around 600MB. By As of April 2021, all of these downloads make up around 600MB. By
default, it will download everything into $HOME/.cache/lammps, but this can be default, it will download everything into $HOME/.cache/lammps, but this can be
@ -22,28 +21,30 @@ The ``use_caches.sh`` must be sourced into the current shell to initialize the
offline build environment. Note that it must use the same ``LAMMPS_CACHING_DIR``. offline build environment. Note that it must use the same ``LAMMPS_CACHING_DIR``.
This script does the following: This script does the following:
1.) Sets up environment variables that modify the behavior of both pip and git 1. Sets up environment variables that modify the behavior of both pip and git
2.) Starts a simple local HTTP server to host files for CMake 2. Starts a simple local HTTP server to host files for CMake
Afterwards, it will print out instruction on how to modify the CMake command Afterwards, it will print out instruction on how to modify the CMake command
line to make sure it uses the local HTTP server. line to make sure it uses the local HTTP server.
To undo the environment changes and shutdown the HTTP server, run the To undo the environment changes and shutdown the local HTTP server, run the
``deactivate_caches`` command. ``deactivate_caches`` command.
## Examples ## Examples
For all of the examples below, you first need to create the cache (which requires internet). For all of the examples below, you first need to create the cache, which requires an internect connection.
```bash ```bash
./tools/offline/init_caches.sh ./tools/offline/init_caches.sh
``` ```
Afterwards, you can disconnect or copy the contents of the Afterwards, you can disconnect or copy the contents of the ``LAMMPS_CACHING_DIR`` folder to an offline system.
``LAMMPS_CACHING_DIR`` folder to an offline system.
### Documentation ### Documentation
The documentation build will create a new virtual environment that typically first installs dependencies from pip.
With the offline environment loaded, these installations will instead grab the necessary packages from your local cache.
```bash ```bash
# if LAMMPS_CACHING_DIR is different from default, make sure to set it first # if LAMMPS_CACHING_DIR is different from default, make sure to set it first
# export LAMMPS_CACHING_DIR=path/to/folder # export LAMMPS_CACHING_DIR=path/to/folder
@ -56,6 +57,10 @@ deactivate_caches
### CMake Build ### CMake Build
When compiling certain packages with external dependencies, the CMake build system will download some things from the web.
For more flexibility it allows users to specify the URL of each of these dependencies. What the ``init_caches.sh`` script does is
create a CMake preset file, which sets the URL for all of the known dependencies and redirects the download to a local cache.
```bash ```bash
# if LAMMPS_CACHING_DIR is different from default, make sure to set it first # if LAMMPS_CACHING_DIR is different from default, make sure to set it first
# export LAMMPS_CACHING_DIR=path/to/folder # export LAMMPS_CACHING_DIR=path/to/folder