Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Cuda 9.0.176 ebuilds
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
RayDude
Advocate
Advocate


Joined: 29 May 2004
Posts: 2052
Location: San Jose, CA

PostPosted: Sun Oct 22, 2017 5:16 pm    Post subject: Cuda 9.0.176 ebuilds Reply with quote

I hacked the existing cuda 8 ebuilds to install cuda 9 and they seem to be working. If you need cuda 9, give it a try:

nvidia-cuda-sdk-9.0.176.ebuild:
Code:
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit cuda eutils flag-o-matic portability toolchain-funcs unpacker versionator

MYD=$(get_version_component_range 1-2)
DRIVER_PV="384.81"

DESCRIPTION="NVIDIA CUDA Software Development Kit"
HOMEPAGE="https://developer.nvidia.com/cuda-zone"
SRC_URI="https://developer.nvidia.com/compute/cuda/${MYD}/Prod/local_installers/cuda_${PV}_${DRIVER_PV}_linux-run -> cuda_${PV}_${DRIVER_PV}_linux.run"

LICENSE="CUDPP"
SLOT="0"
KEYWORDS="~amd64 ~amd64-linux"
IUSE="+cuda debug +doc +examples opencl mpi"

RDEPEND="
        ~dev-util/nvidia-cuda-toolkit-${PV}
        media-libs/freeglut
        examples? (
                media-libs/freeimage
                media-libs/glew:0=
                >=x11-drivers/nvidia-drivers-375.26[uvm]
                mpi? ( virtual/mpi )
                )"
DEPEND="${RDEPEND}"

RESTRICT="test"

S=${WORKDIR}/samples

QA_EXECSTACK=(
        opt/cuda/sdk/0_Simple/cdpSimplePrint/cdpSimplePrint
        opt/cuda/sdk/0_Simple/cdpSimpleQuicksort/cdpSimpleQuicksort
        opt/cuda/sdk/bin/x86_64/linux/release/cdpSimplePrint
        opt/cuda/sdk/bin/x86_64/linux/release/cdpSimpleQuicksort
        )

src_unpack() {
        # We first need to unpack the cuda_${PV}_linux.run file
        # which includes the cuda-samples*run file.
        unpacker
        unpacker run_files/cuda-samples*run
}

pkg_setup() {
        if use cuda || use opencl; then
                cuda_pkg_setup
        fi
}

src_prepare() {
        export RAWLDFLAGS="$(raw-ldflags)"
#       epatch "${FILESDIR}"/${P}-asneeded.patch

        local file
        while IFS="" read -d $'\0' -r file; do
                sed \
                        -e 's:-O[23]::g' \
                        -e "/LINK/s:gcc:$(tc-getCC) ${LDFLAGS}:g" \
                        -e "/LINK/s:g++:$(tc-getCXX) ${LDFLAGS}:g" \
                        -e "/CC/s:gcc:$(tc-getCC):g" \
                        -e "/GCC/s:g++:$(tc-getCXX):g" \
                        -e "/NVCC /s|\(:=\).*|:= ${EPREFIX}/opt/cuda/bin/nvcc|g" \
                        -e "/ CFLAGS/s|\(:=\)|\1 ${CFLAGS}|g" \
                        -e "/ CXXFLAGS/s|\(:=\)|\1 ${CXXFLAGS}|g" \
                        -e "/NVCCFLAGS/s|\(:=\)|\1 ${NVCCFLAGS} |g" \
                        -e 's:-Wimplicit::g' \
                        -e "s|../../common/lib/linux/\$(OS_ARCH)/libGLEW.a|$($(tc-getPKG_CONFIG) --libs glew)|g" \
                        -e "s|../../common/lib/\$(OSLOWER)/libGLEW.a|$($(tc-getPKG_CONFIG) --libs glew)|g" \
                        -e "s|../../common/lib/\$(OSLOWER)/\$(OS_ARCH)/libGLEW.a|$($(tc-getPKG_CONFIG) --libs glew)|g" \
                        -i "${file}" || die
                        # -e "/ALL_LDFLAGS/s|:=|:= ${RAWLDFLAGS} |g" \
        done < <(find . -type f -name 'Makefile' -print0)

        rm -rf common/inc/GL || die
        find . -type f -name '*.a' -delete || die

        eapply_user
}

src_compile() {
        use examples || return
        local myopts=("verbose=1")
        use debug && myopts+=("dbg=1")
        export FAKEROOTKEY=1 # Workaround sandbox issue in #462602
        emake \
                cuda-install="${EPREFIX}/opt/cuda" \
                CUDA_PATH="${EPREFIX}/opt/cuda/" \
                MPI_GCC=10 \
                "${myopts[@]}"
}

