Skip to content

Commit

Permalink
{bio}[GCCcore/12.2.0] MotionCor3 v1.0.1 /w CUDA 12.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasHoffmann77 committed Oct 31, 2023
1 parent dc8e0c9 commit 20930a4
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Thomas Hoffmann, EMBL Heidelberg, [email protected], 2023/10
easyblock = 'MakeCp'

name = 'MotionCor3'
version = '1.0.1'
versionsuffix = '-CUDA-%(cudaver)s'

homepage = 'https://github.com/czimaginginstitute/MotionCor3'

description = """Anisotropic correction of beam induced motion for cryo-electron microscopy and
cryo-electron tomography images.
MotionCor3, an improved implementation of MotionCor2 with addition of CTF
(Contrast Transfer Function) estimation, is a multi-GPU accelerated software
package that enables single-pixel level correction of anisotropic beam induced
sample motion for cryo-electron microscopy and cryo-electron tomography images.
The iterative, patch-based motion detection combined with spatial and temporal
constraints and dose weighting provides robust and accurate correction. By
refining the measurement of early motion, MotionCor3 further improves correction
on tilted samples. The efficiency achieved by multi-GPU acceleration and
parallelization enables correction to keep pace with automated data collection.
The recent addition of a very robust GPU-accelerated CTF estimation makes
MotionCor3 more versatile in cryoEM and cryoET processing pipeline."""

toolchain = {'name': 'GCCcore', 'version': '12.2.0'}
toolchainopts = {'cstd': 'c++11'}

source_urls = [GITHUB_SOURCE]
sources = ['v%(version)s.tar.gz']
patches = ['%(name)s-%(version)s_makefile.patch']
checksums = [
{'v1.0.1.tar.gz': '9b1eaa43f67c6ca54c1cea6ad53ee78726a14a87a3c5d91e7820786ebe0786a3'},
{'MotionCor3-1.0.1_makefile.patch': 'd047c1f097eead3173a60fd3ae821ee7b285728bf8470f496021580f11875d12'},
]

github_account = 'czimaginginstitute'

build_cmd = 'make exe -f makefile11 CUDAHOME=$CUDA_HOME CUDACC="%(cuda_cc_cmake)s"'

builddependencies = [
('binutils', '2.39')
]

dependencies = [
('CUDA', '12.0.0', '', SYSTEM),
('LibTIFF', '4.4.0'),
]

files_to_copy = [(['%(name)s'], 'bin')]

sanity_check_paths = {
'files': ['bin/%(name)s'],
'dirs': ['bin'],
}

sanity_check_commands = ['%(name)s --help']

moduleclass = 'bio'
54 changes: 54 additions & 0 deletions easybuild/easyconfigs/m/MotionCor3/MotionCor3-1.0.1_makefile.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Thomas Hoffmann, EBML Heidelberg, [email protected], 2023/10
# allow to inject cuda compute capabilities and cfalgs
diff -ru MotionCor3-1.0.1/makefile11 MotionCor3-1.0.1_makefile/makefile11
--- MotionCor3-1.0.1/makefile11 2023-10-25 23:59:50.000000000 +0200
+++ MotionCor3-1.0.1_makefile/makefile11 2023-10-31 14:24:25.377992618 +0100
@@ -1,6 +1,6 @@
PRJHOME = $(shell pwd)
CONDA = $(HOME)/miniconda3
-CUDAHOME = $(HOME)/nvidia/cuda-12.1
+#CUDAHOME = $(HOME)/nvidia/cuda-12.1
CUDAINC = $(CUDAHOME)/include
CUDALIB = $(CUDAHOME)/lib64
PRJINC = $(PRJHOME)/Include
@@ -139,18 +139,21 @@
$(CUCPPS)
OBJS = $(patsubst %.cpp, %.o, $(SRCS))
#-------------------------------------
-CC = g++ -std=c++11
-CFLAG = -c -g -pthread -m64
+#CC = g++ -std=c++11
+CFLAG = -c -g -pthread -m64 $(CFLAGS)
NVCC = $(CUDAHOME)/bin/nvcc -std=c++11
-CUFLAG = -Xptxas -dlcm=ca -O2 \
- -gencode arch=compute_86,code=sm_86 \
- -gencode arch=compute_80,code=sm_80 \
- -gencode arch=compute_75,code=sm_75 \
- -gencode arch=compute_70,code=sm_70 \
- -gencode arch=compute_52,code=sm_52 \
- -gencode arch=compute_53,code=sm_53 \
- -gencode arch=compute_60,code=sm_60 \
- -gencode arch=compute_61,code=sm_61
+SPACE= ' '
+SEMI= ;
+GENCODES = $(foreach x,$(subst $(SEMI),$(SPACE),$(CUDACC)),-gencode arch=compute_$x,code=sm_$x)
+CUFLAG = -Xptxas -dlcm=ca -O2 $(GENCODES)
+# -gencode arch=compute_86,code=sm_86 \
+# -gencode arch=compute_80,code=sm_80 \
+# -gencode arch=compute_75,code=sm_75 \
+# -gencode arch=compute_70,code=sm_70 \
+# -gencode arch=compute_52,code=sm_52 \
+# -gencode arch=compute_53,code=sm_53 \
+# -gencode arch=compute_60,code=sm_60 \
+# -gencode arch=compute_61,code=sm_61
#------------------------------------------
cuda: $(CUCPPS)

@@ -165,6 +168,7 @@
-lcufft -lcudart -lcuda -lnvToolsExt -ltiff -lc -lm -lpthread \
-o MotionCor3
@echo MotionCor3 has been generated.
+ @echo used cuda gencodes: $(GENCODES)

%.cpp: %.cu
@echo "-----------------------------------------------"

0 comments on commit 20930a4

Please sign in to comment.