Skip to main content

pynccl - python bindings for NVIDIA NCCL libraries

Project description

pynccl

Nvidia NCCL2 Python bindings using ctypes and numba.

Many codes and ideas of this project come from the project pyculib. The main goal of this project is to use Nvidia NCCL with only python code and without any other compiled language code like C++. It is originally as part of the distributed deep learning project called necklace, and now it could be used at other places.

Install

  • NCCL

Please follow the Nvidia doc here to install NCCL.

  • pynccl

from source,

python setup.py install

or just,

pip install pynccl

Usage

Environments

  • for numba
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

(the following may be no need)

export NUMBAPRO_CUDALIB=/usr/local/cuda/lib64
export NUMBAPRO_NVVM=/usr/local/cuda/nvvm/lib64/libnvvm.so
export NUMBAPRO_LIBDEVICE=/usr/local/cuda/nvvm/libdevice/
  • for NCCL
export NUMBA_NCCLLIB=/usr/lib/x86_64-linux-gnu/

export NCCL_DEBUG=INFO

export NCCL_SOCKET_IFNAME=<your-ifname-like-ens11>

Examples

  • pynccl.NcclWrp

This piece of code is an example of NcclWrp with multiprocessing for dispatching the ncclUniqueId to all processes. See the complete code here

    nk = pynccl.NcclWrp(kn, rank, gpu_i)

    if rank == 0:

        nuid = nk.get_nuid()

        for j in range(kn - 1):
            q.put((nuid, w))

    else:
        nuid, w = q.get()

    nk.set_nuid(nuid)

    nk.init_comm()
  • pynccl.Nccl

You also can use the original functions of pynccl.Nccl, see the code here

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pynccl-0.1.2-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file pynccl-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pynccl-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9

File hashes

Hashes for pynccl-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c1a45dff2f4902f189d3d124fc7d6790be56618dea2569399212c792204aa0a9
MD5 3ce6be5319f6197030f4b2de92d1fdc1
BLAKE2b-256 2f83cc39f32bf06c59d73d26ac3637728645e41445231c84cb0de9f5821c462f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page