GithubHelp home page GithubHelp logo

gpu's Introduction

Speed Up Model Training Using GPU

Offload computation tasks to decrease train time

I have worked in the tech sector for over 20 yers. During that time, I've worn numerous hats over numerous disciplines. Recently, I decided to reboot my career from cloud infrastructure to data science. As my journey progressed and I started working with more complex models, I became bothered by the constant waiting for my models to train, or worse hypertuning, (with GridsearchSV). rewrite this and the title for speeding up GridSearch

Most advertisements referencing GPUs (or math coprocessors if you've been around that long) center around gamers. As the GPUs are for number crunching, I decided to see how to offload my cmputation intensive python functions to the GPU.

In researching, everything pouts to Nvidia and their Cuda Toolkit. I was really disappointed to read that the toolkit was only for Nvidia GPU's. I'm afraid my MacBook Pro doesn't fit that profile! Regardless, I decided to give it the old 'college hack' to see if it would work.

MacBook Pro

First, I strongly suggest that you setup a seperate environment to test this. The last thing you want to do is trash your development environment and then have to reinstall everything. I prefer to use Anaconda, so follow along to setup from the command line.

Before beginning, I would recommend that you read all release notes, installation notes, etc from Nvidia's website. I am not following the installation guide from NVIDIA's webste. And for the record, my AMD Radeon Pro 560 is not on the list of supported GPUs.

Virtual Environment

First, let's check out our current conda environment and create the new environment for testing. You may run these commands from a terminal window, or straight from a jupyter notebook.

As you can see, I have numerous environments already setup. I chose to install a new environment 'gpu-test' with python version 3.5. I've had the least amount of package compatibility errors with 3.5.

After some time, you will be presented with a list of packages that will be downloaded and installed. Type y to continue.

Once the installation is complete, activate the new environment that you just created. You should notice the promt change to gpu-test (or whatever you named your environment).

Install Required Packages

We will need to install numba in addition to NVIDIA's CUDA Toolkit. Numba is an open source JIT compiler that will translate our python functions (or jupyter cells) into code that will run fast on the GPU.

To simplify the install, I will not go to NVIDIA's site to download the software, I will use conda instead. Execute the following commands from the command line, or a jupyter notebook cell. Notice that we are also installing the required packages for our environment to run a GridSearch on a Random Forrest Classifier using scikit-learn's iris dataset.

conda install -y numpy
conda install -y pandas
conda install -y scikit-learn
conda install -y numba
conda install -y cudatoolkit
# export the environment so that they can import it

gpu's People

Contributors

kelliexmachina avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.