Anaconda Enterprise: Documentation

# 3.5. Supported Python features in CUDA Python

This page lists the Python features supported in the CUDA Python. This includes all kernel and device functions compiled with `@cuda.jit` and other higher level Numba decorators that targets the CUDA GPU.

## 3.5.1. Language

### 3.5.1.1. Execution Model

CUDA Python maps directly to the single-instruction multiple-thread execution (SIMT) model of CUDA. Each instruction is implicitly executed by multiple threads in parallel. With this execution model, array expressions are less useful because we don’t want multiple threads to perform the same task. Instead, we want threads to perform a task in a cooperative fashion.

For details please consult the CUDA Programming Guide.

### 3.5.1.2. Constructs

The following Python constructs are not supported:

- Exception handling (`try .. except`, `try .. finally`)
- Context management (the `with` statement)
- Comprehensions (either list, dict, set or generator comprehensions)
- Generator (any `yield` statements)

The `raise` and `assert` statements are supported. See nopython language support.

## 3.5.2. Built-in types

The following built-in types support are inherited from CPU nopython mode.

- int
- float
- complex
- bool
- None
- tuple

See nopython built-in types.

## 3.5.3. Built-in functions

The following built-in functions are supported:

- `abs()`
- `bool`
- `complex`
- `enumerate()`
- `float`
- `int`: only the one-argument form
- `len()`
- `min()`: only the multiple-argument form
- `max()`: only the multiple-argument form
- `range`: semantics are similar to those of Python 3 even in Python 2: a range object is returned instead of an array of values.
- `round()`
- `zip()`

## 3.5.4. Standard library modules

### 3.5.4.1. `cmath`

The following functions from the `cmath` module are supported:

- `cmath.acos()`
- `cmath.acosh()`
- `cmath.asin()`
- `cmath.asinh()`
- `cmath.atan()`
- `cmath.atanh()`
- `cmath.cos()`
- `cmath.cosh()`
- `cmath.exp()`
- `cmath.isfinite()`
- `cmath.isinf()`
- `cmath.isnan()`
- `cmath.log()`
- `cmath.log10()`
- `cmath.phase()`
- `cmath.polar()`
- `cmath.rect()`
- `cmath.sin()`
- `cmath.sinh()`
- `cmath.sqrt()`
- `cmath.tan()`
- `cmath.tanh()`

### 3.5.4.2. `math`

The following functions from the `math` module are supported:

- `math.acos()`
- `math.asin()`
- `math.atan()`
- `math.arctan()`
- `math.acosh()`
- `math.asinh()`
- `math.atanh()`
- `math.cos()`
- `math.sin()`
- `math.tan()`
- `math.hypot()`
- `math.cosh()`
- `math.sinh()`
- `math.tanh()`
- `math.atan2()`
- `math.erf()`
- `math.erfc()`
- `math.exp()`
- `math.expm1()`
- `math.fabs()`
- `math.gamma()`
- `math.lgamma()`
- `math.log()`
- `math.log10()`
- `math.log1p()`
- `math.sqrt()`
- `math.pow()`
- `math.ceil()`
- `math.floor()`
- `math.copysign()`
- `math.fmod()`
- `math.isnan()`
- `math.isinf()`

### 3.5.4.3. `operator`

The following functions from the `operator` module are supported:

- `operator.add()`
- `operator.and_()`
- `operator.div()` (Python 2 only)
- `operator.eq()`
- `operator.floordiv()`
- `operator.ge()`
- `operator.gt()`
- `operator.iadd()`
- `operator.iand()`
- `operator.idiv()` (Python 2 only)
- `operator.ifloordiv()`
- `operator.ilshift()`
- `operator.imod()`
- `operator.imul()`
- `operator.invert()`
- `operator.ior()`
- `operator.ipow()`
- `operator.irshift()`
- `operator.isub()`
- `operator.itruediv()`
- `operator.ixor()`
- `operator.le()`
- `operator.lshift()`
- `operator.lt()`
- `operator.mod()`
- `operator.mul()`
- `operator.ne()`
- `operator.neg()`
- `operator.not_()`
- `operator.or_()`
- `operator.pos()`
- `operator.pow()`
- `operator.rshift()`
- `operator.sub()`
- `operator.truediv()`
- `operator.xor()`