From 821d59d6d8b593f32242b9b87419a595d69f8dbf Mon Sep 17 00:00:00 2001 From: Gaurav Tarlok Kakkar Date: Mon, 7 Nov 2022 11:16:59 -0500 Subject: [PATCH] feat: GPU jenkins support (#476) * feat: GPU jenkins support * Update jenkins.Dockerfile Updated Dockerfile --- Jenkinsfile | 46 +++++++++++++++++++++++++----------- docker/jenkins.Dockerfile | 49 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 13 deletions(-) create mode 100644 docker/jenkins.Dockerfile diff --git a/Jenkinsfile b/Jenkinsfile index 600f75b8b8..46a76ffe5d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,44 +1,64 @@ pipeline { agent { - dockerfile { - filename 'docker/eva_jenkins.Dockerfile' + dockerfile { + filename 'docker/jenkins.Dockerfile' + args '--gpus all' + } } - + + options{ + buildDiscarder(logRotator(numToKeepStr: '8', daysToKeepStr: '20')) } + + stages { + stage('Setup and Install Packages') { parallel { stage('Setup Virtual Environment') { + steps { sh '''python3 -m venv env37 -. env37/bin/activate -pip install --upgrade pip -pip install scikit-build -pip install cython -pip install -e ."[dev]"''' + . env37/bin/activate + pip install --upgrade pip + pip install scikit-build + pip install cython + pip install -e ."[dev]" + ''' } } - stage('Generate Parser Files') { + steps { sh 'sh script/antlr4/generate_parser.sh' } } + } + } + stage('CUDA GPU Check') { + + steps { + sh '''. env37/bin/activate + python3 -c "import torch; torch.cuda.current_device()" + ''' } } stage('Run Tests') { + steps { sh '''. env37/bin/activate -sh script/test/test.sh''' - } - } + sh script/test/test.sh + ''' + } + } stage('Coverage Check') { + steps { sh '''. env37/bin/activate -coveralls''' + coveralls''' } } } diff --git a/docker/jenkins.Dockerfile b/docker/jenkins.Dockerfile new file mode 100644 index 0000000000..c6ef7c206e --- /dev/null +++ b/docker/jenkins.Dockerfile @@ -0,0 +1,49 @@ +# https://www.jenkins.io/doc/book/installing/docker/ - Follow these steps for starting jenkins. +FROM nvidia/cuda:11.6.2-cudnn8-runtime-ubuntu20.04 + +# Docker image specific installation +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y \ + python3-numpy \ + python3-pip \ + python3-pytest \ + python3-pytest-cov \ + python3-venv \ + python3-yaml \ + ffmpeg \ + && \ + apt-get autoremove --purge -y && \ + apt-get autoclean -y && \ + rm -rf /var/cache/apt/* /var/lib/apt/lists/* + +# OpenCV Specific Installation +RUN apt-get -qq update && \ + apt-get -qq install -y --no-install-recommends \ + build-essential \ + cmake \ + git \ + wget \ + unzip \ + yasm \ + pkg-config \ + ffmpeg \ + libsm6 \ + libxext6 \ + libswscale-dev \ + libtbb2 \ + libtbb-dev \ + libjpeg-dev \ + libpng-dev \ + libtiff-dev \ + libopenjp2-7-dev \ + libavformat-dev \ + libpq-dev \ + python3-dev \ + sudo \ + openjdk-11-jdk \ + openjdk-11-jre + +# Give Permission To Home Directory To Create EVA +RUN mkdir /.eva && chmod -R 777 /.eva +RUN mkdir /.cache && chmod -R 777 /.cache +RUN mkdir /.EasyOCR && chmod -R 777 /.EasyOCR