vulkpy is a Python package providing GPGPU computation based on Vulkan.
libvulkan
vulkan/vulkan.hpp
and so on)glslc
)On Ubuntu 22.0,
wget -qO - http://packages.lunarg.com/lunarg-signing-key-pub.asc | apt-key add -
wget -qO /etc/apt/sources.list.d/lunarg-vulkan-focal.list http://packages.lunarg.com/vulkan/lunarg-vulkan-focal.list
apt update
apt install -y libvulkan1 libvulkan-dev vulkan-headers shaderc vulkan-validationlayers
Note
vulkan-sdk
cannot be installed because it requires obsolete packageqt5-default
.
import vulkpy as vk
gpu = vk.GPU()
a = vk.Array(gpu, data=[10, 10, 10])
b = vk.Array(gpu, data=[5, 5, 5])
c = a + b
c.wait()
print(c)
# [15, 15, 15]
Array
s.
+
, -
, *
, /
, **
, +=
, -=
, *=
, /=
, **=
Array
and float
.
+
, -
, *
, /
, **
, +=
, -=
, *=
, /=
, **=
float
and Array
.
+
, -
, *
, /
, **
Array
s.
@
Array
's member function
max(other, inplace=False)
, min(other, inplace=False)
abs(inplace=False)
, sign(inplace=False)
sin(inplace=False)
, cos(inplace=False)
, tan(inplace=False)
asin(inplace=False)
, acos(inplace=False)
, atan(inplace=False)
sinh(inplace=False)
, cosh(inplace=False)
, tanh(inplace=False)
asinh(inplace=False)
, acosh(inplace=False)
, atanh(inplace=False)
exp(inplace=False)
, log(inplace=False)
exp2(inplace=False)
, log2(inplace=False)
sqrt(inplace=False)
, invsqrt(inplace=False)
clamp(min, max, inplace=False)
Array
's member function
sum(axis=None)
, prod(axis=None)
maximum(axis=None)
, minimum(axis=None)
mean(axis=None)
Array
method
gather(idx: U32Array) -> Array
broadcast_to(shape)
(used at clamp
)+
, -
, *
, /
, **
, +=
, -=
, *=
, /=
, **=
sum
, prod
, maximum
, minimum
, mean
vulkpy.random.Xoshiro128pp(gpu, *, size=None, data=None)
)[0, 1)
uniform (.random(shape=None, buffer=None)
).normal(shape=None, buffer=None, mean=0.0, stddev=1.0)
)Dense
, ReLU
, Sigmoid
, Softmax
SGD
, Adam
, AdaGrad
CrossEntropyLoss
, SoftmaxCrossEntropyLoss
, MSELoss
, HuberLoss
Constant
, HeNormal
Sequance
Lasso(coeff=1.0)
, Ridge(coeff=1.0)
, Elastic(L1=1.0, L2=1.0)
backward()
definition.