diff --git a/easybuild/easyconfigs/r/RELION/RELION-5.0.0-foss-2023a-CUDA-12.1.1.eb b/easybuild/easyconfigs/r/RELION/RELION-5.0.0-foss-2023a-CUDA-12.1.1.eb new file mode 100644 index 000000000000..5ed9caa652ca --- /dev/null +++ b/easybuild/easyconfigs/r/RELION/RELION-5.0.0-foss-2023a-CUDA-12.1.1.eb @@ -0,0 +1,218 @@ +# Author: Jasper Grimm (UoY) +easyblock = 'CMakeMake' + +name = 'RELION' +version = '5.0.0' +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 the model weights are downloaded (~12GB). The weights + can be downloaded manually by setting 'TORCH_HOME' and running 'relion_python_fetch_weights'. + + * RELION has various optional dependencies. The following have been enaled by default, since they + only add extra functionality, but can be commented out to build without: + - X11 and FLTK (GUI) + - Ghostscript (PDF) + - xpdf (PDF viewer) + - XZ, zstd, PBZIP2 (compression libraries) + - tcsh + - gnuplot + Other dependencies that are not enabled by default: + - evince (alternate PDF viewer) + - ctffind or GCTF + - MotionCor2/MotionCor3 + - AreTomo2 + - ResMap + these can be enabled by uncommenting the corresponding entry in the dependencies list. + + * 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 + These variables should be added to 'modextrapaths' or 'modextravars' as appropriate. + + * 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} + +source_urls = ['https://github.com/3dem/relion/archive'] +sources = ['%(version)s.tar.gz'] +patches = ['%(name)s-5.0.0_target-all-cuda-compute-capabilities.patch'] +checksums = [ + {'5.0.0.tar.gz': '5d02d529bfdb396204310b35963f35e5ec40ed9fd10bc88c901119ae7d7739fc'}, + {'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 = [ + # required dependencies # + ('CUDA', '12.1.1', '', SYSTEM), + ('LibTIFF', '4.5.0'), + ('tbb', '2021.11.0'), + ('libpng', '1.6.39'), + ('morphosamplers', '0.0.10'), # required for: src/tomography_python_programs/get_particle_poses/filaments.py + + # optional dependencies # + ('tcsh', '6.24.10'), + ('gnuplot', '5.4.8'), + ('FLTK', '1.3.8'), # for GUI + ('X11', '20230603'), # for GUI + ('PBZIP2', '1.1.13'), # for compression + ('zstd', '1.5.5'), # for compression + ('XZ', '5.4.2'), # for compression + ('Ghostscript', '10.01.2'), # for PDF files + ('xpdf', '4.04'), # pdf viewer + # ('evince', '45.0'), # pdf viewer + # ('ctffind', '4.1.14'), # lens defocus estimation + # ('AreTomo2', '1.0.0', versionsuffix), # alternative movie alignment + # ('MotionCor2', '1.5.0'), # alternative movie alignment + # ('MotionCor3', '1.0.1', versionsuffix), # alternative movie alignment + # ('ResMap', '1.1.4'), # alternative local resolution estimation + + # dependencies from conda environment.yaml file # + ('Python', '3.11.3'), + ('PyTorch-bundle', '2.1.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.2'), + ('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.19.post1'), + ('tensorboard', '2.15.1'), + ('PyHMMER', '0.10.6'), +] + +# set this to the path to the Blush model weight database +# workaround until we merged the "Dataset" easyblock: +# https://github.com/easybuilders/easybuild-easyblocks/pull/3246 +# https://github.com/easybuilders/easybuild-framework/pull/4474 +_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], +} + +exts_list = [ + # 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_20240319', { + 'sources': [{ + 'filename': '%(name)s-%(version)s.tar.gz', + 'git_config': { + 'url': 'https://github.com/3dem', + 'repo_name': '%(name)s', + 'commit': 'eef4aa673af6cc908042b38646ae489ee8f2fde9', + 'keep_git_dir': True, + }, + }], + 'checksums': [None], + }), + ('model-angelo', '1.0.12_20240226', { + 'sources': [{ + 'filename': '%(name)s-%(version)s.tar.gz', + 'git_config': { + 'url': 'https://github.com/3dem', + 'repo_name': '%(name)s', + 'commit': '6fdad9b47a0a2abb86990803f243ef028197a04d', + 'keep_git_dir': True, + }, + }], + 'checksums': [None], + }), +] + +sanity_check_paths = { + 'files': ['bin/relion%s' % x for x in ['', '_autopick', '_batchrun', '_batchrun_mpi']], + 'dirs': ['lib/python%(pyshortver)s/site-packages'], +} + +sanity_check_commands = ['relion --help', 'relion --version'] + +modextravars = { + 'TORCH_HOME': _torch_home, + 'RELION_PDFVIEWER_EXECUTABLE': '$EBROOTXPDF/bin/xpdf', + # 'RELION_SHELL': '$EBROOTTCSH/bin/tcsh', +} + +moduleclass = 'bio' diff --git a/easybuild/easyconfigs/r/RELION/RELION-5.0.0_target-all-cuda-compute-capabilities.patch b/easybuild/easyconfigs/r/RELION/RELION-5.0.0_target-all-cuda-compute-capabilities.patch new file mode 100644 index 000000000000..89c86042e3c9 --- /dev/null +++ b/easybuild/easyconfigs/r/RELION/RELION-5.0.0_target-all-cuda-compute-capabilities.patch @@ -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 +Updated by: + - Ake Sandgren + Modified to correctly set NVCC build flags and allow externally setting --std=xxx flag. + - Jasper Grimm + 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) diff --git a/test/easyconfigs/easyconfigs.py b/test/easyconfigs/easyconfigs.py index 941575c9eef8..25661dda1430 100644 --- a/test/easyconfigs/easyconfigs.py +++ b/test/easyconfigs/easyconfigs.py @@ -603,6 +603,8 @@ def check_dep_vars(self, gen, dep, dep_vars): 'mpi4py': [(r'4\.0\.1', [r'OpenQP-1\.0'])], # FDMNES requires sequential variant of MUMPS 'MUMPS': [(r'5\.6\.1; versionsuffix: -metis-seq', [r'FDMNES'])], + # RELION 5.0.0 requires fixes only in napari 0.4.19 and newer + 'napari': [(r'0\.4\.19\.post1;', [r'RELION-5\.0\.0'])], # SRA-toolkit 3.0.0 requires ncbi-vdb 3.0.0, Finder requires SRA-Toolkit 3.0.0 'ncbi-vdb': [(r'3\.0\.0', [r'SRA-Toolkit-3\.0\.0', r'finder-1\.1\.0'])], 'OpenFOAM': [ @@ -661,7 +663,7 @@ def check_dep_vars(self, gen, dep, dep_vars): # (for 2021b, UCX was updated to v1.11.2) 'UCX': [('1.11.0;', ['UCX-CUDA-1.11.0-'])], # Napari 0.4.19post1 requires VisPy >=0.14.1 <0.15 - 'VisPy': [('0.14.1;', ['napari-0.4.19.post1-'])], + 'VisPy': [('0.14.1;', ['napari-0.4.19.post1-', r'RELION-5\.0\.0'])], # Visit-3.4.1 requires VTK 9.2.x 'VTK': [('9.2.6;', ['Visit-3.4.1-'])], # wxPython 4.2.0 depends on wxWidgets 3.2.0