Skip to main content

A Python interace to the GenTen tensor decomposition library

Project description

pygenten: Python bindings for the GenTen package

The python package pygenten provides python bindings for the GenTen package. GenTen is a tool for computing Canonical Polyadic (CP, also called CANDECOMP/PARAFAC) decompositions of tensor data. It is geared towards analysis of extreme-scale data and implements several CP decomposition algorithms that are parallel and scalable, including:

  • CP-ALS: The workhorse algorithm for Gaussian sparse or dense tensor data.
  • CP-OPT: CP decomposition of (sparse or dense) Gaussian data using a quasi-Newton optimization algorithm incorporating possible upper and lower bound constraints.
  • GCP: Generalized CP supporting arbitrary loss functions (Gaussian, Poisson, Bernoulli, ...), solved using quasi-Newton (dense tensors) or stochastic gradient descent (sparse or dense tensors) optimization methods.
  • Streaming GCP: A GCP algorithm that incrementally updates a GCP decomposition as new data is observed, suitable for in situ analysis of streaming data.
  • Federated GCP: A federated learning algorithm for GCP supporting asynchronous parallel communication.

GenTen builds on Kokkos and Kokkos Kernels to support shared memory parallel programming models on a variety of contemporary architectures, including:

  • OpenMP for CPUs.
  • CUDA for NVIDIA GPUs.
  • HIP for AMD GPUs.
  • SYCL for Intel GPUs.

GenTen also supports distributed memory parallelism using MPI.

Installing pygenten

There are two general approaches for building pygenten:

  • Enable python in the generic CMake build process described here.
  • Install using pip which automates the CMake build to some degree.

Installing with pip

pygenten has experimental support for installation using pip from the source distribution on pypi. Furthermore, binary wheels are provided in the following limited circumstances, enabling immediate installation:

OS Arch Kokkos Backend BLAS/LAPACK
Linux x86_64 OpenMP OpenBLAS
Macos-14 (Sonoma) arm64 OpenMP Accelerate
Macos-15 (Sequoia) arm64 OpenMP Accelerate
Windows amd64 Serial OpenBLAS

The pip installation leverages scikit-build-core to provide a CMake build backend for pip, which allows the user to provide CMake defines that control the pygenten build process and determine which architectures/parallel programming models are enabled. We thus recommend becoming familiar with the CMake build process for GenTen in general as described here before continuing. In particular, the user must have BLAS and LAPACK libraries available in their build environment that can either be automatically discovered by CMake or manually specified through LAPACK_LIBS.

Basic installation

A basic installation of pygenten can be done simply by:

pip install pygenten

This will install the binary wheel if it is available, and if it isn't, build GenTen and pygenten for a CPU architecture using OpenMP parallelism using a default compiler from the user's path. During the build of pygenten, CMake will attempt to locate valid BLAS and LAPACK libraries in the user environment. If these cannot be found, the user can customize the build by specifying LAPACK_LIBS as described below.

Customized installation

To customize the GenTen/pygenten build, you must first instruct pip to compile from source by adding the --no-binary pygenten command-line argument. The can then be customized by passing CMake defines to specify compilers, BLAS/LAPACK libraries, host/device architectures, and enabled programming models. This is done by adding command-line arguments to pip of the form

--config-settings=cmake.define.SOME_DEFINE=value

or

-C cmake.args=-DSOME_DEFINE=value

Any CMake define accepted by GenTen/Kokkos/KokkosKernels can be passed this way. Since this is fairly verbose and GenTen can require several defines, several meta-options are provided to enable supported parallel programming models:

CMake Define What it enables
PYGENTEN_MPI Enable distributed parallelism with MPI. Sets the execution space to Serial by default.
PYGENTEN_OPENMP Enable shared memory host parallelism using OpenMP
PYGENTEN_SERIAL No host shared memory parallelism. Useful for builds targeting GPU architectures or distributed memory parallelism
PYGENTEN_CUDA Enable CUDA parallelism for NVIDIA GPU architectures
PYGENTEN_HIP Enable HIP parallelism for AMD GPU architectures
PYGENTEN_SYCL Enable SYCL parallelism for Intel GPU architectures

When enabling GPU architectures, one also needs to specify the corresponding architecture via Kokkos_ARCH_* defines described here.

For example, an MPI+CUDA build for a Volta V100 GPU architecture can be obtained with

pip install -v --no-binary pygenten -C cmake.args=-DPYGENTEN_CUDA=ON;-DKokkos_ARCH_VOLTA70=ON;-DPYGENTEN_MPI=ON pygenten

