From 72ce0aa8094919a7a1e229bd4306dab27007fc38 Mon Sep 17 00:00:00 2001 From: Carl Pearson Date: Tue, 24 Mar 2020 18:25:36 -0500 Subject: [PATCH] first commit --- .travis.yml | 13 +++++++++++++ README.md | 38 ++++++++++++++++++++++++++++++++++++++ ci/build.sh | 29 +++++++++++++++++++++++++++++ ci/install_deps.sh | 13 +++++++++++++ docker/amd64.dockerfile | 26 ++++++++++++++++++++++++++ docker/ppc64le.dockerfile | 26 ++++++++++++++++++++++++++ docker/test.cu | 11 +++++++++++ 7 files changed, 156 insertions(+) create mode 100644 .travis.yml create mode 100644 README.md create mode 100755 ci/build.sh create mode 100755 ci/install_deps.sh create mode 100644 docker/amd64.dockerfile create mode 100644 docker/ppc64le.dockerfile create mode 100644 docker/test.cu diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..7d20449 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,13 @@ +dist: bionic +language: minimal +arch: + - ppc64le + - amd64 + +docker: true + +before_script: + - ci/install_deps.sh || travis_terminate 1; + +script: + - ci/build.sh || travis_terminate 1; diff --git a/README.md b/README.md new file mode 100644 index 0000000..54acd13 --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +# Nvidia Performance Tools + +## Docker images with Nvidia's Performance Tools + +[cwpearson/nvidia-performance-tools on Docker Hub](https://hub.docker.com/repository/docker/cwpearson/nvidia-performance-tools). + +```bash +docker pull cwpearson/nvidia-performance-tools/latest-amd64 +docker pull cwpearson/nvidia-performance-tools/latest-ppc64le +``` + +## Presentations + +[ECE 408 Spring 2020 - Introduction to Nvidia Performance Tools](https://docs.google.com/presentation/d/1A5i3Zdh7ltOLdW7qHZ2tviXYcyl1sKvM7kRpnzOD7tQ/edit?usp=sharing) + +## Nsight Compute + +```bash +nv-nsight-cu-cli a.out +nv-nsight-cu-cli --csv a.out + +``` + +## Nsight Systems + +```bash +nsys profile a.out +``` + + +## Managing docker images + +* `docker ps -a` +* `docker rm `docker ps -a -q`` + +## Resources + +* [Using Nvidia Nsight Systems in Containers and the Cloud](https://devblogs.nvidia.com/nvidia-nsight-systems-containers-cloud/) \ No newline at end of file diff --git a/ci/build.sh b/ci/build.sh new file mode 100755 index 0000000..4356bf1 --- /dev/null +++ b/ci/build.sh @@ -0,0 +1,29 @@ +set -x + +set -e + +cd docker +ls -halt + +echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin + +TRAVIS_COMMIT=${TRAVIS_COMMIT:0:7} +DOCKER_REPO=nvidia-performance-tools +DOCKER_SLUG=$DOCKER_USER/$DOCKER_REPO +DOCKER_TAG=$TRAVIS_CPU_ARCH-10.2-$TRAVIS_BRANCH-$TRAVIS_COMMIT + + +docker build -f $TRAVIS_CPU_ARCH.dockerfile -t $DOCKER_SLUG:$DOCKER_TAG . +docker push $DOCKER_SLUG:$DOCKER_TAG + + +if [[ $TRAVIS_BRANCH == master ]]; then + docker tag $DOCKER_SLUG:$DOCKER_TAG $DOCKER_SLUG:latest-$TRAVIS_CPU_ARCH + docker push $DOCKER_SLUG:latest-$TRAVIS_CPU_ARCH +else + docker tag $DOCKER_SLUG:$DOCKER_TAG $DOCKER_SLUG:$TRAVIS_BRANCH-$TRAVIS_CPU_ARCH + docker push $DOCKER_SLUG:$TRAVIS_BRANCH-$TRAVIS_CPU_ARCH +fi + +# remove the login key from the image +rm -fv $HOME/.docker/config.json diff --git a/ci/install_deps.sh b/ci/install_deps.sh new file mode 100755 index 0000000..e3b8f47 --- /dev/null +++ b/ci/install_deps.sh @@ -0,0 +1,13 @@ +set -x +set -e + +sudo apt-get update +sudo apt-get install -q -y wget + +if [[ $TRAVIS_CPU_ARCH == ppc64le ]]; then + wget -qSL https://uofi.box.com/shared/static/vfxflckdjixxkc524qltme4sx8kt3w9d.deb -O docker/NVIDIA_Nsight_Systems_Power_CLI_Only_2020.2.1.71.deb; + wget -qSL https://uofi.box.com/shared/static/swjp2bjr7xj153vzw8mvutv2tqomypxu.run -O docker/nsight-compute-PPC64LE-2019.5.0.14-27346997.run; +elif [[ $TRAVIS_CPU_ARCH == amd64 ]]; then + wget -qSL https://uofi.box.com/shared/static/zjsv2rayiotyrdix6a6yd3w8cre56lo0.deb -O docker/NVIDIA_Nsight_Systems_Linux_2020.2.1.71.deb; + wget -qSL https://uofi.box.com/shared/static/4fuf3wws1uplhf29ndcq4s91kl3jyl7z.run -O docker/nsight-compute-linux-2019.5.0.14-27346997.run; +fi \ No newline at end of file diff --git a/docker/amd64.dockerfile b/docker/amd64.dockerfile new file mode 100644 index 0000000..4e8b2dc --- /dev/null +++ b/docker/amd64.dockerfile @@ -0,0 +1,26 @@ +FROM nvidia/cuda:10.2-devel-ubuntu18.04 + +# Set one or more individual labels +LABEL maintainer="Carl Pearson" + +# prevent prompts during apt-get +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update +RUN apt-get install -y -q --no-install-recommends --no-install-suggests \ + cmake \ + libglib2.0 \ + && rm -rf /var/lib/apt/lists/* + +COPY test.cu . +COPY nsight-compute-linux-2019.5.0.14-27346997.run nsight_compute.run +COPY NVIDIA_Nsight_Systems_Linux_2020.2.1.71.deb nsight_systems.deb + +# install Nsight Compute +# install script seems to want TERM set +RUN chmod +x nsight_compute.run +RUN TERM=xterm ./nsight_compute.run --quiet -- -noprompt -targetpath=/usr/local/NVIDIA-Nsight-Compute +ENV PATH=$PATH:/usr/local/NVIDIA-Nsight-Compute + +# install Nsight Systems +RUN dpkg -i nsight_systems.deb diff --git a/docker/ppc64le.dockerfile b/docker/ppc64le.dockerfile new file mode 100644 index 0000000..136002b --- /dev/null +++ b/docker/ppc64le.dockerfile @@ -0,0 +1,26 @@ +FROM nvidia/cuda-ppc64le:10.2-devel-ubuntu18.04 + +# Set one or more individual labels +LABEL maintainer="Carl Pearson" + +# prevent prompts during apt-get +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update +RUN apt-get install -y -q --no-install-recommends --no-install-suggests \ + cmake \ + libglib2.0 \ + && rm -rf /var/lib/apt/lists/* + +COPY test.cu . +COPY nsight-compute-PPC64LE-2019.5.0.14-27346997.run nsight_compute.run +COPY NVIDIA_Nsight_Systems_Power_CLI_Only_2020.2.1.71.deb nsight_systems.deb + +# install Nsight Compute +# install script seems to want TERM set +RUN chmod +x nsight_compute.run +RUN TERM=xterm ./nsight_compute.run --quiet -- -noprompt -targetpath=/usr/local/NVIDIA-Nsight-Compute +ENV PATH=$PATH:/usr/local/NVIDIA-Nsight-Compute + +# install Nsight Systems +RUN dpkg -i nsight_systems.deb diff --git a/docker/test.cu b/docker/test.cu new file mode 100644 index 0000000..0844a83 --- /dev/null +++ b/docker/test.cu @@ -0,0 +1,11 @@ +__global__ void kernel(float *a, float *b, int n) { + *a = *b; +} + +int main(void) { + float *a, *b; + cudaMalloc(&a, 10 * sizeof(float)); + cudaMalloc(&b, 10 * sizeof(float)); + kernel<<<1,1>>>(a,b,10); + cudaDeviceSynchronize(); +} \ No newline at end of file