Created
May 7, 2025 09:44
-
-
Save jacobtomlinson/e543eb40b7694d20e009798f011df6c4 to your computer and use it in GitHub Desktop.
Notebook to test cupy, cudf and cuml imports work and can exercise the GPU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", | |
| "execution_count": 0, | |
| "metadata": { | |
| "application/vnd.databricks.v1+cell": { | |
| "cellMetadata": { | |
| "byteLimit": 2048000, | |
| "rowLimit": 10000 | |
| }, | |
| "inputWidgets": {}, | |
| "nuid": "13b699d1-8d9d-4469-bb1a-ed3f4e572387", | |
| "showTitle": false, | |
| "tableResultSettingsMap": {}, | |
| "title": "" | |
| } | |
| }, | |
| "outputs": [], | |
| "source": [ | |
| "import sklearn\n", | |
| "sklearn.__version__" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 0, | |
| "metadata": { | |
| "application/vnd.databricks.v1+cell": { | |
| "cellMetadata": { | |
| "byteLimit": 2048000, | |
| "rowLimit": 10000 | |
| }, | |
| "inputWidgets": {}, | |
| "nuid": "9d1deedc-ed6e-46a8-b2a1-7eb585441132", | |
| "showTitle": false, | |
| "tableResultSettingsMap": {}, | |
| "title": "" | |
| } | |
| }, | |
| "outputs": [], | |
| "source": [ | |
| "import cudf\n", | |
| "\n", | |
| "gdf = cudf.DataFrame({\"a\":[1,2,3],\"b\":[4,5,6]})\n", | |
| "gdf" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 0, | |
| "metadata": { | |
| "application/vnd.databricks.v1+cell": { | |
| "cellMetadata": { | |
| "byteLimit": 2048000, | |
| "rowLimit": 10000 | |
| }, | |
| "inputWidgets": {}, | |
| "nuid": "945b4075-2d91-4a00-82cf-b44c6a170f66", | |
| "showTitle": false, | |
| "tableResultSettingsMap": {}, | |
| "title": "" | |
| } | |
| }, | |
| "outputs": [], | |
| "source": [ | |
| "import cuml\n", | |
| "cuml.__version__" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 0, | |
| "metadata": { | |
| "application/vnd.databricks.v1+cell": { | |
| "cellMetadata": { | |
| "byteLimit": 2048000, | |
| "rowLimit": 10000 | |
| }, | |
| "inputWidgets": {}, | |
| "nuid": "44274d54-8c29-419a-b985-d67a8d749aff", | |
| "showTitle": false, | |
| "tableResultSettingsMap": {}, | |
| "title": "" | |
| } | |
| }, | |
| "outputs": [], | |
| "source": [ | |
| "import cuml\n", | |
| "import cupy as cp\n", | |
| "from cuml.linear_model import LinearRegression\n", | |
| "\n", | |
| "# Create some simple data on the GPU\n", | |
| "X = cp.array([[1], [2], [3], [4], [5]], dtype=cp.float32)\n", | |
| "y = cp.array([2, 4, 6, 8, 10], dtype=cp.float32) # y = 2 * x\n", | |
| "\n", | |
| "# Fit a linear regression model\n", | |
| "model = LinearRegression()\n", | |
| "model.fit(X, y)\n", | |
| "\n", | |
| "# Predict\n", | |
| "preds = model.predict(X)\n", | |
| "\n", | |
| "print(\"Predictions:\", preds)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 0, | |
| "metadata": { | |
| "application/vnd.databricks.v1+cell": { | |
| "cellMetadata": { | |
| "byteLimit": 2048000, | |
| "rowLimit": 10000 | |
| }, | |
| "inputWidgets": {}, | |
| "nuid": "0337a580-fd0f-4b15-8767-d469eb36dde8", | |
| "showTitle": false, | |
| "tableResultSettingsMap": {}, | |
| "title": "" | |
| } | |
| }, | |
| "outputs": [], | |
| "source": [] | |
| } | |
| ], | |
| "metadata": { | |
| "application/vnd.databricks.v1+notebook": { | |
| "computePreferences": null, | |
| "dashboards": [], | |
| "environmentMetadata": { | |
| "base_environment": "", | |
| "environment_version": "2" | |
| }, | |
| "inputWidgetPreferences": null, | |
| "language": "python", | |
| "notebookMetadata": { | |
| "pythonIndentUnit": 2 | |
| }, | |
| "notebookName": "cuML Verification", | |
| "widgets": {} | |
| }, | |
| "language_info": { | |
| "name": "python" | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 0 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment