Fortran and Neural Networks

The way I understand it a Fortran NN library supporting GPU’s would simply provide an interface to specialized hardware primitives like cuDNN, the Intel® oneAPI Deep Neural Network Library, or AMD’s ROCm and not necessarily re-implement the algorithms itself.

From the cuDNN page:

Deep learning researchers and framework developers worldwide rely on cuDNN for high-performance GPU acceleration. It allows them to focus on training neural networks and developing software applications rather than spending time on low-level GPU performance tuning. cuDNN accelerates widely used deep learning frameworks, including Caffe2, Chainer, Keras, MATLAB, MxNet, PaddlePaddle, PyTorch, and TensorFlow.

If you look at PyTorch (pytorch.org) they support 4 different compute platforms:

With Fortran you would just need to put the code calling the accelerator primitives into different submodules. If you swap from one backend to second one, you just need to relink your application.

6 Likes