diff options
author | AbstractMethod <paul.polak@med-image.info> | 2020-09-14 19:55:04 -0400 |
---|---|---|
committer | Horea Christian <chr@chymera.eu> | 2020-09-17 11:14:25 -0400 |
commit | 21789df887204e7b98393fb115982ee36a71d8c1 (patch) | |
tree | 5398d0b7d35f8194d20a7ed58b5ed5403aeb8bc2 /sci-biology | |
parent | sci-libs/pytorch: Fix patch filename. (diff) | |
download | sci-21789df887204e7b98393fb115982ee36a71d8c1.tar.gz sci-21789df887204e7b98393fb115982ee36a71d8c1.tar.bz2 sci-21789df887204e7b98393fb115982ee36a71d8c1.zip |
Changes for fsl CUDA support
Package-Manager: Portage-3.0.6, Repoman-3.0.1
Signed-off-by: Horea Christian <chr@chymera.eu>
Diffstat (limited to 'sci-biology')
-rw-r--r-- | sci-biology/fsl/files/fsl-6.0.2-cuda_buildsettings.patch | 12 | ||||
-rw-r--r-- | sci-biology/fsl/files/fsl-6.0.2-eddy_cuda.patch | 21 | ||||
-rw-r--r-- | sci-biology/fsl/fsl-6.0.2-r1.ebuild | 202 | ||||
-rw-r--r-- | sci-biology/fsl/metadata.xml | 3 |
4 files changed, 238 insertions, 0 deletions
diff --git a/sci-biology/fsl/files/fsl-6.0.2-cuda_buildsettings.patch b/sci-biology/fsl/files/fsl-6.0.2-cuda_buildsettings.patch new file mode 100644 index 000000000..a3872acf0 --- /dev/null +++ b/sci-biology/fsl/files/fsl-6.0.2-cuda_buildsettings.patch @@ -0,0 +1,12 @@ +diff -Naur fsl.orig/config/buildSettings.mk fsl/config/buildSettings.mk +--- fsl.orig/config/buildSettings.mk 2020-07-23 15:43:42.277064365 -0400 ++++ fsl/config/buildSettings.mk 2020-07-23 15:45:17.705069496 -0400 +@@ -141,7 +141,7 @@ + # CUDA development environment + CUDAVER := $(or $(CUDAVER),9.1) + #$(info $$CUDAVER is [${CUDAVER}]) +-CUDA_INSTALLATION = /opt/cuda-${CUDAVER} ++CUDA_INSTALLATION = /opt/cuda + GENCODE_FLAGS = $(shell ${FSLDIR}/config/common/supportedGencodes.sh ${CUDA_INSTALLATION}) + LIB_CUDA = ${CUDA_INSTALLATION}/lib64 + INC_CUDA = ${CUDA_INSTALLATION}/include diff --git a/sci-biology/fsl/files/fsl-6.0.2-eddy_cuda.patch b/sci-biology/fsl/files/fsl-6.0.2-eddy_cuda.patch new file mode 100644 index 000000000..40409ec08 --- /dev/null +++ b/sci-biology/fsl/files/fsl-6.0.2-eddy_cuda.patch @@ -0,0 +1,21 @@ +diff -Naur fsl.orig/src/eddy/Makefile fsl/src/eddy/Makefile +--- fsl.orig/src/eddy/Makefile 2020-07-30 14:30:06.414884410 -0400 ++++ fsl/src/eddy/Makefile 2020-07-30 14:33:03.400889914 -0400 +@@ -29,6 +29,8 @@ + TMPCXXFLAGS_2= + TMPNAME_1= + TMPNAME_2= ++cuda=1 ++cpu=1 + + ifndef cuda + ifndef cpu #Default single cpu, no threading +@@ -74,7 +75,7 @@ + ifdef NVCC11 + NVCC=${NVCC11} + endif +-NVCCFLAGS=-c -DCOMPILE_GPU -O3 -m 64 -std=c++11 ++NVCCFLAGS=-c -DCOMPILE_GPU -O3 -m 64 -std=c++11 @@GENTOO_NVCC_FLAGS@@ + ifeq ($(CLOBBER_CLANG),1) + NVCCFLAGS+= -DCLOBBER_CLANG + endif diff --git a/sci-biology/fsl/fsl-6.0.2-r1.ebuild b/sci-biology/fsl/fsl-6.0.2-r1.ebuild new file mode 100644 index 000000000..0cadd4e4b --- /dev/null +++ b/sci-biology/fsl/fsl-6.0.2-r1.ebuild @@ -0,0 +1,202 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit cuda flag-o-matic toolchain-funcs prefix + +DESCRIPTION="Analysis of functional, structural, and diffusion MRI brain imaging data" +HOMEPAGE="http://www.fmrib.ox.ac.uk/fsl" +SRC_URI="https://fsl.fmrib.ox.ac.uk/fsldownloads/${P}-sources.tar.gz -> ${P}.tar.gz" + +LICENSE="FSL BSD-2 newmat" +SLOT="0" +KEYWORDS="~amd64" +IUSE="cuda" + +DEPEND=" + dev-libs/boost + dev-python/fslpy + media-gfx/graphviz + media-libs/gd + media-libs/glu + media-libs/libpng:0= + sci-libs/ciftilib + sci-libs/nlopt + sys-libs/zlib + dev-lang/tcl:0= + dev-lang/tk:0= + >=virtual/lapack-3.8 + >=virtual/blas-3.8 + + cuda? ( + || ( + ( =dev-util/nvidia-cuda-toolkit-10* =sys-devel/gcc-8* ) + ( =dev-util/nvidia-cuda-toolkit-11* =sys-devel/gcc-9* ) + ) + ) + " +RDEPEND="${DEPEND}" + +S=${WORKDIR}/${PN} +UPSTREAM_FSLDIR="/usr/share/fsl" + +PATCHES=( + "${FILESDIR}/${PN}"-6.0.2-gcc10_include.patch + "${FILESDIR}/${PN}"-6.0.2-setup.patch + "${FILESDIR}/${PN}"-6.0.2-template.patch + "${FILESDIR}/${PN}"-6.0.2-no_xmlpp.patch + "${FILESDIR}/${PN}"-5.0.11-niftiio_var_fix.patch + "${FILESDIR}/${PN}"-5.0.11-ifstream_use.patch + "${FILESDIR}/${PN}"-5.0.11-fslsurface_parallel_make.patch + "${FILESDIR}/${PN}"-6.0.2-qstring_compat.patch + "${FILESDIR}/${PN}"-5.0.9-headers.patch + "${FILESDIR}/${PN}"-6.0.2-fsldir_redux.patch +) + +src_prepare() { + default + + sed -i \ + -e "s:@@GENTOO_RANLIB@@:$(tc-getRANLIB):" \ + -e "s:@@GENTOO_CC@@:$(tc-getCC):" \ + -e "s:@@GENTOO_CXX@@:$(tc-getCXX):" \ + config/buildSettings.mk || die + + eprefixify $(grep -rl GENTOO_PORTAGE_EPREFIX src/*) \ + etc/js/label-div.html + + # Disable mist-clean the hard way for now. + rm -rf src/mist-clean + + makefilelist=$(find src/ -name Makefile) + + sed -i \ + -e "s:-I\${INC_BOOST}::" \ + -e "s:-I\${INC_ZLIB}::" \ + -e "s:-I\${INC_GD}::" \ + -e "s:-I\${INC_PNG}::" \ + -e "s:-L\${LIB_GD}::" \ + -e "s:-L\${LIB_PNG}::" \ + -e "s:-L\${LIB_ZLIB}::" \ + ${makefilelist} || die + + sed -e "s:\${FSLDIR}/bin/::g" \ + -e "s:\$FSLDIR/bin/::g" \ + -i $(grep -rl "\${FSLDIR}/bin" src/*) \ + -i $(grep -rl "\$FSLDIR/bin" src/*) \ + $(grep -rl "\${FSLDIR}/bin" etc/matlab/*)\ + $(grep -rl "\$FSLDIR/bin" etc/matlab/*) || die + + sed -e "s:\$FSLDIR/data:${EPREFIX}/usr/share/fsl/data:g" \ + -e "s:\${FSLDIR}/data:${EPREFIX}/usr/share/fsl/data:g" \ + -i $(grep -rl "\$FSLDIR/data" src/*) \ + $(grep -rl "\${FSLDIR}/data" src/*) || die + + sed -e "s:\$FSLDIR/doc:${EPREFIX}/usr/share/fsl/doc:g" \ + -e "s:\${FSLDIR}/doc:${EPREFIX}/usr/share/fsl/doc:g" \ + -i $(grep -rl "\$FSLDIR/doc" src/*) \ + $(grep -rl "\${FSLDIR}/doc" src/*) || die + + sed -e "s:/usr/share/fsl/doc:${EPREFIX}/usr/share/fsl/doc:g" \ + -i $(grep -rl "/usr/share/fsl/doc" src/*) || die + + sed -e "s:\$FSLDIR/etc:${EPREFIX}/etc:g" \ + -e "s:\${FSLDIR}/etc:${EPREFIX}/etc:g" \ + -i $(grep -rlI "\$FSLDIR/etc" *) \ + -i $(grep -rlI "\${FSLDIR}/etc" *) || die + + # Use generic blas/lapack rather than openblas + sed -e "s:-lopenblas:-llapack -lblas:g" \ + -i $(grep -rlI lopenblas *) || die + + # script wanting to have access to flsversion at buildtime + sed -e "s:/etc/fslversion:${S}/etc/fslversion:g" \ + -i ${makefilelist} || die + + if use cuda; then + einfo + + gcc_ver=`gcc-fullversion` + einfo "GCC version: ${gcc_ver}" + + cuda_gcc=`cuda_gccdir` + cuda_NVCC_flags=`cuda_gccdir -f` + einfo "CUDA GCC path: ${cuda_gcc}" + einfo " ${cuda_NVCC_flags}" + + CUDA_INSTALLATION="/opt/cuda" + CUDAVER=`cuda_toolkit_version` + + eapply "${FILESDIR}/${PN}-6.0.2-eddy_cuda.patch" + eapply "${FILESDIR}/${PN}-6.0.2-cuda_buildsettings.patch" + + sed -i \ + -e "s:@@GENTOO_NVCC_FLAGS@@:${cuda_NVCC_flags}:" \ + src/eddy/Makefile || die + + cuda_sanitize + fi +} + +src_compile() { + export FSLDIR=${WORKDIR}/${PN} + export FSLCONDIR=${WORKDIR}/${PN}/config + export FSLMACHTYPE=generic + + export USERLDFLAGS="${LDFLAGS}" + export USERCFLAGS="${CFLAGS}" + export USERCXXFLAGS="${CXXFLAGS}" + + export CIFTICFLAGS="$($(tc-getPKG_CONFIG) --cflags CiftiLib)" + export CIFTILIBS="$($(tc-getPKG_CONFIG) --libs-only-l CiftiLib)" + + if use cuda; then + einfo "CUDA_INSTALLATION: ${CUDA_INSTALLATION}" + einfo "CUDAVER: ${CUDAVER}" + fi + + ./build || die +} + +src_install() { + sed -i "s:\${FSLDIR}/tcl:/usr/libexec/fsl:g" \ + $(grep -lI "\${FSLDIR}/tcl" bin/*) \ + $(grep -l "\${FSLDIR}/tcl" tcl/*) || die + sed -i "s:\$FSLDIR/tcl:/usr/libexec/fsl:g" \ + $(grep -l "\$FSLDIR/tcl" tcl/*) || die + + dobin bin/* + + insinto /usr/share/${PN} + doins -r data + dodoc -r doc/. refdoc + + insinto /usr/libexec/fsl + doins -r tcl/* + + insinto /etc/fslconf + doins etc/fslconf/fsl.sh + + insinto /etc + doins etc/fslversion + doins -r etc/default_flobs.flobs etc/flirtsch etc/js etc/luts + + #the following is needed for FSL and depending programs to be able + #to find its files, since FSL uses an uncommon installation path: + #https://github.com/gentoo-science/sci/pull/612#r60289295 + dosym ../../../etc ${UPSTREAM_FSLDIR}/etc + dosym ../doc/${PF} ${UPSTREAM_FSLDIR}/doc + dosym ../../bin ${UPSTREAM_FSLDIR}/bin + + doenvd "$(prefixify_ro "${FILESDIR}"/99fsl)" + mv "${ED}"/usr/bin/{,fsl_}cluster || die +} + +pkg_postinst() { + echo + einfo "Please run the following commands if you" + einfo "intend to use fsl from an existing shell:" + einfo "env-update && source /etc/profile" + echo +} diff --git a/sci-biology/fsl/metadata.xml b/sci-biology/fsl/metadata.xml index d3788686e..9d12c769d 100644 --- a/sci-biology/fsl/metadata.xml +++ b/sci-biology/fsl/metadata.xml @@ -8,4 +8,7 @@ <longdescription> FSL is a comprehensive library of analysis tools for FMRI, MRI and DTI brain imaging data. </longdescription> + <use> + <flag name="cuda">Add support for CUDA</flag> + </use> </pkgmetadata> |