Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{bio}[foss/2021a] AlphaFold v2.2.2 w/ Python 3.9.5 + CUDA 11.3.1 #15129

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
easyblock = 'PythonBundle'

name = 'AlphaFold'
version = '2.2.0'
verdurin marked this conversation as resolved.
Show resolved Hide resolved
versionsuffix = '-CUDA-%(cudaver)s'

homepage = 'https://deepmind.com/research/case-studies/alphafold'
description = "AlphaFold can predict protein structures with atomic accuracy even where no similar structure is known"

toolchain = {'name': 'foss', 'version': '2021a'}

builddependencies = [
# CMake/Doxygen/SWIG are required for building OpenMM
('CMake', '3.20.1'),
('Doxygen', '1.9.1'),
# required for installing dm-tree
('Bazel', '3.7.2'),
('SWIG', '4.0.2'),
]

dependencies = [
('Python', '3.9.5'),
('CUDA', '11.3.1', '', True),
('SciPy-bundle', '2021.05'),
('PyYAML', '5.4.1'),
('TensorFlow', '2.6.0', versionsuffix),
('Biopython', '1.79'),
('HH-suite', '3.3.0'),
('HMMER', '3.3.2'),
('Kalign', '3.3.1'),
('jax', '0.2.28', versionsuffix), # also provides absl-py
('UCX-CUDA', '1.10.0', versionsuffix),
('cuDNN', '8.2.1.32', versionsuffix, True),
('NCCL', '2.10.3', versionsuffix),
]
local_openmm_preinstallopts = "export OPENMM_INCLUDE_PATH=%(installdir)s/include && "
local_openmm_preinstallopts += " export OPENMM_LIB_PATH=%(installdir)s/lib && "

# required to install OpenMM Python API;
# avoid that setup.py partially uninstalls existing OpenMM Python bindings...
local_openmm_installopts = " && cd python && sed -i 's/uninstall()/pass/g' setup.py && "
local_openmm_installopts += "python setup.py build && python setup.py install --prefix=%(installdir)s"

# commit to use for downloading stereo_chemical_props.txt and copy to alphafold/common,
# see docker/Dockerfile in AlphaFold repository
local_scp_commit = '7102c6'

components = [
# for simtk
('OpenMM', '7.5.1', {
'easyblock': 'CMakeMake',
'source_urls': ['https://github.com/openmm/openmm/archive/'],
'sources': [{'download_filename': '%(version)s.tar.gz', 'filename': SOURCE_TAR_GZ}],
'patches': [('OpenMM-%(version)s_AlphaFold.patch', 'wrappers/python')],
'checksums': [
'c88d6946468a2bde2619acb834f57b859b5e114a93093cf562165612e10f4ff7', # OpenMM-7.5.1.tar.gz
'1b109dfff3af5c6aa70690bca14618612953c68840a7e64f679db7ca33c1aff6', # OpenMM-7.5.1_AlphaFold.patch
],
'start_dir': 'openmm-%(version)s',
'preinstallopts': local_openmm_preinstallopts,
'installopts': local_openmm_installopts,
}),
(name, version, {
'easyblock': 'PythonPackage',
'source_urls': [
'https://github.com/deepmind/alphafold/archive/refs/tags/',
'https://git.scicore.unibas.ch/schwede/openstructure/-/raw/%s/modules/mol/alg/src/' % local_scp_commit,
],
'sources': [
{
'download_filename': 'v%(version)s.tar.gz',
'filename': SOURCE_TAR_GZ,
},
{
'download_filename': 'stereo_chemical_props.txt',
'filename': 'stereo_chemical_props-%s.txt' % local_scp_commit,
'extract_cmd': "cp %s .",
},
],
'patches': [
'AlphaFold-2.0.0_fix-packages.patch',
'AlphaFold-2.1.2_data-dep-paths.patch',
'AlphaFold-2.0.0_n-cpu.patch',
'AlphaFold-2.1.0_fix-scp-path.patch',
'AlphaFold-2.0.1_setup_rm_tfcpu.patch',
'AlphaFold-2.1_fix-alphafold-tests.patch',
],
'checksums': [
'37c92f31895c1f2cd5d8529176bc27a8d7db7659fff64e0c5f3f99ea35aadfb0', # v2.2.0.tar.gz
'24510899eeb49167cffedec8fa45363a4d08279c0c637a403b452f7d0ac09451', # stereo_chemical_props-7102c6.txt
'826d2d1a5d6ac52c51a60ba210e1947d5631a1e2d76f8815305b5d23f74458db', # AlphaFold-2.0.0_fix-packages.patch
'6af91706b2a001494ddc0947f89f8b3d3adfcc26177c373824fe8ea1a58c0b48', # AlphaFold-2.1.2_data-dep-paths.patch
'dfda4dd5f9aba19fe2b6eb9a0ec583d12dcefdfee8ab8803fc57ad48d582db04', # AlphaFold-2.0.0_n-cpu.patch
'5363d403baf5ab73f4d3ddd72e19af9ff832de4b1d7ba25a5fbcc5846c1c890f', # AlphaFold-2.1.0_fix-scp-path.patch
'1a2e4e843bd9a4d15ee39e6c37cc63ba281311cc7a0a5610f0e43b52ef93faac', # AlphaFold-2.0.1_setup_rm_tfcpu.patch
# AlphaFold-2.1_fix-alphafold-tests.patch
'1e3f5a7359c46ec27c37043ddc33267e363112c455a5d85f49adb55bb9714588',
],
'start_dir': 'alphafold-%(version)s',
'use_pip': True,
}),
]

use_pip = True

exts_list = [
('PDBFixer', '1.7', {
'source_urls': ['https://github.com/openmm/pdbfixer/archive/refs/tags/'],
'sources': [{'download_filename': 'v%(version)s.tar.gz', 'filename': '%(name)s-%(version)s.tar.gz'}],
'checksums': ['a0bef3c52a7bbe69a6aea5333f51f3e7d158339be5829aed19b0344bd66d4eea'],
}),
('toolz', '0.11.2', {
'checksums': ['6b312d5e15138552f1bda8a4e66c30e236c831b612b2bf0005f8a1df10a4bc33'],
}),
('chex', '0.1.1', {
'checksums': ['f319f04568d1a75951f59129973a7852eedab93c4a94f382a65c4d718d9857c1'],
}),
('tabulate', '0.8.9', {
'checksums': ['eb1d13f25760052e8931f2ef80aaf6045a6cceb47514db8beab24cded16f13a7'],
}),
('jmp', '0.0.2', {
'preinstallopts': "touch requirements.txt && touch requirements-test.txt && ",
'checksums': ['fdb5cec0d10aab4116c2770f24b2adf4f503fcfbb96ce8ef583e1879bdbf1b9b'],
}),
('dm-haiku', '0.0.6', {
'modulename': 'haiku',
'source_urls': ['https://github.com/deepmind/dm-haiku/archive/refs/tags/'],
'sources': [{'download_filename': 'v%(version)s.tar.gz', 'filename': '%(name)s-%(version)s.tar.gz'}],
'checksums': ['bb038d7b6eae50ad8b59aecaad7b26180261f155c9a789d071133cb2596dc616'],
}),
('dm-tree', '0.1.6', {
'modulename': 'tree',
'checksums': ['6776404b23b4522c01012ffb314632aba092c9541577004ab153321e87da439a'],
}),
('websocket-client', '1.3.1', {
'modulename': 'websocket',
'checksums': ['6278a75065395418283f887de7c3beafb3aa68dada5cacbe4b214e8d26da499b'],
}),
('docker', '5.0.3', {
'checksums': ['d916a26b62970e7c2f554110ed6af04c7ccff8e9f81ad17d0d40c75637e227fb'],
}),
('immutabledict', '2.2.1', {
'checksums': ['1ddb0edf1bb6c70d0197eb90ce1fe2b2d58502334f5fdfde72d7c633d723ec3a'],
}),
('contextlib2', '21.6.0', {
'checksums': ['ab1e2bfe1d01d968e1b7e8d9023bc51ef3509bba217bb730cee3827e1ee82869'],
}),
('ml_collections', '0.1.1', {
'preinstallopts': "touch requirements.txt && touch requirements-test.txt && ",
'checksums': ['3fefcc72ec433aa1e5d32307a3e474bbb67f405be814ea52a2166bfc9dbe68cc'],
}),
]

postinstallcmds = [
"mkdir -p %(installdir)s/bin",
# run_alphafold.py script is missing a shebang...
"echo '#!/usr/bin/env python' > %(installdir)s/bin/run_alphafold.py",
"cat %(builddir)s/alphafold-%(version)s/run_alphafold.py >> %(installdir)s/bin/run_alphafold.py",
"chmod a+x %(installdir)s/bin/run_alphafold.py",
"cd %(installdir)s/bin && ln -s run_alphafold.py alphafold",
"cp -a %(builddir)s/alphafold-%(version)s/scripts %(installdir)s/",
"cp %%(builddir)s/stereo_chemical_props-%s.txt %%(installdir)s/stereo_chemical_props.txt" % local_scp_commit,
# run tests for run_alphafold.py script;
# shouldn't do this in sanity check to avoid breaking use of --module-only
"PYTHONPATH=%(installdir)s/lib/python%(pyshortver)s/site-packages:$PYTHONPATH "
"python %(builddir)s/alphafold-%(version)s/run_alphafold_test.py",
]

sanity_check_paths = {
'files': ['bin/alphafold', 'bin/pdbfixer', 'bin/run_alphafold.py', 'lib/libOpenMM.%s' % SHLIB_EXT,
'lib/python%(pyshortver)s/site-packages/simtk/openmm/openmm.py', 'stereo_chemical_props.txt'],
'dirs': ['lib/python%(pyshortver)s/site-packages', 'scripts'],
}

sanity_check_commands = [
"pdbfixer --help",
"python -m simtk.testInstallation",
"python -c 'import alphafold'",
"alphafold --help 2>&1 | grep 'Full AlphaFold protein structure prediction script'",
]

sanity_pip_check = True

modextrapaths = {
'OPENMM_INCLUDE_PATH': 'include',
'OPENMM_LIB_PATH': 'lib',
}

# these allow to make predictions on proteins that would typically be too long to fit into GPU memory;
# see https://github.com/deepmind/alphafold/blob/main/docker/run_docker.py
modextravars = {
'TF_FORCE_UNIFIED_MEMORY': '1',
'XLA_PYTHON_CLIENT_MEM_FRACTION': '4.0',
# 'ALPHAFOLD_DATA_DIR': '/path/to/AlphaFold_DBs', # please adapt
'OPENMM_RELAX': 'CUDA' # unset or set to 'CPU' in order not to run the energy minimization on GPU; PR#189
}

moduleclass = 'bio'
129 changes: 129 additions & 0 deletions easybuild/easyconfigs/j/jax/jax-0.2.28-foss-2021a-CUDA-11.3.1.eb
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# This file is an EasyBuild reciPY as per https://github.com/easybuilders/easybuild
# Author: Denis Kristak
easyblock = 'PythonBundle'

name = 'jax'
version = '0.2.28'
versionsuffix = '-CUDA-%(cudaver)s'

homepage = 'https://pypi.python.org/pypi/jax'
description = """Composable transformations of Python+NumPy programs:
differentiate, vectorize, JIT to GPU/TPU, and more"""

toolchain = {'name': 'foss', 'version': '2021a'}

builddependencies = [
('Bazel', '3.7.2'),
('pytest-xdist', '2.3.0'),
# git 2.x required to fetch repository 'io_bazel_rules_docker'
('git', '2.32.0', '-nodocs'),
]

dependencies = [
('CUDA', '11.3.1', '', True),
('cuDNN', '8.2.1.32', versionsuffix, True),
('NCCL', '2.10.3', versionsuffix),
('Python', '3.9.5'),
('SciPy-bundle', '2021.05'),
('flatbuffers-python', '2.0'),
('typing-extensions', '3.10.0.0'),
]

# running the tests with lots of cores results in test failures because not enough threads can be started,
# and running with a single core also results in systematic test failures
# 4 cores seems to work best
parallel = 4

# downloading TensorFlow tarball to avoid that Bazel downloads it during the build
# note: this *must* be the exact same commit as used in jaxlib-*/WORKSPACE
local_tf_commit = 'e662039f98d2b6a0d8242887d0881bae04e2d590'
local_tf_dir = 'tensorflow-%s' % local_tf_commit
local_tf_builddir = '%(builddir)s/' + local_tf_dir

# replace remote TensorFlow repository with the local one from EB
local_jax_prebuildopts = "sed -i -f jaxlib_local-tensorflow-repo.sed WORKSPACE && "
local_jax_prebuildopts += "sed -i 's|EB_TF_REPOPATH|%s|' WORKSPACE && " % local_tf_builddir

use_pip = True

default_easyblock = 'PythonPackage'
default_component_specs = {
'sources': [SOURCE_TAR_GZ],
'source_urls': [PYPI_SOURCE],
'start_dir': '%(name)s-%(version)s',
'use_pip': True,
'sanity_pip_check': True,
'download_dep_fail': True,
}

components = [
('absl-py', '0.13.0', {
'options': {'modulename': 'absl'},
'checksums': ['6953272383486044699fd0e9f00aad167a27e08ce19aae66c6c4b10e7e767793'],
}),
('jaxlib', '0.1.76', {
'sources': [
'%(name)s-v%(version)s.tar.gz',
{
'download_filename': '%s.tar.gz' % local_tf_commit,
'filename': 'tensorflow-%s.tar.gz' % local_tf_commit,
}
],
'source_urls': [
'https://github.com/google/jax/archive/',
'https://github.com/tensorflow/tensorflow/archive/'
],
'patches': [
('jaxlib_local-tensorflow-repo.sed', '.'),
'jaxlib-0.1.70_add-bazel-args-to-shutdown.patch',
('TensorFlow-2.7.0_cuda-noncanonical-include-paths.patch', '../' + local_tf_dir),
],
boegel marked this conversation as resolved.
Show resolved Hide resolved
'checksums': [
# jaxlib-v0.1.76.tar.gz
'6d5e185906dbc8f0f6589c5bc0569ae049bfe6346c271db73d5077f1fda41c7c',
# tensorflow-e662039f98d2b6a0d8242887d0881bae04e2d590.tar.gz
'8d6604640c8092abf640ccfb7222f6f941ee7b409d30292f6261ce3c86e23fab',
# jaxlib_local-tensorflow-repo.sed
'abb5c3b97f4e317bce9f22ed3eeea3b9715365818d8b50720d937e2d41d5c4e5',
# jaxlib-0.1.70_add-bazel-args-to-shutdown.patch
'c0ea6abd7827d3c37bdd60c30c7b0613fc86b91274c6a1a4cf13a3c7f9ce7631',
# TensorFlow-2.7.0_cuda-noncanonical-include-paths.patch
'0a759010c253d49755955cd5f028e75de4a4c447dcc8f5a0d9f47cce6881a9db',
],
'start_dir': 'jax-jaxlib-v%(version)s',
'prebuildopts': local_jax_prebuildopts,
}),
]

exts_list = [
('opt_einsum', '3.3.0', {
'checksums': ['59f6475f77bbc37dcf7cd748519c0ec60722e91e63ca114e68821c0c54a46549'],
}),
(name, version, {
'source_urls': ['https://github.com/google/jax/archive/'],
'source_tmpl': '%(name)s-v%(version)s.tar.gz',
'patches': [
'jax-0.2.19_fix-update-of-cache-access-time.patch',
'jax-0.2.24-foss-2021a_unimplemented.patch',
],
'checksums': [
'7c6ffb14c2069d75c0721ec21b35ee253f0f368b84b9ec9459f0870ed902bfa7', # jax-v0.2.28.tar.gz
# jax-0.2.19_fix-update-of-cache-access-time.patch
'e20562f67d63cc7e3478f7a92940291b2c8e328d605426bbabf89d8c2e1dd806',
# jax-0.2.24-foss-2021a_unimplemented.patch
'96fe1b15b55611727b0ae76409b89c44ae21a1c10002507ca8e3c06c2b134f4e',
],
# deliberately not testing in parallel, as that results in (additional) failing tests;
# use XLA_PYTHON_CLIENT_ALLOCATOR=platform to allocate and deallocate GPU memory during testing,
# see https://github.com/google/jax/issues/7323 and
# https://github.com/google/jax/blob/main/docs/gpu_memory_allocation.rst;
# use CUDA_VISIBLE_DEVICES=0 to avoid failing tests on systems with multiple GPUs;
# use NVIDIA_TF32_OVERRIDE=0 to avoid lossing numerical precision by disabling TF32 Tensor Cores;
'runtest': "NVIDIA_TF32_OVERRIDE=0 CUDA_VISIBLE_DEVICES=0 XLA_PYTHON_CLIENT_ALLOCATOR=platform "
"JAX_ENABLE_X64=true pytest tests",
}),
]

sanity_pip_check = True

moduleclass = 'tools'