Skip to content

Commit

Permalink
Merge pull request #250 from RaulPPelaez/docs_update
Browse files Browse the repository at this point in the history
Update installation instructions regarding CUDA
  • Loading branch information
RaulPPelaez authored Jan 16, 2024
2 parents e9aaf1b + ec2bdf9 commit ca2498f
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 41 deletions.
29 changes: 1 addition & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,7 @@ We recommend using [Mamba](https://github.com/conda-forge/miniforge/#mambaforge)

### Install from source

1. Clone the repository:
```shell
git clone https://github.com/torchmd/torchmd-net.git
cd torchmd-net
```

2. Install the dependencies in environment.yml. You can do it via pip, but we recommend [Mambaforge](https://github.com/conda-forge/miniforge/#mambaforge) instead:

```shell
mamba env create -f environment.yml
mamba activate torchmd-net
```

3. CUDA enabled installation
You can skip this section if you only need a CPU installation.

```shell
mamba install cuda-nvcc cuda-libraries-dev cuda-version "gxx<12" pytorch=*=*cuda*
```
gxx<12 is required due to a [bug in GCC+CUDA12](https://github.com/pybind/pybind11/issues/4606) that prevents pybind11 from compiling correctly.

4. Install TorchMD-NET into the environment:
```shell
pip install -e .
```
This will install TorchMD-NET in editable mode, so that changes to the source code are immediately available.
Besides making all python utilities available environment-wide, this will also install the `torchmd-train` command line utility.

TorchMD-Net is installed using pip, but you will need to install some dependencies before. Check [this documentation page](https://torchmd-net.readthedocs.io/en/latest/installation.html#install-from-source).

## Usage
Specifying training arguments can either be done via a configuration yaml file or through command line arguments directly. Several examples of architectural and training specifications for some models and datasets can be found in [examples/](https://github.com/torchmd/torchmd-net/tree/main/examples). Note that if a parameter is present both in the yaml file and the command line, the command line version takes precedence.
Expand Down
57 changes: 44 additions & 13 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,64 @@ Install from source

1. Clone the repository:

.. code-block:: shell
.. code-block:: shell
git clone https://github.com/torchmd/torchmd-net.git
cd torchmd-net
2. Install the dependencies in environment.yml. You can do it via pip, but we recommend `Mambaforge <https://github.com/conda-forge/miniforge/#mambaforge>`_ instead.
2. Install the dependencies in environment.yml.

.. code-block:: shell
conda env create -f environment.yml
conda activate torchmd-net
3. Create an environment and activate it:
3. CUDA enabled installation

.. code-block:: shell
You can skip this section if you only need a CPU installation.

mamba env create -f environment.yml
mamba activate torchmd-net
You will need the CUDA compiler (nvcc) and the corresponding development libraries to build TorchMD-Net with CUDA support. You can install CUDA from the `official NVIDIA channel <https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#conda-installation>`_ or from conda-forge.

4. CUDA enabled installation
The conda-forge channel `changed the way to install CUDA from versions 12 and above <https://github.com/conda-forge/conda-forge.github.io/issues/1963)`_, thus the following instructions depend on whether you need CUDA < 12. If you have a GPU available, conda-forge probably installed the CUDA runtime (not the developer tools) on your system already, you can check with conda:

.. code-block:: shell
conda list | grep cuda
You can skip this section if you only need a CPU installation.
Or by asking pytorch:

.. code-block:: shell
python -c "import torch; print(torch.version.cuda)"
.. code-block:: shell
It is recommended to install the same version as the one used by torch.

mamba install cuda-nvcc cuda-libraries-dev cuda-version "gxx<12" pytorch=*=*cuda*
.. warning:: At the time of writing there is a `bug in Mamba <https://github.com/mamba-org/mamba/issues/3120>`_ (v1.5.6) that can cause trouble when installing CUDA on an already created environment. We thus recommend conda for this step.

* CUDA>=12

.. warning:: gxx<12 is required due to a `bug in GCC+CUDA12 <https://github.com/pybind/pybind11/issues/4606>`_ that prevents pybind11 from compiling correctly
.. code-block:: shell
conda install -c conda-forge cuda-nvcc cuda-libraries-dev cuda-version "gxx<12" pytorch=*=*cuda*
.. warning:: gxx<12 is required due to a `bug in GCC+CUDA12 <https://github.com/pybind/pybind11/issues/4606>`_ that prevents pybind11 from compiling correctly

5. Install TorchMD-NET into the environment:

.. code-block:: shell
* CUDA<12

The nvidia channel provides the developer tools for CUDA<12.

.. code-block:: shell
conda install -c nvidia "cuda-nvcc<12" "cuda-libraries-dev<12" "cuda-version<12" "gxx<12" pytorch=*=*cuda*
4. Install TorchMD-NET into the environment:

.. code-block:: shell
pip install -e .
Expand Down

0 comments on commit ca2498f

Please sign in to comment.