For MPI builds, pygenten assumes the MPI compiler wrappers mpicxx and mpicc are available in the user's path. If this is not correct, the user can specify the appropriate compiler by setting the appropriate CMake define, e.g., CMAKE_CXX_COMPILER. Furthermore, for CUDA builds, pygenten will build with the nvcc_wrapper script as the compiler as required by Kokkos, which calls g++ as the host compiler by default. This can be changed by setting the NVCC_WRAPPER_DEFAULT_COMPILER environment variable. Moreover, for MPI+CUDA, pygenten will set environment variables to override the compiler wrapped by mpicxx to use nvcc_wrapper, which currently works only with OpenMPI and MPICH. Finally, for MPI+HIP or MPI+SYCL builds, pygenten assumes the compiler wrappers call the appropriate device-enabled compiler, e.g., hipcc for AMD and icpx for Intel.

Installing numpy

pygenten relies on numpy, both of which are compiled extension libraries leveraging OpenMP and BLAS/LAPACK. Therefore, module import errors can occur if pygenten and numpy are compiled in very different environments, due to, e.g., symbol conflicts in libstdc++. This typically happens when pygenten is compiled with a much newer compiler than what was used to compile the numpy wheel. Futhermore, we have observed slower performance in pygenten in some cases when numpy is imported before pygenten, which we believe is due to inconsistent OpenMP and/or BLAS/LAPACK libraries between the two packages. Thus, the most robust way to use pygenten is to also install numpy from source, using the same build environment as pygenten. This can be done in a similar manner as pygenten by providing configure options to numpy through pip, e.g.,

pip install --no-binary numpy -Csetup-args=-Dblas=my_blas -Csetup-args=-Dlapack=my_lapack numpy

to specify the appropriate BLAS and LAPACK libraries (called my_blas and my_lapack in this case). Compilers can be specified through the CC, CXX, and FC environment variables. More details can be found here. However, we only recommend doing this if you see errors when importing pygenten or you observe slower performance than what would be observed with the genten command-line tool.

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 Distributions

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

