• Anaconda Platform
  • – Welcome
  • – Anaconda Distribution
  • – Anaconda Repository
  • – Anaconda Accelerate
  • – Anaconda Adam
  • – Anaconda Enterprise Notebooks
  • – Anaconda Fusion
  • – Anaconda Scale
  • – Anaconda Cloud
  • Anaconda-sponsored OSS programs
  • – Blaze
  • – Bokeh
  • – Conda
  • – dask
  • – llvmlite
  • – PhosphorJS
  • – Numba
    • 1. User Manual
    • 2. Reference Manual
    • 3. Numba for CUDA GPUs
      • 3.1. Overview
      • 3.2. Writing CUDA Kernels
      • 3.3. Memory management
      • 3.4. Writing Device Functions
      • 3.5. Supported Python features in CUDA Python
      • 3.6. Supported Atomic Operations
      • 3.7. Random Number Generation
      • 3.8. Device management
      • 3.9. The Device List
      • 3.10. Examples
      • 3.11. Debugging CUDA Python with the the CUDA Simulator
      • 3.12. GPU Reduction
      • 3.13. CUDA Ufuncs and Generalized Ufuncs
      • 3.14. Sharing CUDA Memory
      • 3.15. CUDA Frequently Asked Questions
    • 4. CUDA Python Reference
    • 5. Numba for HSA APUs
    • 6. Extending Numba
    • 7. Developer Manual
    • 8. Numba Enhancement Proposals
    • 9. Glossary
    • 10. Release Notes

3.4. Writing Device FunctionsΒΆ

CUDA device functions can only be invoked from within the device (by a kernel or another device function). To define a device function:

from numba import cuda

@cuda.jit(device=True)
def a_device_function(a, b):
    return a + b

Unlike a kernel function, a device function can return a value like normal functions.

Docs Home
Anaconda Home
More Help & Support
2017 Anaconda, Inc.
All Rights Reserved.
Privacy Policy | EULA