src_test() {
        addwrite /dev/nvidiactl
        addwrite /dev/nvidia0

        local i
        for i in {0..9}*/*; do
                emake -C "${i}" run
        done
}

src_install() {
        local f t crap=( *.txt Samples.htm* )

        if use doc; then
                ebegin "Installing docs ..."
                        while IFS="" read -d $'\0' -r f; do
                                treecopy "${f}" "${ED%/}"/usr/share/doc/${PF}/
                        done < <(find -type f \( -name 'readme.txt' -o -name '*.pdf' \) -print0)

                        while IFS="" read -d $'\0' -r f; do
                                docompress -x "${f#${ED%/}}"
                        done < <(find "${ED%/}"/usr/share/doc/${PF}/ -type f -name 'readme.txt' -print0)
                eend
        fi

        ebegin "Cleaning before installation..."
                for f in "${crap[@]}"; do
                        rm -f "${f}" || die
                done
                find -type f \( -name '*.o' -o -name '*.pdf' -o -name 'readme.txt' \) -delete || die
        eend

        ebegin "Moving files..."
                while IFS="" read -d $'\0' -r f; do
                        t="$(dirname ${f})"
                        if [[ ${t/obj\/} != ${t} || ${t##*.} == a ]]; then
                                continue
                        fi
                        if [[ -x ${f} ]]; then
                                exeinto /opt/cuda/sdk/"${t}"
                                doexe "${f}"
                        else
                                insinto /opt/cuda/sdk/"${t}"
                                doins "${f}"
                        fi
                done < <(find . -type f -print0)
        eend
}
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit cuda eutils flag-o-matic portability toolchain-funcs unpacker versionator

MYD=$(get_version_component_range 1-2)
DRIVER_PV="384.81"

DESCRIPTION="NVIDIA CUDA Software Development Kit"
HOMEPAGE="https://developer.nvidia.com/cuda-zone"
SRC_URI="https://developer.nvidia.com/compute/cuda/${MYD}/Prod/local_installers/cuda_${PV}_${DRIVER_PV}_linux-run -> cuda_${PV}_${DRIVER_PV}_linux.run"

LICENSE="CUDPP"
SLOT="0"
KEYWORDS="~amd64 ~amd64-linux"
IUSE="+cuda debug +doc +examples opencl mpi"

RDEPEND="
        ~dev-util/nvidia-cuda-toolkit-${PV}
        media-libs/freeglut
        examples? (
                media-libs/freeimage
                media-libs/glew:0=
                >=x11-drivers/nvidia-drivers-375.26[uvm]
                mpi? ( virtual/mpi )
                )"
DEPEND="${RDEPEND}"

RESTRICT="test"

S=${WORKDIR}/samples

QA_EXECSTACK=(
        opt/cuda/sdk/0_Simple/cdpSimplePrint/cdpSimplePrint
        opt/cuda/sdk/0_Simple/cdpSimpleQuicksort/cdpSimpleQuicksort
        opt/cuda/sdk/bin/x86_64/linux/release/cdpSimplePrint
        opt/cuda/sdk/bin/x86_64/linux/release/cdpSimpleQuicksort
        )

src_unpack() {
        # We first need to unpack the cuda_${PV}_linux.run file
        # which includes the cuda-samples*run file.
        unpacker
        unpacker run_files/cuda-samples*run
}

pkg_setup() {
        if use cuda || use opencl; then
                cuda_pkg_setup
        fi
}

src_prepare() {
        export RAWLDFLAGS="$(raw-ldflags)"
#       epatch "${FILESDIR}"/${P}-asneeded.patch

        local file
        while IFS="" read -d $'\0' -r file; do
                sed \
                        -e 's:-O[23]::g' \
                        -e "/LINK/s:gcc:$(tc-getCC) ${LDFLAGS}:g" \
                        -e "/LINK/s:g++:$(tc-getCXX) ${LDFLAGS}:g" \
                        -e "/CC/s:gcc:$(tc-getCC):g" \
                        -e "/GCC/s:g++:$(tc-getCXX):g" \
                        -e "/NVCC /s|\(:=\).*|:= ${EPREFIX}/opt/cuda/bin/nvcc|g" \
                        -e "/ CFLAGS/s|\(:=\)|\1 ${CFLAGS}|g" \
                        -e "/ CXXFLAGS/s|\(:=\)|\1 ${CXXFLAGS}|g" \
                        -e "/NVCCFLAGS/s|\(:=\)|\1 ${NVCCFLAGS} |g" \
                        -e 's:-Wimplicit::g' \
                        -e "s|../../common/lib/linux/\$(OS_ARCH)/libGLEW.a|$($(tc-getPKG_CONFIG) --libs glew)|g" \
                        -e "s|../../common/lib/\$(OSLOWER)/libGLEW.a|$($(tc-getPKG_CONFIG) --libs glew)|g" \
                        -e "s|../../common/lib/\$(OSLOWER)/\$(OS_ARCH)/libGLEW.a|$($(tc-getPKG_CONFIG) --libs glew)|g" \
                        -i "${file}" || die
                        # -e "/ALL_LDFLAGS/s|:=|:= ${RAWLDFLAGS} |g" \
        done < <(find . -type f -name 'Makefile' -print0)

        rm -rf common/inc/GL || die
        find . -type f -name '*.a' -delete || die

        eapply_user
}

src_compile() {
        use examples || return
        local myopts=("verbose=1")
        use debug && myopts+=("dbg=1")
        export FAKEROOTKEY=1 # Workaround sandbox issue in #462602
        emake \
                cuda-install="${EPREFIX}/opt/cuda" \
                CUDA_PATH="${EPREFIX}/opt/cuda/" \
                MPI_GCC=10 \
                "${myopts[@]}"
}

src_test() {
        addwrite /dev/nvidiactl
        addwrite /dev/nvidia0

        local i
        for i in {0..9}*/*; do
                emake -C "${i}" run
        done
}