pygenten-0.1.3-cp313-cp313-macosx_15_0_arm64.whl (11.1 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

pygenten-0.1.3-cp313-cp313-macosx_14_0_arm64.whl (11.9 MB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

pygenten-0.1.3-cp312-cp312-macosx_15_0_arm64.whl (11.1 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

pygenten-0.1.3-cp312-cp312-macosx_14_0_arm64.whl (11.9 MB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

pygenten-0.1.3-cp311-cp311-macosx_15_0_arm64.whl (11.1 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

pygenten-0.1.3-cp311-cp311-macosx_14_0_arm64.whl (11.9 MB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

pygenten-0.1.3-cp310-cp310-macosx_15_0_arm64.whl (11.1 MB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

pygenten-0.1.3-cp310-cp310-macosx_14_0_arm64.whl (11.9 MB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

pygenten-0.1.3-cp39-cp39-macosx_15_0_arm64.whl (11.1 MB view details)

Uploaded CPython 3.9macOS 15.0+ ARM64

pygenten-0.1.3-cp39-cp39-macosx_14_0_arm64.whl (11.9 MB view details)

Uploaded CPython 3.9macOS 14.0+ ARM64

pygenten-0.1.3-cp38-cp38-macosx_15_0_arm64.whl (11.1 MB view details)

Uploaded CPython 3.8macOS 15.0+ ARM64

pygenten-0.1.3-cp38-cp38-macosx_14_0_arm64.whl (11.9 MB view details)

Uploaded CPython 3.8macOS 14.0+ ARM64

File details

Details for the file pygenten-0.1.3-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pygenten-0.1.3-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 8c70364e8fbf838bd84b5a12e61e92761cd778a8119dbf85e65f0e5d52bcaf47
MD5 2e3728ab1f2ecca45aa176e897bed251
BLAKE2b-256 ceb9d2c5cab59a73712d5e41b6a907ced549fff9991631f0693725e334831411

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygenten-0.1.3-cp313-cp313-macosx_15_0_arm64.whl:

Publisher: build_and_publish_to_pypi_macos.yml on sandialabs/GenTen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygenten-0.1.3-cp313-cp313-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pygenten-0.1.3-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 1be61b98ec8445b78cfc1528e7016fe349533affdae4088d16234b6a5cbe7f90
MD5 6622604a1ce5d385821b6b4f43895be5
BLAKE2b-256 817c24f7ae42eccd20dd2053b094354dbf7a1d3c53092be90b83841c753077e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygenten-0.1.3-cp313-cp313-macosx_14_0_arm64.whl:

Publisher: build_and_publish_to_pypi_macos.yml on sandialabs/GenTen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygenten-0.1.3-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pygenten-0.1.3-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 d1900e4404e7275f51d41057a4a71be758a703e2f04902e90349f70551a049be
MD5 1204a25832fe9b6b3a51d91f4819ba4e
BLAKE2b-256 f85fd32e8c8eaf7a5182f1bb998282e5aefbbe1da2de6c9812a6a4cca1f21c79

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygenten-0.1.3-cp312-cp312-macosx_15_0_arm64.whl:

Publisher: build_and_publish_to_pypi_macos.yml on sandialabs/GenTen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygenten-0.1.3-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pygenten-0.1.3-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 e6e06a569ddeca0aaac7b033bf9cb7ab33c26eb2de6fbc391e70c883c1a77b9f
MD5 8ca6caf8bd970451522befb266ea7afa
BLAKE2b-256 644e3792588dd82f7b104b45a69eb0923fe2abbb0f7e2128d24b6642e0a3b2bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygenten-0.1.3-cp312-cp312-macosx_14_0_arm64.whl:

Publisher: build_and_publish_to_pypi_macos.yml on sandialabs/GenTen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygenten-0.1.3-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pygenten-0.1.3-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 9062d840842792ac5b156b41a92029a914dafcc45bbf6d21345fa23c4188c288
MD5 fa2725e9cfa7b6c81f26c26b79ac3c58
BLAKE2b-256 5dd071e9064d3a6cc3a160abc2b3a7bf0a291feb210d4b0790db8a9fbbd13a96

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygenten-0.1.3-cp311-cp311-macosx_15_0_arm64.whl:

Publisher: build_and_publish_to_pypi_macos.yml on sandialabs/GenTen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygenten-0.1.3-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pygenten-0.1.3-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 224423a84b76e8d89bc459a36e50097b76e6872b1076561d5759eee12f1d04df
MD5 1a52bc56f0cae3051a8b1b3ee70e6865
BLAKE2b-256 a6c78cfbf90b879a672459262f90f1cc5716c27d061302c4c914c76e1ff7f650

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygenten-0.1.3-cp311-cp311-macosx_14_0_arm64.whl:

Publisher: build_and_publish_to_pypi_macos.yml on sandialabs/GenTen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygenten-0.1.3-cp310-cp310-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pygenten-0.1.3-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 5e839411e36f2f1749dba68889d7be6666a84d1ac43b97874128224cf7975e59
MD5 059a2a9fc145cbbd9c6b06eefe8ffe57
BLAKE2b-256 7f10696e73083d2a901925f64781925c4385071e6cb3449bcc244e531ef1ffa0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygenten-0.1.3-cp310-cp310-macosx_15_0_arm64.whl:

Publisher: build_and_publish_to_pypi_macos.yml on sandialabs/GenTen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygenten-0.1.3-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pygenten-0.1.3-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 f895450d60c55363f2d607fa3b051e6bc979c17c7ec0963aa4e5b69f7ded4e40
MD5 8e2cbfdff836c9bbeab362068834e207
BLAKE2b-256 011713387ff6034d43b3f0d17a2a42b177578740bd28417c3287e5e45a766e58

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygenten-0.1.3-cp310-cp310-macosx_14_0_arm64.whl:

Publisher: build_and_publish_to_pypi_macos.yml on sandialabs/GenTen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygenten-0.1.3-cp39-cp39-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pygenten-0.1.3-cp39-cp39-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 0be6c6706384286cdc2cabb40612cb82372ee470a2a99fb4c94f639119f8b6fc
MD5 e222453ffc8384a16fc23e4b9b156e50
BLAKE2b-256 51ee99fd78a43109f53bdb8a3f8453f4e310c1ae44f50717a41dc4b7b94f2d2f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygenten-0.1.3-cp39-cp39-macosx_15_0_arm64.whl:

Publisher: build_and_publish_to_pypi_macos.yml on sandialabs/GenTen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygenten-0.1.3-cp39-cp39-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pygenten-0.1.3-cp39-cp39-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 45a431e706d6b3a5e213ea0ab00f5c2145c41eb32215e02e416ba82fc6398000
MD5 0c68866283d9a87e463e906eedd0e2cd
BLAKE2b-256 1123d1e87e05910d6244728b0ffe78e2edadeabdc61bb89579c8598b1634c884

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygenten-0.1.3-cp39-cp39-macosx_14_0_arm64.whl:

Publisher: build_and_publish_to_pypi_macos.yml on sandialabs/GenTen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygenten-0.1.3-cp38-cp38-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pygenten-0.1.3-cp38-cp38-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 23dd857f7c57f7fb7da26d499364fe100e146421b57c0bb3ec45ede3d9fe03ce
MD5 766680ba55670b6ceb49add0c6c4e96d
BLAKE2b-256 113edf60a14775b5555946f2f569408bc0c8cb647bd23d627d40ab879e6e61fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygenten-0.1.3-cp38-cp38-macosx_15_0_arm64.whl:

Publisher: build_and_publish_to_pypi_macos.yml on sandialabs/GenTen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygenten-0.1.3-cp38-cp38-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pygenten-0.1.3-cp38-cp38-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 0732d848d0953aef15c5d99c42ec79de5b6f42e2cd213e37a0d4697aab4258fb
MD5 959675aeef1cc38d5af4aa9ac9313844
BLAKE2b-256 76ba1edce182ae5a8084fe5dfe305b5d8c9e7af9498f465d5c795b0289332594

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygenten-0.1.3-cp38-cp38-macosx_14_0_arm64.whl:

Publisher: build_and_publish_to_pypi_macos.yml on sandialabs/GenTen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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