question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for half-precision complex numbers?

See original GitHub issue

This issue is mainly for tracking the upstream counterpart (https://github.com/numpy/numpy/issues/14753) for compatibility purposes. However, there are unique challenges and opportunities in CUDA that makes this support worth considering independently of upstream (for the moment).

Specifically, many scientific computing problems may have a portion (could be a significant one) in the computation that has high tolerance of low precision. For these applications, using half complex could further save both memory footprint and computing time. However, AFAIK all CUDA libraries (cuFFT, cuSPARSE, cuSOLVER, etc) do not support half complex, so in CuPy a type cast to single complex is a must if CUDA libraries are to be used. Using elementwise/reduction kernels is free of such a problem, though, so it’d be interesting to target them as the first step.

If I were to work on this, I would start from investigating whether thrust::complex can support complex<__half> or not, and build up the infrastructure gradually.

cc: @smarkesini

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:6
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
anarusecommented, Jul 15, 2020

You can get a better matrix multiply performance with TensorCore, but fp16 complex numbers are not supported by CUDA libraries except cublasLtMatmul() in cuBLASTLt. Even with cublasLtMatmul(), all matrices must be in planar complex format, so format conversion will be needed before and after the call.

2reactions
allisonvacanticommented, Dec 11, 2020

I should point out that thrust will eventually be replacing its complex header with the libcu++ (https://github.com/NVIDIA/libcudacxx) implementation, so keep an eye on how that effort evolves.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ARM Compiler v5.06 for uVision armcc User Guide
Compiler and library support for half-precision floating-point numbers. Half-precision is a floating-point format that occupies 16 bits. Half-precision ...
Read more >
Half-precision floating-point format - Wikipedia
In computing, half precision (sometimes called FP16) is a binary floating-point computer number format that occupies 16 bits in computer memory.
Read more >
Half Precision Code Generation Support - MATLAB & Simulink
Function MATLAB Simulation Support C/C++ Code Generation Support abs ✓ ✓ acos ✓ ✓ acosh ✓ ✓
Read more >
A Case Study for Mixed Precision Solvers on GPUs
Towards Half-Precision Computation for Complex Matrices: A Case Study for Mixed ... support native 16-bit floating-point arithmetic (i.e., half-precision).
Read more >
Half-precision floating-point format H5CPP C++ - HDF Forum
Recently I was approached to add Half-precision floating-point format to H5CPP ... I/O support for complex numbers: If you read HDF5 files, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found