Skip to main content

Jupyter notebook plugin to run CUDA C/C++ code

Project description

nvcc4jupyter: CUDA C++ plugin for Jupyter Notebook

Testing Python Versions CI - Test Coverage
Code Quality Code style: black security: bandit
Package PyPI Latest Release PyPI Downloads

nvcc4jupyter is a Jupyter Notebook plugin that provides cell and line magics to allow running CUDA C++ code from a notebook. This is especially useful when combined with a hosted service such a Google's Colab which provide CUDA capable GPUs and you can start learning CUDA C++ without having to install anything or even to own a GPU yourself.

Table of Contents

Main Features

Here are just a few of the things that nvcc4jupyter does well:

Install

The installer for the latest released version is available at the Python Package Index (PyPI).

pip install nvcc4jupyter

Usage

First, load the extension to enable the magic commands:

%load_ext nvcc4jupyter

Running a quick CUDA Hello World program:

%%cuda
#include <stdio.h>

__global__ void hello(){
    printf("Hello from block: %u, thread: %u\n", blockIdx.x, threadIdx.x);
}

int main(){
    hello<<<2, 2>>>();
    cudaDeviceSynchronize();
}

For more advanced use cases, see the documentation.

Documentation

The official documentation is hosted on readthedocs.

License

MIT

Contributing

The recommended setup for development is using the devcontainer in GitHub Codespaces or locally in VSCode.

If not using the devcontainer you need to install the package with the development dependencies and install the pre-commit hook before commiting any changes:

pip install -e .[dev]
pre-commit install

Go to Top

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nvcc4jupyter-1.2.1.tar.gz (24.6 kB view details)

Uploaded Source

Built Distribution

nvcc4jupyter-1.2.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file nvcc4jupyter-1.2.1.tar.gz.

File metadata

  • Download URL: nvcc4jupyter-1.2.1.tar.gz
  • Upload date:
  • Size: 24.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for nvcc4jupyter-1.2.1.tar.gz
Algorithm Hash digest
SHA256 6a21c0607f239ec73df1ec99ac7f5f48f5d422a2a18ae16a22fd0172e9ffa5f8
MD5 6ff10e02b31a89ee96001dd32a99701c
BLAKE2b-256 f7383c5bfd392bc3fd2d1c3e2ac44817af9bc5d79db0b0ec64f8f79a7ae4455d

See more details on using hashes here.

File details

Details for the file nvcc4jupyter-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: nvcc4jupyter-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for nvcc4jupyter-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4bbc71ae6f58940e713435e47d01f445cd32bbd97f6535216d51b147c07d7d08
MD5 483cd7a6c7c75ae51fd02d905bea47ac
BLAKE2b-256 7d404bb924b0cd9bafea611d4dd36ca383f43a889eb8c5b27df88147152817ca

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page