Deployment Guide
This section provides additional details for the deployment of the AlphaFold2-Multimer NIM.
View Available NIM Container Information
Container image tags can be seen with the command below, similar to other container images on NGC.
Pull the Container Image From NGC
Pull the container image using one of the following commands:
Docker
NGC SDK
Run the Container
As described in the Quickstart Guide, you can run the following command to start the AlphaFold2-Multimer NIM:
The following list shows the commonly used options for starting the NIM container:
-
docker run: This is the command to run a new container from a Docker image. -
-it: The-iflag allows access to STDIN for the container, and-tallocates a pseudo-TTY that interprets commands, for exampleCtrl+Cto stop the NIM container. -
--rm: This flag tells Docker to automatically remove the container when it exits. This property is useful for one-off runs or testing, as it prevents the container from being left behind. -
--name alphafold2-multimer: This flag gives the container the name “alphafold2-multimer”. -
--runtime=nvidia: This flag specifies the runtime to use for the container. In this case, it is set to “nvidia”, which is used for GPU acceleration. -
-e NGC_CLI_API_KEY: This passes the NGC_CLI_API_KEY environment variable (and the value set in the parent terminal) to the container. This is used for authentication with NVIDIA’s NGC (NVIDIA GPU Cloud) service, including downloading the model weights and databases if it is not present in the NIM Cache. -
-p 8000:8000: This flag maps port 8000 on the host machine to port 8000 in the container. This allows you to access the container’s services from the host machine. -
-v <source>:<dest>: Mounts the host directory~/.cache/nimin the container as/opt/nim/.cacheso that it can be used for storing and reusing downloaded models. -
-e NIM_IGNORE_MODEL_DOWNLOAD_FAIL=true: Ignores model download and detection errors, such as when mounting the model from a local cache to a NIM container hosted on an offline device that does not have access to NGC. Requires a locally cached and mounted model for expected behavior in the NIM. For more information or alternatives, refer to Configuring the NIM at Runtime. -
-e NIM_CACHE_PATH=<dest>: Changes the location where you mount your model in the filesystem of the NIM container. The default value is/opt/nim/.cache. Associated with-v <source>:<dest>, and for more information refer to Configuring the NIM at Runtime. -
-e NIM_HTTP_API_PORT=<port>: Changes the HTTP API port for sending queries to the NIM. The default value is8000. Associated with-p <host_port>:<server_port>, and for more information refer to Configuring the NIM at Runtime. -
-e NIM_PARALLEL_MSA_RUNNERS=<int>and-e NIM_PARALLEL_THREADS_PER_MSA=<int>: Change the number of parallel runners and threads per runner for MSA. For more information, refer to Configuring the NIM at Runtime.
Set Optional Runtime Parameters
This sample uses 3 MSA runners and 12 threads per runner. The 64-core example on the runtime page uses 6 runners and 10 threads.
-
-e CUDA_VISIBLE_DEVICES=0: This flag sets an environment variableCUDA_VISIBLE_DEVICESto the value0. This variable controls which GPU devices are visible to the container. In this case, it is set to0, which means the container will only use the first GPU (if available). -
nvcr.io/nim/deepmind/alphafold2-multimer:1.0.0: This is the Docker image name and tag. The image is hosted on NVIDIA’s container registry (nvcr.io) and is namedalphafold2-multimer. The tag1.0.0specifies a specific version of the image.
Check NIM Status
You can view running Docker containers on your system by using the following command:
This will return an output that looks like the following if the NIM is running:
The first column in the output is the Docker container ID, which can be useful for interacting with the container. The remaining fields describe the image the container is running, the command (in this case, the NIM server software), when the container was built, and its status. They also show how long it has been running, any open ports, and finally its name (given by the startup command).
If the NIM is not running, only the header will be returned.
Stop a Running Container
If for some reason your container has entered a state in which you cannot interact with it, or for any reason it must be killed, you may use the following command and the ID obtained from the docker ps command. Here is an example using the container ID from the previous example:
This will immediately terminate the running container.
Any in-flight requests are canceled, and data can be lost.
Cache the Model Checkpoint
On initial startup, the container will download the AlphaFold2 model parameters and supporting databases from NGC. You can skip this download step on future runs by caching the model weights locally using a cache directory as in the example below.
Run the container with the cache directory mounted as -v $LOCAL_NIM_CACHE:/opt/nim/.cache:
Caching the model checkpoint can save a considerable amount of time on subsequent runs.