=========
Python cffi CUDA bindings and helper classes.
Tested with Python 2.7, Python 3.6 and PyPy on Linux with CUDA 8.0.
To compile kernel code written in C++, nvcc should be in PATH and
exported functions should be marked as extern "C"
(for Windows, cl.exe should be in PATH also).
Functions in plain PTX can be used without nvcc.
To use CUBLAS, libcublas.so (cublas64_65.dll) should be present.
To use CUDNN, libcudnn.so (cudnn64_65.dll) should be present.
To use CUFFT, libcufft.so (cufft64_65.dll) should be present.
To use CURAND, libcurand.so (curand64_65.dll) should be present.
Not all CUDA api is currently covered.
To install the module run:
```bash
python setup.py install
```
or just copy src/cuda4py to any place where python
interpreter will be able to find it.
To run the tests, execute:
for Python 2.7:
```bash
PYTHONPATH=src nosetests -w tests
```
for Python 3.4:
```bash
PYTHONPATH=src nosetests3 -w tests
```
for PyPy:
```bash
PYTHONPATH=src pypy -m nose -w tests
```
Example usage:
```python
import cuda4py as cu
import logging
import numpy
if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG)
ctx = cu.Devices().create_some_context()
module = cu.Module(
ctx, source=
"""
extern "C"
__global__ void test(const float *a, const float *b,
float *c, const float k) {
size_t i = blockDim.x * blockIdx.x + threadIdx.x;
c[i] = (a[i] + b[i]) * k;
}
""")
test = cu.Function(module, "test")
a = numpy.arange(1000000, dtype=numpy.float32)
b = numpy.arange(1000000, dtype=numpy.float32)
c = numpy.empty(1000000, dtype=numpy.float32)
k = numpy.array([0.5], dtype=numpy.float32)
a_buf = cu.MemAlloc(ctx, a)
b_buf = cu.MemAlloc(ctx, b)
c_buf = cu.MemAlloc(ctx, c)
test.set_args(a_buf, b_buf, c_buf, k)
test((a.size, 1, 1))
c_buf.to_host(c)
max_diff = numpy.fabs(c - (a + b) * k[0]).max()
logging.info("max_diff = %.6f", max_diff)
```
Released under Simplified BSD License.
Copyright (c) 2014, Samsung Electronics Co.,Ltd.
Metadata
Release files for cuda4py 1.4.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cuda4py-1.4.4.tar.gz | 58.3 kB | Without provenance | Details for cuda4py-1.4.4.tar.gz |
Release files / cuda4py-1.4.4.tar.gz
| Download URL | cuda4py-1.4.4.tar.gz |
|---|---|
| Size | 58.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ae776d278349f9bfdf28c495ad0ed62101f9ad25355f8009c922677aabd0c66
|
|
BLAKE2b-256 checksum How to use checksums |
6bb44b9d59fd81a743bf44e698d5306212a8bb8b746e98937fab6b5b7ea92aef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for cuda4py 1.4.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.