FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
arrayfire-python/arrayfire/__init__.py at master · arrayfire/arrayfire-python · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
arrayfire
/
arrayfire-python
Public
Notifications
You must be signed in to change notification settings
Fork
64
Star
422
Code
Issues
57
Pull requests
3
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
arrayfire-python
/
arrayfire
/
__init__.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
86 lines (70 loc) · 2.23 KB
Breadcrumbs
arrayfire-python
/
arrayfire
/
__init__.py
Copy path
File metadata and controls
86 lines (70 loc) · 2.23 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#######################################################
# Copyright (c) 2015, ArrayFire
# All rights reserved.
#
# This file is distributed under 3-clause BSD license.
# The complete license agreement can be obtained at:
# http://arrayfire.com/licenses/BSD-3-Clause
########################################################
"""
ArrayFire is a high performance scientific computing library with an easy to use API.
>>> # Monte Carlo estimation of pi
>>> def calc_pi_device(samples):
# Simple, array based API
# Generate uniformly distributed random numers
x = af.randu(samples)
y = af.randu(samples)
# Supports Just In Time Compilation
# The following line generates a single kernel
within_unit_circle = (x * x + y * y) < 1
# Intuitive function names
return 4 * af.count(within_unit_circle) / samples
Programs written using ArrayFire are portable across CUDA, OpenCL and CPU devices.
The default backend is chosen in the following order of preference based on the available libraries:
1. CUDA
2. OpenCL
3. CPU
The backend can be chosen at the beginning of the program by using the following function
>>> af.set_backend(name)
where name is one of 'cuda', 'opencl' or 'cpu'.
The functionality provided by ArrayFire spans the following domains:
1. Vector Algorithms
2. Image Processing
3. Signal Processing
4. Computer Vision
5. Linear Algebra
6. Statistics
"""
try
:
import
pycuda
.
autoinit
except
ImportError
:
pass
from
.
library
import
*
from
.
array
import
*
from
.
data
import
*
from
.
util
import
*
from
.
algorithm
import
*
from
.
device
import
*
from
.
blas
import
*
from
.
arith
import
*
from
.
statistics
import
*
from
.
lapack
import
*
from
.
signal
import
*
from
.
image
import
*
from
.
features
import
*
from
.
vision
import
*
from
.
graphics
import
*
from
.
bcast
import
*
from
.
index
import
*
from
.
interop
import
*
from
.
timer
import
*
from
.
random
import
*
from
.
sparse
import
*
from
.
ml
import
*
# do not export default modules as part of arrayfire
del
ct
del
inspect
del
numbers
del
os
if
(
AF_NUMPY_FOUND
):
del
np
Back
|
FazBrowse Home
|
New Git URL