diff --git a/notebooks/OpenFold.ipynb b/notebooks/OpenFold.ipynb index 8a844652..38179c3d 100644 --- a/notebooks/OpenFold.ipynb +++ b/notebooks/OpenFold.ipynb @@ -3,10 +3,11 @@ { "cell_type": "markdown", "metadata": { - "id": "view-in-github" + "id": "view-in-github", + "colab_type": "text" }, "source": [ - "\"Open" + "\"Open" ] }, { @@ -109,40 +110,54 @@ "#@markdown **Note**: This installs the software on the Colab\n", "#@markdown notebook in the cloud and not on your computer.\n", "\n", - "import os, time\n", + "import os, sys, time\n", "from IPython.utils import io\n", "from sys import version_info\n", "import subprocess\n", "\n", - "python_version = f\"{version_info.major}.{version_info.minor}\"\n", + "PYTHON_VERSION = f\"{version_info.major}.{version_info.minor}\"\n", + "#Default setting of OPENFOLD_COMMIT at None will work with latest code checked in\n", + "# in OPENFOLD_GIT_REPO. Should switch to a tagged release or a branch\n", + "# per best practices.\n", + "OPENFOLD_COMMIT = None\n", + "# COMMIT at which inline CUDA introduced\n", + "#OPENFOLD_COMMIT = \"e2e19f16676b1a409f9ba3a6f69b11ee7f5887c2\"\n", + "# COMMIT at which changes made to work with new numpy version\n", + "#OPENFOLD_COMMIT = \"15b1bbd667652637ea334a9ddd6b71f393910a0e\"\n", + "OPENFOLD_GIT_PROJECT = \"openfold\"\n", + "# For development purposes you may want to use a different\n", + "# \"fork\" of OpenFold than main aqlaboratory repository\n", + "OPENFOLD_GIT_USER = \"aqlaboratory\"\n", + "OPENFOLD_GIT_REPO =\\\n", + " f'https://github.com/{OPENFOLD_GIT_USER}/{OPENFOLD_GIT_PROJECT}'\n", "\n", "\n", - "os.system(\"wget -qnc https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh\")\n", - "os.system(\"bash Mambaforge-Linux-x86_64.sh -bfp /usr/local\")\n", - "os.system(\"mamba config --set auto_update_conda false\")\n", - "os.system(f\"mamba install -y -c conda-forge -c bioconda kalign2=2.04 hhsuite=3.3.0 openmm=7.7.0 python={python_version} pdbfixer biopython=1.79\")\n", - "os.system(\"pip install -q torch ml_collections py3Dmol modelcif\")\n", - "\n", "try:\n", " with io.capture_output() as captured:\n", + " %shell rm -rf {OPENFOLD_GIT_PROJECT}\n", + " %shell wget -qnc https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh\n", + " %shell bash Mambaforge-Linux-x86_64.sh -bfp /usr/local\n", + " %shell mamba install -y -c conda-forge -c bioconda kalign2=2.04 hhsuite=3.3.0 openmm=7.7.0 python={PYTHON_VERSION} pdbfixer biopython=1.79\n", + " %shell pip3 install -q torch ml_collections py3Dmol modelcif matplotlib\n", + " %shell git clone --branch main {OPENFOLD_GIT_REPO} {OPENFOLD_GIT_PROJECT}\n", + " if OPENFOLD_COMMIT:\n", + " %shell cd {OPENFOLD_GIT_PROJECT} && git checkout {OPENFOLD_COMMIT}\n", + " %shell cd {OPENFOLD_GIT_PROJECT} && python setup.py bdist_wheel\n", + " %shell pip3 install --no-dependencies ./{OPENFOLD_GIT_PROJECT}\n", + " %shell wget -q -P /content \\\n", + " https://git.scicore.unibas.ch/schwede/openstructure/-/raw/7102c63615b64735c4941278d92b554ec94415f8/modules/mol/alg/src/stereo_chemical_props.txt\n", + " %shell cp -f \\\n", + " -p /content/stereo_chemical_props.txt /usr/local/lib/python{PYTHON_VERSION}/site-packages/openfold/resources/\n", "\n", " # Create a ramdisk to store a database chunk to make Jackhmmer run fast.\n", " %shell sudo apt install --quiet --yes hmmer\n", " %shell sudo mkdir -m 777 --parents /tmp/ramdisk\n", " %shell sudo mount -t tmpfs -o size=9G ramdisk /tmp/ramdisk\n", "\n", - " %shell wget -q -P /content \\\n", - " https://git.scicore.unibas.ch/schwede/openstructure/-/raw/7102c63615b64735c4941278d92b554ec94415f8/modules/mol/alg/src/stereo_chemical_props.txt\n", - "\n", - " %shell mkdir -p /content/openfold/openfold/resources\n", - "\n", - " commit = \"e2e19f16676b1a409f9ba3a6f69b11ee7f5887c2\"\n", - " os.system(f\"pip install -q git+https://github.com/aqlaboratory/openfold.git@{commit}\")\n", - "\n", - " os.system(f\"cp -f -p /content/stereo_chemical_props.txt /usr/local/lib/python{python_version}/site-packages/openfold/resources/\")\n", - "\n", "except subprocess.CalledProcessError as captured:\n", - " print(captured)" + " print(captured)\n", + " raise\n", + "\n" ] }, { @@ -210,8 +225,8 @@ "import sys\n", "from typing import Dict, Sequence\n", "\n", - "sys.path.insert(0, f'/usr/local/lib/python{python_version}/dist-packages/')\n", - "sys.path.insert(0, f'/usr/local/lib/python{python_version}/site-packages/')\n", + "sys.path.insert(0, f'/usr/local/lib/python{PYTHON_VERSION}/dist-packages/')\n", + "sys.path.insert(0, f'/usr/local/lib/python{PYTHON_VERSION}/site-packages/')\n", "\n", "# Allows us to skip installing these packages\n", "unnecessary_modules = [\n", @@ -903,7 +918,7 @@ "colab": { "provenance": [], "gpuType": "T4", - "toc_visible": true + "include_colab_link": true }, "kernelspec": { "display_name": "Python 3", @@ -916,4 +931,4 @@ }, "nbformat": 4, "nbformat_minor": 0 -} \ No newline at end of file +} diff --git a/setup.py b/setup.py index bec98625..bef8d63c 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ ] extra_cuda_flags = [ - '-std=c++14', + '-std=c++17', '-maxrregcount=50', '-U__CUDA_NO_HALF_OPERATORS__', '-U__CUDA_NO_HALF_CONVERSIONS__', @@ -38,7 +38,7 @@ ] def get_cuda_bare_metal_version(cuda_dir): - if cuda_dir==None or torch.version.cuda==None: + if cuda_dir==None or torch.version.cuda==None or not torch.cuda.is_available(): print("CUDA is not found, cpu version is installed") return None, -1, 0 else: