Skip to content

Commit

Permalink
adding easyconfigs: RELION-5.0.0_beta.2023.12.21-foss-2023a-CUDA-12.1…
Browse files Browse the repository at this point in the history
….1.eb and patches: RELION-5.0.0_target-all-cuda-compute-capabilities.patch
  • Loading branch information
jfgrimm committed Jan 22, 2024
1 parent 5030f4c commit cba2cc3
Show file tree
Hide file tree
Showing 2 changed files with 276 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
# Author: Jasper Grimm (UoY)
easyblock = 'CMakeMake'

name = 'RELION'
version = '5.0.0_beta.2023.12.21'
_commit = '90d239e'
versionsuffix = '-CUDA-%(cudaver)s'

homepage = 'http://www2.mrc-lmb.cam.ac.uk/relion/index.php/Main_Page'
description = """RELION (for REgularised LIkelihood OptimisatioN, pronounce rely-on) is a stand-alone computer
program that employs an empirical Bayesian approach to refinement of (multiple) 3D reconstructions or 2D class
averages in electron cryo-microscopy (cryo-EM).
"""

build_info_msg = """To install RELION, it's recommended to change the defaults in this easyconfig,
to something suitable for your site. Recommended changes:
* Set '_torch_home' to the location where Blush model weights are downloaded (~10GB).
Instructions for downloading these can be found here:
https://github.com/3dem/relion/issues/1003#issuecomment-1786280151
* Uncomment the following optional dependencies if desired:
- ctffind or GCTF dependency
- MotionCor2
- ResMap
* Set additional 'RELION_*' variables, such as 'RELION_SCRATCH_DIR'. See:
https://relion.readthedocs.io/en/release-5.0/Installation.html#edit-the-environment-set-up
* Add a job submission template for queue submission. See:
https://relion.readthedocs.io/en/release-5.0/Installation.html#set-up-queue-job-submission
"""


toolchain = {'name': 'foss', 'version': '2023a'}
toolchainopts = {'opt': True}

sources = [{
'download_filename': '%(version)s.tar.gz',
'filename': SOURCELOWER_TAR_GZ,
'git_config': {
'url': 'https://github.com/3dem',
'repo_name': '%(namelower)s',
'commit': _commit,
'keep_git_dir': True,
},
}]
patches = ['%(name)s-5.0.0_target-all-cuda-compute-capabilities.patch']
checksums = [
# Note: no checksum for RELION tarball, due to use of `git_config`
None,
# RELION-5.0.0_target-all-cuda-compute-capabilities.patch
'd53ca4873278ebf8d297f062218c7096679531b1289b76d8bd4b35152a6c1543',
]

builddependencies = [
('CMake', '3.26.3'),
('poetry', '1.7.1'), # use poetry compatible with build 1.x
('meson-python', '0.15.0'), # pandas 2.1.4 needs meson >= 1.2.1
]

dependencies = [
('CUDA', '12.1.1', '', SYSTEM),
('X11', '20230603'),
('FLTK', '1.3.8'),
('LibTIFF', '4.5.0'),
('tbb', '2021.11.0'),
('libpng', '1.6.39'),
('gnuplot', '5.4.8'),
('Ghostscript', '10.01.2'),
('zstd', '1.5.5'),
('XZ', '5.4.2'),
('PBZIP2', '1.1.13'),

## dependencies from conda environment.yaml file ##
('Python', '3.11.3'),
('PyTorch', '2.1.2', versionsuffix),
('torchvision', '0.16.2', versionsuffix),
('SciPy-bundle', '2023.07'),
('tqdm', '4.66.1'),
('scikit-learn', '1.3.1'),
('matplotlib', '3.7.2'),
('PyQt5', '5.15.10'),
('Biopython', '1.83'),
('Seaborn', '0.13.1'),
('dill', '0.3.7'),
('umap-learn', '0.5.5'),
('einops', '0.7.0'),
('mrcfile', '1.5.0'),
('t-SNE-CUDA', '3.0.1', versionsuffix),
('ESM-2', '2.0.0', versionsuffix),
('topaz', '0.2.5.20231120', versionsuffix),
('dask', '2023.9.2'),
('imageio', '2.33.1'),
('napari', '0.4.18'),
('tensorboard', '2.15.1'),
]

