added notes on webgpu and cuda

master
Vladimir Mandic 2021-08-23 08:41:35 -04:00
parent 65558ea91f
commit e894eff5ae
1 changed files with 50 additions and 1 deletions

@ -1,6 +1,28 @@
# Backends
Human library includes pre-bundled `CPU`, `WASM` and `WebGL` backends, there is no need to load them externally.
For use in **Browsers**, `Human` library includes pre-bundled `CPU`, `WASM` and `WebGL` backends,
there is no need to load them externally
For use in **NodeJS**, `Human` library supports `tfjs-node` and `tfjs-node-gpu` implementations of `tensorflow` backend
which have to be loaded before `Human` library
Experimental support is added for `WebGPU` backend in **Browsers** and `WASM` backend in **NodeJS**
<br>
## Tensorflow Backend
When used in `NodeJS`, load either `tfjs-node` or `tfjs-node-gpu` modules before loading `Human` library
and set Human `config.backend` to `tensorflow`
If using `tfjs-node-gpu` module and there is no available GPU acceleratrion, backend will print warning messages
during execution and will fall back to CPU execution model instead
GPU acceleration in NodeJS is currently supported for nVidia GPU cards
For requirements and how to unable GPU acceleration using `tfjs-node-gpu` in
native **Linux**, **Windows** or **Windows WSL2** environments,
see appropriate docs on [nVidia CUDA](https://developer.nvidia.com/cuda-toolkit)
<br>
@ -9,11 +31,23 @@ Human library includes pre-bundled `CPU`, `WASM` and `WebGL` backends, there is
WebGL backend usage is fastest on systems with modern GPU
although startup speed is a bit slower
### HumanGL Backend
`Human` library includes custom version of `WebGL` backend with specific optimizations
to enable enhanced workflows and set specific WebGL options to increase warmup speed
and overal performance of the WebGL backend
*`HumanGL` is a default backend for Browser implementations*
<br>
## CPU Backend
CPU backend usage is not recommended for performance reasons
as TensorFlow implementation in JavaScript is by far the slowest
<br>
## WASM Backend
WASM backend has good resuts under specific conditions:
@ -66,6 +100,21 @@ Firefox:
<br>
## WebGPU Backend
In the long-term, `WebGPU` backend will superseed existing `WebGL` backend - it's intention is to support same workflows and features while having lower overhead while communicating with GPU
Currently, WebGPU support is only present in Canary version of [Google Chrome](https://www.google.com/chrome/canary/)
And must be explicitly enabled via `--enable-unsafe-gpu` flag
Due to it's experimental nature `WebGPU` module is not bundled with `Human` and instead it has to be manually loaded
After `WebGPU` has been loaded, simply set Human `config.backend` to `WebGPU` and it will perform additional checks and initializations as needed
Note that `@tensorflow/tfjs-backend-webgpu` is currently in alpha phase of development and released packages are often too old
Instead, it is recommended to build `@tensorflow/tfjs-backend-webgpu` from sources directly from `main` branch
<br>
## Known Issues
See <TODO.md>