From 42bd13f41d02bc8888d8bd305c8bbb09ae249556 Mon Sep 17 00:00:00 2001 From: thoffman Date: Fri, 17 May 2024 17:02:21 +0200 Subject: [PATCH 1/5] {vis}[foss/2023] IMOD v4.12.62 w/ CUDA 12.1.1 --- .../i/IMOD/IMOD-4.11.12_hdf1.12.patch | 36 ++++++ .../IMOD/IMOD-4.12.17_tiltalign_include.patch | 13 ++ .../i/IMOD/IMOD-4.12.58_cudacc.patch | 22 ++++ .../IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb | 121 ++++++++++++++++++ 4 files changed, 192 insertions(+) create mode 100644 easybuild/easyconfigs/i/IMOD/IMOD-4.11.12_hdf1.12.patch create mode 100644 easybuild/easyconfigs/i/IMOD/IMOD-4.12.17_tiltalign_include.patch create mode 100644 easybuild/easyconfigs/i/IMOD/IMOD-4.12.58_cudacc.patch create mode 100644 easybuild/easyconfigs/i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb diff --git a/easybuild/easyconfigs/i/IMOD/IMOD-4.11.12_hdf1.12.patch b/easybuild/easyconfigs/i/IMOD/IMOD-4.11.12_hdf1.12.patch new file mode 100644 index 000000000000..94c463f639ce --- /dev/null +++ b/easybuild/easyconfigs/i/IMOD/IMOD-4.11.12_hdf1.12.patch @@ -0,0 +1,36 @@ +# Thomas Hoffmann, EMBL Heidelberg, structures-it@embl.de, 2023/08 +# add H5O_INFO_BASIC (better _ALL?) +# H5Oget_info_by_idx3 API changed for HDF5 version >= 1.12.0 +# https://stackoverflow.com/questions/62157364/why-is-hdf5-giving-a-too-few-arguments-error-here +# https://support.hdfgroup.org/ftp/HDF5/prev-releases/ReleaseFiles/hdf5-1.12.0-RELEASE.txt +diff -ru IMOD/libiimod/iihdf.c IMOD_hdf5/libiimod/iihdf.c +--- IMOD/libiimod/iihdf.c 2022-02-24 19:07:06.000000000 +0100 ++++ IMOD_hdf5/libiimod/iihdf.c 2023-08-24 18:31:53.029981337 +0200 +@@ -774,7 +774,7 @@ + } + + /* Find out if there are attributes */ +- if (!retval && H5Oget_info(groupID, &objInfo) < 0) ++ if (!retval && H5Oget_info(groupID, &objInfo, H5O_INFO_BASIC) < 0) + retval = IIERR_IO_ERROR; + if (!retval) + gdptr->numAttributes = (int)objInfo.num_attrs; +@@ -820,8 +820,7 @@ + } + + /* Get the info */ +- if (H5Oget_info_by_idx(groupID, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)ind, +- &objInfo, H5P_DEFAULT) < 0) { ++ if (H5Oget_info_by_idx(groupID, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)ind, &objInfo, H5P_DEFAULT, H5O_INFO_BASIC) < 0) { + retval = IIERR_IO_ERROR; + break; + } +@@ -931,7 +930,7 @@ + sMaxGroupNum = B3DMAX(sMaxGroupNum, groupNum); + } + dsData.dsetID = dsetID; +- if (H5Oget_info(dsetID, &objInfo) < 0) ++ if (H5Oget_info(dsetID, &objInfo, H5O_INFO_BASIC) < 0) + retval = IIERR_IO_ERROR; + if (!retval) + dsData.numAttributes = (int)objInfo.num_attrs; diff --git a/easybuild/easyconfigs/i/IMOD/IMOD-4.12.17_tiltalign_include.patch b/easybuild/easyconfigs/i/IMOD/IMOD-4.12.17_tiltalign_include.patch new file mode 100644 index 000000000000..3e649ece83f2 --- /dev/null +++ b/easybuild/easyconfigs/i/IMOD/IMOD-4.12.17_tiltalign_include.patch @@ -0,0 +1,13 @@ +# Thomas Hoffmann, EMBL Heidelberg, structures-it@embl.de, 2023/08 +diff -ru IMOD/flib/beadtrack/beadtrack.cpp IMOD_tiltalign_include/flib/beadtrack/beadtrack.cpp +--- IMOD/flib/beadtrack/beadtrack.cpp 2023-08-25 12:38:55.864116440 +0200 ++++ IMOD_tiltalign_include/flib/beadtrack/beadtrack.cpp 2023-08-25 17:13:50.646567630 +0200 +@@ -21,7 +21,7 @@ + #include "btfuncs.h" + #include "tafuncs.h" + #include "arraymaxes.h" +-#include "mapsepgroups.h" ++#include "../tiltalign/mapsepgroups.h" + #include "cgpixels.h" + #include "tltcntrl.h" + diff --git a/easybuild/easyconfigs/i/IMOD/IMOD-4.12.58_cudacc.patch b/easybuild/easyconfigs/i/IMOD/IMOD-4.12.58_cudacc.patch new file mode 100644 index 000000000000..dfe81d1da235 --- /dev/null +++ b/easybuild/easyconfigs/i/IMOD/IMOD-4.12.58_cudacc.patch @@ -0,0 +1,22 @@ +# Thomas Hoffmann, EMBL Heidelberg, structures-it@embl.de, 2024/01 +# replace hardcoded CUDA compute capabilitites in machines/rhlinux. +# Allow to be set by env $CUDACC +diff -ru IMOD/machines/rhlinux IMOD_cudacc/machines/rhlinux +--- IMOD/machines/rhlinux 2024-01-29 12:33:58.000000000 +0100 ++++ IMOD_cudacc/machines/rhlinux 2024-01-31 12:47:19.481617766 +0100 +@@ -604,10 +604,11 @@ + if ($?CUDA_DIR) then + set cudavers = `nvcc --version | sed -n -e '/[,.]/s// /g' -e '/^.*release/s///p'` + @ cudamajor = $cudavers[1] +- if ($cudamajor >= 4) set cuda_arch_opts = '-arch sm_20' +- if ($cudamajor >= 9) set cuda_arch_opts = '-arch sm_30' +- if ($cudamajor >= 11) set cuda_arch_opts = '-arch sm_35' +- if ($cudamajor >= 12) set cuda_arch_opts = '-arch sm_50' ++ #if ($cudamajor >= 4) set cuda_arch_opts = '-arch sm_20' ++ #if ($cudamajor >= 9) set cuda_arch_opts = '-arch sm_30' ++ #if ($cudamajor >= 11) set cuda_arch_opts = '-arch sm_35' ++ #if ($cudamajor >= 12) set cuda_arch_opts = '-arch sm_50' ++ set cuda_arch_opts = `echo "$CUDACC" | awk -F ';' '{for (i=1;i<=NF;i++) printf "-gencode=arch=compute_%s,code=sm_%s " , $i, $i}'` + set cudalibdir = "$CUDA_DIR/lib" + if ($cudamajor > 2 && $m64bit == true) set cudalibdir = "$CUDA_DIR/lib64" + set nvcc_flags = "$cuda_arch_opts $nvcc_flags -DUNIX -Xcompiler -fno-strict-aliasing" diff --git a/easybuild/easyconfigs/i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb b/easybuild/easyconfigs/i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb new file mode 100644 index 000000000000..54961cdcf025 --- /dev/null +++ b/easybuild/easyconfigs/i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb @@ -0,0 +1,121 @@ +easyblock = 'ConfigureMake' + +name = 'IMOD' +version = '4.12.62' +versionsuffix = '-CUDA-%(cudaver)s' + +homepage = 'https://bio3d.colorado.edu/imod/' +description = """IMOD is a set of image processing, modeling and display +programs used for tomographic reconstruction and for 3D reconstruction of EM +serial sections and optical sections. The package contains tools for assembling +and aligning data within multiple types and sizes of image stacks, viewing 3-D +data from any orientation, and modeling and display of the image files. IMOD +was developed primarily by David Mastronarde, Rick Gaudette, Sue Held, Jim +Kremer, Quanren Xiong, and John Heumann at the University of Colorado.""" + +toolchain = {'name': 'foss', 'version': '2023a'} +toolchainopts = {'pic': True} # openmp leads to segfault with xftoxg tool + +# download manually from mercurial repository and create source tarball: +# hg clone --debug http://bio3d.colorado.edu/imod/nightlyBuilds/IMOD +# get lunch +# cd IMOD +# hg update -r IMOD_4-12-62 +# rm .hg* -rf +# cd .. +# find IMOD -print|sort| tar -czf IMOD-`cat IMOD/.version`.tar.gz -T - +sources = [SOURCE_TAR_GZ] +patches = [ + 'IMOD-4.11.12_hdf1.12.patch', + 'IMOD-4.12.17_tiltalign_include.patch', + # replace hardcoded CUDA compute capabilitites in machines/rhlinux. set as CUDACC: + 'IMOD-4.12.58_cudacc.patch', +] +checksums = [ + # IMOD-4.12.62.tar.gz: + None, # can't include a valid checksum for source tarball, since it has to be created manually + # IMOD-4.11.12_hdf1.12.patch: + '19e5bff97b997c600f157dd56eddae96a7f34fef528e7f40e76ea8e19144810e', + # IMOD-4.12.17_tiltalign_include.patch: + '998c01a4f78b0d48dbffc530fcb12faaa892b1d322bce4f1643df20799845ab7', + # IMOD-4.12.58_cudacc.patch: + '9563b1ac9ab1569689d7db4380301f330290d9695988f8b31e7ea08d2601ee25', +] + +# can't include a valid checksum, since tarball has to be created manually +dependencies = [ + ('LibTIFF', '4.5.0'), + ('Qt5', '5.15.10'), + ('Java', '11', '', SYSTEM), + ('HDF5', '1.14.0'), + ('Python', '3.11.3'), + ('libGLU', '9.0.3'), + ('tcsh', '6.24.10'), + ('CUDA', '12.1.1', '', SYSTEM), + ('UCX-CUDA', '1.14.1', versionsuffix), +] + +# parallel build sometimes fails +parallel = 1 + +# modify all qmake pro files in order to pass CFLAGS +_qmake_pass_cflags = "find -name *.pro -exec sed -i -e '$aQMAKE_CXXFLAGS += $$(CFLAGS)' {} \\; && " + +# exports required for configure and build +_exports = 'export QTDIR=$EBROOTQT5 && ' +_exports += "export CUDACC='%(cuda_cc_cmake)s' && " +_exports += 'export HDF5_DIR=$EBROOTHDF5 && ' +_exports += 'export QMAKESPEC=$EBROOTQT5/mkspecs/`qmake -query QMAKE_SPEC` && ' +_exports += 'export CUDA_DIR=$CUDA_HOME && ' +# readw_or_imod.f and others with gfortran10: +# Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(4)/INTEGER(2)) +# => set -fallow-argument-mismatch. Runs through without this option with GCC 8.3.0. +_exports += 'export CFLAGS="$CFLAGS -fallow-argument-mismatch" && ' # required for gfortran10 + +# rename pysrc/pip.py to pysrc/PIP.py +_renamePip = """sed -i 's/from pip/from PIP/g' pysrc/* &&""" +_renamePip += """mv pysrc/pip.py pysrc/PIP.py &&""" +_renamePip += """sed -i 's/pip.py/PIP.py/g' pysrc/Makefile &&""" + +_useTcsh = 'sed -i "s|#!/bin/csh -f|#!/usr/bin/env tcsh|g;s|#! /bin/csh -f|#!/usr/bin/env tcsh|g" ' +_useTcsh += ' %(builddir)s/IMOD/{manpages/convert,setup,setup2,machines/rhlinux,packMacApps} &&' + +preconfigopts = _exports +preconfigopts += _renamePip +preconfigopts += _qmake_pass_cflags +preconfigopts += _useTcsh + +# IMOD's configure script is named setup and does not know the parameter --prefix, but -i. +# CFLAGs are passed with -flags. +configure_cmd = './setup ' +configure_cmd += '-c gnu ' # htf it finds icc? +configure_cmd += '-flags "$CFLAGS" ' # inject CFLAGS +configure_cmd += '-i %(installdir)s ' # set installdir +configure_without_installdir = True + +prebuildopts = _exports + +# create some missing directories required for installation process: +preinstallopts = 'mkdir %(installdir)s/{man/cat1,bin,autodoc,SystemTemplate,lib/imodplug,com,html,Plugins} -p && ' + +# patch hardcoded /usr/bin/python to use Python included as dependency +preinstallopts += "find pysrc -name '*.py' | xargs sed -i 's@^#!/usr/bin/python@#!/usr/bin/env python@g' && " +preinstallopts += "export PYTHONPATH=%(builddir)s/IMOD/pysrc:$PYTHONPATH && " +preinstallopts += "ls manpages/{csvtohtml,adocdefaults} | xargs sed -i 's@^#!.*/python -u@#!/usr/bin/env python@g' && " +preinstallopts += "xargs sed -i 's@^#!.*/python -u@#!/usr/bin/env python@g' html/makeqhp && " + +modextrapaths = {'PYTHONPATH': 'pylib'} + +modextravars = { + 'IMOD_DIR': "%(installdir)s", + 'IMOD_PLUGIN_DIR': '%(installdir)s/lib/imodplug', + 'IMOD_JAVADIR': '$JAVA_HOME', + 'FOR_DISABLE_STACK_TRACE': '1', +} +modloadmsg = 'Please set the environment variable $IMOD_CALIB_DIR if appropriate.' +sanity_check_paths = { + 'files': ['VERSION', 'bin/subm'], + 'dirs': ['bin', 'lib', 'com', 'autodoc', 'pylib', 'Plugins', 'man', 'SystemTemplate'], +} +sanity_check_commands = [('xftoxg', '-h')] +moduleclass = 'vis' From dc7e2c7380f68de1bfeec623bde41a3aec531e31 Mon Sep 17 00:00:00 2001 From: Thomas Hoffmann <81254262+ThomasHoffmann77@users.noreply.github.com> Date: Fri, 24 May 2024 11:53:19 +0200 Subject: [PATCH 2/5] Update IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb add download instructions --- .../IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/easybuild/easyconfigs/i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb b/easybuild/easyconfigs/i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb index 54961cdcf025..fb38aee0ba3c 100644 --- a/easybuild/easyconfigs/i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb +++ b/easybuild/easyconfigs/i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb @@ -16,14 +16,15 @@ Kremer, Quanren Xiong, and John Heumann at the University of Colorado.""" toolchain = {'name': 'foss', 'version': '2023a'} toolchainopts = {'pic': True} # openmp leads to segfault with xftoxg tool -# download manually from mercurial repository and create source tarball: -# hg clone --debug http://bio3d.colorado.edu/imod/nightlyBuilds/IMOD -# get lunch -# cd IMOD -# hg update -r IMOD_4-12-62 -# rm .hg* -rf -# cd .. -# find IMOD -print|sort| tar -czf IMOD-`cat IMOD/.version`.tar.gz -T - +download_instructions = f"""{name} requires manual download from mercurial repository: + hg clone --debug http://bio3d.colorado.edu/imod/nightlyBuilds/IMOD + cd IMOD + hg update -r IMOD_%s + rm .hg* -rf + cd .. + find IMOD -print|sort| tar -czf IMOD-`cat IMOD/.version`.tar.gz -T - +""" % version.replace('.', '-') + sources = [SOURCE_TAR_GZ] patches = [ 'IMOD-4.11.12_hdf1.12.patch', From 7105b2f0e0c3f94052bf4fe7bd76c4eedf304b96 Mon Sep 17 00:00:00 2001 From: Thomas Hoffmann <81254262+ThomasHoffmann77@users.noreply.github.com> Date: Fri, 24 May 2024 12:27:25 +0200 Subject: [PATCH 3/5] Update IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb style --- .../easyconfigs/i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easybuild/easyconfigs/i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb b/easybuild/easyconfigs/i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb index fb38aee0ba3c..dcf2424b8639 100644 --- a/easybuild/easyconfigs/i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb +++ b/easybuild/easyconfigs/i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb @@ -92,7 +92,7 @@ configure_cmd = './setup ' configure_cmd += '-c gnu ' # htf it finds icc? configure_cmd += '-flags "$CFLAGS" ' # inject CFLAGS configure_cmd += '-i %(installdir)s ' # set installdir -configure_without_installdir = True +configure_without_installdir = True prebuildopts = _exports From 1c13f4a943a4d1d9c9976b7f059bad46642d9292 Mon Sep 17 00:00:00 2001 From: Thomas Hoffmann <81254262+ThomasHoffmann77@users.noreply.github.com> Date: Mon, 10 Jun 2024 11:21:10 +0200 Subject: [PATCH 4/5] Update IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb add groff builddependency --- .../easyconfigs/i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/easybuild/easyconfigs/i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb b/easybuild/easyconfigs/i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb index dcf2424b8639..7646bba732dc 100644 --- a/easybuild/easyconfigs/i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb +++ b/easybuild/easyconfigs/i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb @@ -43,7 +43,8 @@ checksums = [ '9563b1ac9ab1569689d7db4380301f330290d9695988f8b31e7ea08d2601ee25', ] -# can't include a valid checksum, since tarball has to be created manually +builddependencies = [('groff', '1.22.4')] + dependencies = [ ('LibTIFF', '4.5.0'), ('Qt5', '5.15.10'), From a28e1546adbd3966437b183419956301539a4108 Mon Sep 17 00:00:00 2001 From: Thomas Hoffmann <81254262+ThomasHoffmann77@users.noreply.github.com> Date: Thu, 9 Jan 2025 10:01:28 +0100 Subject: [PATCH 5/5] Update IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb set IMOD_JAVADIR in modXXXfooter --- .../i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/easybuild/easyconfigs/i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb b/easybuild/easyconfigs/i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb index 7646bba732dc..bf7aeee0834b 100644 --- a/easybuild/easyconfigs/i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb +++ b/easybuild/easyconfigs/i/IMOD/IMOD-4.12.62-foss-2023a-CUDA-12.1.1.eb @@ -111,9 +111,18 @@ modextrapaths = {'PYTHONPATH': 'pylib'} modextravars = { 'IMOD_DIR': "%(installdir)s", 'IMOD_PLUGIN_DIR': '%(installdir)s/lib/imodplug', - 'IMOD_JAVADIR': '$JAVA_HOME', 'FOR_DISABLE_STACK_TRACE': '1', } + +modluafooter = """ +setenv("IMOD_JAVADIR", os.getenv("JAVA_HOME")) +""" + +modtclfooter = """ +setenv IMOD_JAVADIR $::env(JAVA_HOME) +""" + + modloadmsg = 'Please set the environment variable $IMOD_CALIB_DIR if appropriate.' sanity_check_paths = { 'files': ['VERSION', 'bin/subm'],