# set this to the path to the Blush model weight database
_torch_home = ''

_copts = [
'-DCMAKE_SHARED_LINKER="$LIBS"',
'-DMPI_INCLUDE_PATH="$MPI_INC_DIR"',
'-DCUDA_NVCC_FLAGS="--std=c++14"',
'-DCUDA_ARCH="%(cuda_cc_semicolon_sep)s"',
'-DCUDA_TEXTURE=ON',
'-DDoublePrec_CPU=OFF',
'-DFETCH_WEIGHTS=OFF',
'-DTORCH_HOME="%s"' % _torch_home,
]

configopts = ' '.join(_copts)

install_cmd = 'make -j %(parallel)s install'

exts_defaultclass = 'PythonPackage'

exts_default_options = {
'source_urls': [PYPI_SOURCE],
'use_pip': True,
'download_dep_fail': True,
'sanity_pip_check': True,
}

exts_list = [
('pyhmmer', '0.10.4', {
# Cython error when building from source, use wheel for now
'source_tmpl': '%(name)s-%(version)s-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl',
'checksums': ['b563272fd46bf25b43c0d4c4ed5accac48a26ee8ca099b942e07ca7b7727a20d'],
}),
# starfile 0.5.4 needs pandas>=2.1.1
('pandas', '2.1.4', {
'checksums': ['fcb68203c833cc735321512e13861358079a96c174a61f5116a1de89c58c0ef7'],
}),
('starfile', '0.5.4', {
'checksums': ['4e7cea4f871f5aeeff6829b2cd95efc0c2212ca7a3a583f5fc8ff53329bc4417'],
}),
('loguru', '0.7.2', {
'checksums': ['e671a53522515f34fd406340ee968cb9ecafbc4b36c679da03c18fd8d0bd51ac'],
}),
('typer', '0.9.0', {
'checksums': ['50922fd79aea2f4751a8e0408ff10d2662bd0c8bbfa84755a699f3bada2978b2'],
}),
('fastcluster', '1.2.6', {
'checksums': ['aab886efa7b6bba7ac124f4498153d053e5a08b822d2254926b7206cdf5a8aa6'],
}),
('relion-classranker', '0.0.1_20230822', {
'sources': [{
'filename': '%(name)s-%(version)s.tar.gz',
'git_config': {
'url': 'https://github.com/3dem',
'repo_name': '%(name)s',
'commit': 'b6e751e5cb4205d8e9b36d0ae38c3687b3395acb',
'keep_git_dir': True,
},
}],
'checksums': [None],
}),
('relion-blush', '0.0.1_20231105', {
'sources': [{
'filename': '%(name)s-%(version)s.tar.gz',
'git_config': {
'url': 'https://github.com/3dem',
'repo_name': '%(name)s',
'commit': '3148869de884fc01cff6c51a047b1413fc0b62cb',
'keep_git_dir': True,
},
}],
'checksums': [None],
}),
('DynaMight', '0.0.1_20231206', {
'sources': [{
'filename': '%(name)s-%(version)s.tar.gz',
'git_config': {
'url': 'https://github.com/3dem',
'repo_name': '%(name)s',
'commit': '616360b790febf56edf08aef5d4c414058194376',
'keep_git_dir': True,
},
}],
'checksums': [None],
}),
('model-angelo', '1.0.12_20231207', {
'sources': [{
'filename': '%(name)s-%(version)s.tar.gz',
'git_config': {
'url': 'https://github.com/3dem',
'repo_name': '%(name)s',
'commit': 'd4ecc968b37f0694c1216c052438dfaf1bf2d813',
'keep_git_dir': True,
},
}],
'checksums': [None],
}),
]

sanity_check_paths = {
'files': ['bin/relion%s' % x for x in ['', '_autopick', '_batchrun', '_batchrun_mpi']],
'dirs': ['lib/python3.11/site-packages'],
}

sanity_check_commands = ['relion --help', 'relion --version']

modextrapaths = {
'PYTHONPATH': 'lib/python3.11/site-packages',
}

modextravars = {
'TORCH_HOME': _torch_home,
}

_version_maj = version.split('_')[0]
modloadmsg = "Current version pulled from commit %s from https://github.com/3dem/relion ver%s branch" % (_commit,
_version_maj)

moduleclass = 'bio'
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Description: enhance the cmake build scripts to:
- allow targetting of multiple CUDA architectures (with -gencode=)
- introduce DEFAULT_CUDA_ARCH to set the default CUDA arch target (-arch=)
Original Author: Jasper Grimm <[email protected]>
Updated by:
- Ake Sandgren <[email protected]>
Modified to correctly set NVCC build flags and allow externally setting --std=xxx flag.
- Jasper Grimm <[email protected]>
Update for relion 5.0.0 beta

diff -Nru relion.orig/cmake/BuildTypes.cmake relion/cmake/BuildTypes.cmake
--- relion.orig/cmake/BuildTypes.cmake 2024-01-12 16:34:35.601247994 +0000
+++ relion/cmake/BuildTypes.cmake 2024-01-12 16:36:40.744752894 +0000
@@ -4,8 +4,8 @@
# So -D__INTEL_COMPILER just manages to avoid compiling float128-targets (see fftw3.h, for instance).
# Add -G to allow cuda-gdb to break inside kernels.
if(CUDA)
- set(EXTRA_NVCC_FLAGS "-D__INTEL_COMPILER --default-stream per-thread --std=c++14")
- set(RELION_NVCC_FLAGS "${CUDARCH} ${WARN_DBL} ${EXTRA_NVCC_FLAGS}" CACHE STRING "" FORCE)
+ set(EXTRA_NVCC_FLAGS "-D__INTEL_COMPILER --default-stream per-thread")
+ set(RELION_NVCC_FLAGS "${WARN_DBL} ${EXTRA_NVCC_FLAGS}" CACHE STRING "" FORCE)
elseif (HIP)
if (${HIP_VERSION} VERSION_LESS "5.3" )
set(EXTRA_HIPCC_FLAGS "-fgpu-default-stream=legacy -fno-gpu-rdc -munsafe-fp-atomics")
diff -Nru relion.orig/CMakeLists.txt relion/CMakeLists.txt
--- relion.orig/CMakeLists.txt 2024-01-12 16:34:35.601247994 +0000
+++ relion/CMakeLists.txt 2024-01-12 16:41:34.615595884 +0000
@@ -84,13 +84,20 @@

set(CUDA_ARCH "" CACHE STRING "CUDA architecture to use")
if (CUDA_ARCH STREQUAL "")
- message(STATUS "Setting fallback CUDA_ARCH=50")
- set(CUDARCH "-arch=sm_50")
+ message(STATUS "Setting fallback CUDA_ARCH=5.0")
+ set(CUDA_ARCH "5.0")
else ()
message(STATUS "Using provided CUDA_ARCH=${CUDA_ARCH}")
- set(CUDARCH "-arch=sm_${CUDA_ARCH}")
endif ()

+if(NOT DEFINED DEFAULT_CUDA_ARCH)
+ string(REGEX MATCH "[0-9]+\\.[0-9]+" DEFAULT_CUDA_ARCH "${CUDA_ARCH}")
+ message(STATUS "Setting fallback DEFAULT_CUDA_ARCH=${DEFAULT_CUDA_ARCH}")
+endif()
+
+string(REPLACE "." "" DEFAULT_CUDA_SM ${DEFAULT_CUDA_ARCH})
+set(CUDA_SM "-arch=sm_${DEFAULT_CUDA_SM}")
+
# -------------------------------------------------------------------FURTHER OPTIONS--

# CUDA on by default, so check for other GPU/CPU-accelration request and possible conflicting dual-requests
@@ -204,6 +211,8 @@
if(CUDA)
add_definitions(-D_CUDA_ENABLED)
endif()
+ cuda_select_nvcc_arch_flags(CUDA_GENCODE "${CUDA_ARCH}")
+ list(APPEND CUDA_NVCC_FLAGS ${CUDA_SM} ${CUDA_GENCODE})
else(CUDA_FOUND)
message(FATAL_ERROR "CUDA enabled but unlable to locate packages...")
endif(CUDA_FOUND)

0 comments on commit cba2cc3

Please sign in to comment.