diff --git a/insmod_root.sh b/insmod_root.sh new file mode 100755 index 00000000..6f8d32b8 --- /dev/null +++ b/insmod_root.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. + +THIS_DIR=$(dirname $0) + +# remove driver +grep gdrdrv /proc/devices >/dev/null && /sbin/rmmod gdrdrv + +# insert driver +/sbin/insmod gdrdrv/gdrdrv.ko dbg_enabled=0 info_enabled=0 + +# create device inodes +major=`fgrep gdrdrv /proc/devices | cut -b 1-4` +echo "INFO: driver major is $major" + +# remove old inodes just in case +if [ -e /dev/gdrdrv ]; then + rm /dev/gdrdrv +fi + +echo "INFO: creating /dev/gdrdrv inode" +mknod /dev/gdrdrv c $major 0 +chmod a+w+r /dev/gdrdrv diff --git a/install_gdrcopy.sh b/install_gdrcopy.sh new file mode 100755 index 00000000..0de3635a --- /dev/null +++ b/install_gdrcopy.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +#git clone -b master https://github.com/NVIDIA/gdrcopy.git /tmp/gdrcopy +cd /tmp/gdrcopy/ +mkdir prefix +make PREFIX=./prefix/ CUDA=/usr/local/cuda/ all install + +echo "### Run insmod.sh ###" +apt-get update && apt-get install -y kmod +./insmod_root.sh + +echo "### lsmod ###" +lsmod |grep "gdr" + +echo "### validate ###" +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-9.2/lib64/:$PWD/prefix/lib64 +./validate + +echo "### copybw ###" +./copybw diff --git a/test_docker.sh b/test_docker.sh new file mode 100755 index 00000000..f57a7b0e --- /dev/null +++ b/test_docker.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +#nvidia-docker run -ti --privileged --cap-add=ALL -v /lib/modules:/lib/modules -v /usr/src:/usr/src -v $PWD/:/tmp/gdrcopy nvidia/cuda:11.0-devel-ubuntu16.04 bash +nvidia-docker run -ti --privileged --cap-add=ALL -v /lib/modules:/lib/modules -v /usr/src:/usr/src -v $PWD/:/tmp/gdrcopy nvidia/cuda:9.2-devel-ubuntu16.04 /tmp/gdrcopy/install_gdrcopy.sh