
108 Chapter 4: Challenges and Opportunities in Distributed Computing
GPU Workflow
A key concept in the GPU program is the following steps to code to the GPU from scrat.
1. Create a Vectorized Function
2. Move calculations to GPU memory
3. Calculate on the GPU
4. Move the Calculations ba to the host
Here is a contrived example below that is available in this Google Colab Notebook²⁴⁷.
1 from numba import (cuda, vectorize)
2 import pandas as pd
3 import numpy as np
4 from sklearn.preprocessing import MinMaxScaler
5 from sklearn.cluster import KMeans
6
7 from functools import wraps
8 from time import time
9
10 def real_estate_df():
11 """30 Years of Housing Prices""" ...