src_install() {
        local f t crap=( *.txt Samples.htm* )

        if use doc; then
                ebegin "Installing docs ..."
                        while IFS="" read -d $'\0' -r f; do
                                treecopy "${f}" "${ED%/}"/usr/share/doc/${PF}/
                        done < <(find -type f \( -name 'readme.txt' -o -name '*.pdf' \) -print0)

                        while IFS="" read -d $'\0' -r f; do
                                docompress -x "${f#${ED%/}}"
                        done < <(find "${ED%/}"/usr/share/doc/${PF}/ -type f -name 'readme.txt' -print0)
                eend
        fi

        ebegin "Cleaning before installation..."
                for f in "${crap[@]}"; do
                        rm -f "${f}" || die
                done
                find -type f \( -name '*.o' -o -name '*.pdf' -o -name 'readme.txt' \) -delete || die
        eend

        ebegin "Moving files..."
                while IFS="" read -d $'\0' -r f; do
                        t="$(dirname ${f})"
                        if [[ ${t/obj\/} != ${t} || ${t##*.} == a ]]; then
                                continue
                        fi
                        if [[ -x ${f} ]]; then
                                exeinto /opt/cuda/sdk/"${t}"
                                doexe "${f}"
                        else
                                insinto /opt/cuda/sdk/"${t}"
                                doins "${f}"
                        fi
                done < <(find . -type f -print0)
        eend
}


nvidia-cuda-toolkit-9.0.176.ebuild:
Code:
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit check-reqs cuda toolchain-funcs unpacker versionator

MYD=$(get_version_component_range 1-2)
DRIVER_PV="384.81"

DESCRIPTION="NVIDIA CUDA Toolkit (compiler and friends)"
HOMEPAGE="https://developer.nvidia.com/cuda-zone"
SRC_URI="https://developer.nvidia.com/compute/cuda/${MYD}/Prod/local_installers/cuda_${PV}_${DRIVER_PV}_linux-run -> cuda_${PV}_${DRIVER_PV}_linux.run"
SLOT="0/${PV}"
LICENSE="NVIDIA-CUDA"
KEYWORDS="-* ~amd64 ~amd64-linux"
IUSE="debugger doc eclipse profiler"

DEPEND=""
RDEPEND="${DEPEND}
        >=sys-devel/gcc-4.7[cxx]
        <sys-devel/gcc-6[cxx]
        >=x11-drivers/nvidia-drivers-375.26[X,uvm]
        debugger? (
                sys-libs/libtermcap-compat
                sys-libs/ncurses:5/5[tinfo]
                )
        eclipse? ( >=virtual/jre-1.6 )
        profiler? ( >=virtual/jre-1.6 )"

S="${WORKDIR}"

QA_PREBUILT="opt/cuda/*"

CHECKREQS_DISK_BUILD="3500M"

pkg_setup() {
        # We don't like to run cuda_pkg_setup as it depends on us
        check-reqs_pkg_setup
}

src_unpack() {
        unpacker
        unpacker run_files/cuda-linux*.run
}

src_prepare() {
        local cuda_supported_gcc

        cuda_supported_gcc="4.7 4.8 4.9 5.3 5.4 6.3"

        sed \
                -e "s:CUDA_SUPPORTED_GCC:${cuda_supported_gcc}:g" \
                "${FILESDIR}"/cuda-config.in > "${T}"/cuda-config || die

        default
}

src_install() {
        local i remove=( doc jre run_files install-linux.pl cuda-installer.pl )
        local cudadir=/opt/cuda
        local ecudadir="${EPREFIX}${cudadir}"

        if use doc; then
                DOCS+=( doc/pdf/. )
                HTML_DOCS+=( doc/html/. )
        fi
        einstalldocs

        mv doc/man/man3/{,cuda-}deprecated.3 || die
        doman doc/man/man*/*

        use debugger || remove+=( bin/cuda-gdb extras/Debugger extras/cuda-gdb-${PV}.src.tar.gz )

        if use profiler; then
                # hack found in install-linux.pl
                for i in nvvp nsight; do
                        cat > bin/${i} <<- EOF || die
                                #!/usr/bin/env sh
                                LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:${ecudadir}/lib:${ecudadir}/lib64 \
                                        UBUNTU_MENUPROXY=0 LIBOVERLAY_SCROLLBAR=0 \
                                        ${ecudadir}/lib${i}/${i} -vm ${EPREFIX}/usr/bin/java
                        EOF
                        chmod a+x bin/${i} || die
                done
        else
                use eclipse || remove+=( libnvvp libnsight )
                remove+=( extras/CUPTI )
        fi

        for i in "${remove[@]}"; do
                ebegin "Cleaning ${i}..."
                rm -rf "${i}" || die
                eend
        done

        dodir ${cudadir}
        mv * "${ED%/}${cudadir}" || die

        cat > "${T}"/99cuda <<- EOF || die
                PATH=${ecudadir}/bin$(usex profiler ":${ecudadir}/libnvvp" "")
                ROOTPATH=${ecudadir}/bin
                LDPATH=${ecudadir}/lib64:${ecudadir}/lib:${ecudadir}/nvvm/lib64
        EOF
        doenvd "${T}"/99cuda

        use profiler && \
                make_wrapper nvprof "${ecudadir}/bin/nvprof" "." "${ecudadir}/lib64:${ecudadir}/lib"

        dobin "${T}"/cuda-config
}

pkg_postinst_check() {
        local a b
        a="$(version_sort $(cuda-config -s))"; a=( $a )
        # greatest supported version
        b="${a[${#a[@]}-1]}"

        # if gcc and if not gcc-version is at least greatest supported
        if tc-is-gcc && \
                ! version_is_at_least gcc-version ${b}; then
                        ewarn ""
                        ewarn "gcc >= ${b} will not work with CUDA"
                        ewarn "Make sure you set an earlier version of gcc with gcc-config"
                        ewarn "or append --compiler-bindir= pointing to a gcc bindir like"
                        ewarn "--compiler-bindir=${EPREFIX}/usr/*pc-linux-gnu/gcc-bin/gcc${b}"
                        ewarn "to the nvcc compiler flags"
                        ewarn ""
        fi
}

pkg_postinst() {
        if [[ ${MERGE_TYPE} != binary ]]; then
                pkg_postinst_check
        fi
}

_________________
Some day there will only be free software.
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20053

PostPosted: Sun Oct 22, 2017 8:49 pm    Post subject: Reply with quote

Moved from Installing Gentoo to Unsupported Software since this has nothing to do with Installing Gentoo, and version 9 isn't in the Portage tree.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
russK
l33t
l33t


Joined: 27 Jun 2006
Posts: 665

PostPosted: Mon Oct 23, 2017 1:14 am    Post subject: Reply with quote

Thanks for the ebuild.

Does this merit a bump request in bugzilla? : https://wiki.gentoo.org/wiki/Bugzilla/Bug_report_guide#Report_a_version_bump.3B_a_newer_upstream_release_is_available_since_a_while
You could attach your ebuild.

Regards
Back to top
View user's profile Send private message
neveroldmilk
n00b
n00b


Joined: 24 Feb 2018
Posts: 1

PostPosted: Sat Feb 24, 2018 2:56 am    Post subject: Reply with quote

Awesome, have anyone tried to build CUDA 9.1 and cuDnn 7.0.5?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum