BobMcDear / neural-network-cuda

Neural network from scratch in CUDA/C++
GNU General Public License v3.0
68 stars 14 forks source link
cplusplus cuda deep-learning machine-learning neural-network

Neural network in CUDA/C++

Description
Usage

Description

This is an implementation of a neural net, completely from scratch, in CUDA/C++.

Usage

The code is by no means efficient and is meant as an introduction to CUDA only. Here is an overview of the various classes and functions:

Everything is implemented in both pure C++ (under CPU/) and CUDA/C++ (under GPU/). The syntax remains virtually identical, and there are only two points to bear in mind when switching between C++ and CUDA/C++:

  1. C++ and CUDA/C++ modules end with the suffixes CPU and GPU respectively.
  2. Don't forget to allocate and destroy CUDA arrays via cudaMallocManaged and cudaFree

For end-to-end training with speed benchmarks, please run main.cpp or main.cu for the CPU and GPU respectively.